Update verify_signature_standard_ops to check if the floid is same as public key
This commit is contained in:
parent
c9a58a7305
commit
498d0064cd
@ -403,25 +403,30 @@ 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.
|
||||||
"""
|
"""
|
||||||
url = 'https://flo-sign-validator.duckdns.org'
|
derived_floid = pyflo.Address(pub_key)
|
||||||
post_data = {
|
if flo_id==derived_floid:
|
||||||
'pubKey': pub_key,
|
url = 'https://flo-sign-validator.duckdns.org'
|
||||||
'message': msg,
|
post_data = {
|
||||||
'sign': sig
|
'pubKey': pub_key,
|
||||||
}
|
'message': msg,
|
||||||
signature_verification = requests.post(url, json = post_data)
|
'sign': sig
|
||||||
signature_verification = json.loads(signature_verification.text)
|
}
|
||||||
if signature_verification['message_sign_match']:
|
signature_verification = requests.post(url, json = post_data)
|
||||||
return True
|
signature_verification = json.loads(signature_verification.text)
|
||||||
|
if signature_verification['message_sign_match']:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user