verifySecp256k1Blob function

bool verifySecp256k1Blob(
  1. Uint8List blob,
  2. Uint8List signature,
  3. Secp256k1PublicKey publicKey
)

Implementation

bool verifySecp256k1Blob(
  Uint8List blob,
  Uint8List signature,
  Secp256k1PublicKey publicKey,
) {
  final digest = SHA256Digest();
  final signer = ECDSASigner(digest, HMac(digest, 64));
  final sig = ECSignature(
    signature.sublist(0, 32).toBn(endian: Endian.big),
    signature.sublist(32).toBn(endian: Endian.big),
  );
  final kpub = secp256k1Params.curve.decodePoint(publicKey.toRaw())!;
  final pub = ECPublicKey(kpub, secp256k1Params);
  signer.init(false, p_api.PublicKeyParameter(pub));
  return signer.verifySignature(blob, sig);
}