verify method
Verifies the signature.
Implementation
@override
Future<bool> verify(List<int> data, {required Signature signature}) async {
if (usePlugin) {
try {
final publicKey = signature.publicKey as SimplePublicKey;
final result = await channel.invokeMethod(
'ed25519_verify',
{
'message': base64Encode(data),
'signature': base64Encode(signature.bytes),
'publicKey': base64Encode(publicKey.bytes),
},
) as Map;
final error = result['error'];
if (error is String) {
throw StateError(
'error in "package:better_cryptography_flutter": $error');
}
return result['result'] as bool;
} catch (error, stackTrace) {
usePlugin = false;
reportError(error, stackTrace);
}
}
return super.verify(data, signature: signature);
}