Signature verification
Focus: one signature-checking entry that verifies a signed byte message from the transaction sender.
crypto_tools.slx
entry verify_from_sender(message: bytes, signature: Signature) -> bool {
let sender: Address = Transaction::current().unwrap().source()
return signature.verify(message, sender.to_point())
}How it works
message: bytesis the exact byte payload the wallet signed.signature: Signatureis verified inside the contract.Transaction::current().unwrap().source()gets the transaction sender address.sender.to_point()converts the address into the public key point expected bysignature.verify.- The entry returns
trueonly when the signature matches the sender and message.
Use wallet RPC sign_data to produce signatures for verify_from_sender.
Last updated on