verify function

bool verify(
  1. String message,
  2. Uint8List signature,
  3. Secp256k1PublicKey publicKey
)

Implementation

bool verify(String message, Uint8List signature, Secp256k1PublicKey publicKey) {
  final blob = message.plainToU8a(useDartEncode: true);
  final digest = SHA256Digest();
  final signer = ECDSASigner(digest, HMac(digest, 64));

  var sig = ECSignature(signature.sublist(0, 32).toBn(endian: Endian.big),
      signature.sublist(32).toBn(endian: Endian.big));

  var kpub = params.curve.decodePoint(publicKey.toRaw())!;

  var pub = ECPublicKey(kpub, params);

  signer.init(false, p_api.PublicKeyParameter(pub));
  return signer.verifySignature(blob, sig);
}