verify static method
Verifies a signature on a message by an ECDSA P-256 curve key-pair (also known as secp256r1) using SHA-256 as the hash function.
Implementation
static Future<bool> verify({ required Uint8List message, required Uint8List signature, required Uint8List public_key_DER}) async {
CryptoKey public_key = await promiseToFuture(callMethod(window.crypto!.subtle!, 'importKey', [
'spki',
public_key_DER,
EcKeyImportParams(
name: 'ECDSA',
namedCurve: 'P-256'
),
true, // its a public-key here
['verify']
]));
return await promiseToFuture(callMethod(window.crypto!.subtle!, 'verify', [
EcdsaParams(
name: 'ECDSA',
hash: 'SHA-256'
),
public_key,
signature.buffer,
message.buffer
]));
}