verifySolanaSignature function
Check a sol-signature against the request it answers.
Implementation
VerifyResult verifySolanaSignature(VerifySolanaSignatureArgs args) {
final broadcast = args.broadcastMessageBytes;
if (broadcast != null && !equalBytes(broadcast, args.signData)) {
return failed('the message to broadcast is not the one the device signed');
}
bool ok;
try {
ok = ed25519Verify(args.publicKey, args.signData, args.signature);
} on Object catch (e) {
return failed('Solana signature could not be checked: $e');
}
return ok
? verified
: failed('the signature does not belong to this account');
}