Change verify_signature_standard_ops : Totally depends on external API

This commit is contained in:
Vivek Teega 2022-07-13 16:50:12 +05:30
parent 3618687377
commit c4f1c8b5af

View File

@ -403,7 +403,7 @@ def verify_signature(sig, pub_key, msg):
return True if result else False return True if result else False
def verify_signature_standard_ops(sig, pub_key, msg, flo_id): def verify_signature_standard_ops(sig, pub_key, msg, floID):
""" """
Verify signature for message and given public key Verify signature for message and given public key
@ -413,25 +413,22 @@ def verify_signature_standard_ops(sig, pub_key, msg, flo_id):
:flo_id: FLO ID in HEX encoded string. :flo_id: FLO ID in HEX encoded string.
:return: boolean. :return: boolean.
""" """
pub_key = pyflo.PublicKey(pub_key) url = 'https://flo-sign-validator.duckdns.org'
derived_floid = pyflo.Address(pub_key, address_type="P2PKH").address post_data = {
if flo_id==derived_floid: 'floID': floID,
url = 'https://flo-sign-validator.duckdns.org' 'pubKey': pub_key,
post_data = { 'message': msg,
'pubKey': pub_key, 'sign': sig
'message': msg, }
'sign': sig signature_verification = requests.post(url, json = post_data)
} signature_verification = json.loads(signature_verification.text)
signature_verification = requests.post(url, json = post_data) if signature_verification['success']:
signature_verification = json.loads(signature_verification.text) return True
if signature_verification['message_sign_match']:
return True
else:
return False
else: else:
return False return False
def to_base(n, base): def to_base(n, base):
if base == 10: if base == 10:
return n return n