064c109b64
Add prefix and return verify result
15 lines
395 B
Python
15 lines
395 B
Python
from libp2p.crypto.keys import PublicKey
|
|
|
|
|
|
def signature_validator(pubkey: PublicKey, payload: bytes, signature: bytes) -> bool:
|
|
"""
|
|
Verify the message against the given public key.
|
|
|
|
:param pubkey: the public key which signs the message.
|
|
:param msg: the message signed.
|
|
"""
|
|
try:
|
|
return pubkey.verify(payload, signature)
|
|
except Exception:
|
|
return False
|