verify method
You can use this method to verify a message
with a publicKey
and it's signature
.
it returns a bool that indicates if the message
is verified or not.
final isVerified = Nostr.instance.keysService.verify(
publicKey: yourPublicKey,
message: yourMessage,
signature: yourSignature,
);
print(isVerified); // ...
Implementation
bool verify({
required String publicKey,
required String message,
required String signature,
}) {
final hexEncodedMessage =
Nostr.instance.utilsService.hexEncodeString(message);
final isVerified =
NostrKeyPairs.verify(publicKey, hexEncodedMessage, signature);
utils.log(
"verified message with public key: $publicKey, with it's value is: $isVerified",
);
return isVerified;
}