verify method

bool verify({
  1. required String publicKey,
  2. required String message,
  3. required String signature,
})

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);
  NostrClientUtils.log(
    "verified message with public key: $publicKey, with it's value is: $isVerified",
  );

  return isVerified;
}