verify method
Verifies that the signature for the message is valid for the public key. The message should have been prepended with "MX" when signing.
Implementation
Future<bool> verify(Uint8List message, crypto.Signature signature) async {
final publicKey = toVerifyKey();
// Prepend the prefix
final signBytes = utf8.encode(BYTES_SIGN_PREFIX);
// Merge the byte arrays
final buffer = Uint8List.fromList([
...signBytes,
...message,
]);
return await Ed25519().verify(
buffer,
signature: Signature(
signature.bytes,
publicKey: publicKey,
),
);
}