Commit 45a105cf authored by Vincent Texier's avatar Vincent Texier

[fix] #74 Support binary signed data (Break BC)

parent cc7e2fc5
......@@ -58,13 +58,13 @@ class VerifyingKey(libnacl.sign.Verifier):
except ValueError:
return False
def verify_message(self, message: bytes) -> str:
def get_verified_data(self, data: bytes) -> bytes:
"""
Check specified signed message signature and return message
Check specified signed data signature and return data
Return error message if signature is invalid
Raise exception if signature is not valid
:param bytes message: Message + signature
:return str:
:param data: Data + signature
:return:
"""
return self.verify(message).decode('utf-8')
return self.verify(data)
......@@ -23,7 +23,7 @@ if __name__ == '__main__':
# Verify the message!
verifier = VerifyingKey(pubkeyBase58)
try:
message = verifier.verify_message(signed_message)
message = verifier.get_verified_data(signed_message).decode('utf-8')
print("Signature valid for this message:")
except ValueError as error:
message = str(error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment