Update verify_signature_standard_ops to check if the floid is same as public key

This commit is contained in:
Vivek Teega 2022-07-12 11:20:24 +00:00
parent c9a58a7305
commit 498d0064cd

View File

@ -403,15 +403,18 @@ 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): def verify_signature_standard_ops(sig, pub_key, msg, flo_id):
""" """
Verify signature for message and given public key Verify signature for message and given public key
:param sig: signature in bytes or HEX encoded string. :param sig: signature in bytes or HEX encoded string.
:param pub_key: public key in bytes or HEX encoded string. :param pub_key: public key in bytes or HEX encoded string.
:param msg: message in bytes or HEX encoded string. :param msg: message in bytes, string or HEX encoded string.
:flo_id: FLO ID in HEX encoded string.
:return: boolean. :return: boolean.
""" """
derived_floid = pyflo.Address(pub_key)
if flo_id==derived_floid:
url = 'https://flo-sign-validator.duckdns.org' url = 'https://flo-sign-validator.duckdns.org'
post_data = { post_data = {
'pubKey': pub_key, 'pubKey': pub_key,
@ -424,6 +427,8 @@ def verify_signature_standard_ops(sig, pub_key, msg):
return True return True
else: else:
return False return False
else:
return False
def to_base(n, base): def to_base(n, base):