recover method

ECPublicKey? recover(
  1. Uint8List hash
)

Given a 32-byte hash, returns a public key recovered from the signature and hash. This can be compared against the expected public key or public key hash to determine if the message was signed correctly. If a public key cannot be extracted, null shall be returned.

Implementation

ECPublicKey? recover(Uint8List hash) {
  checkBytes(hash, 32);
  final pkBytes = secp256k1.ecdaSignatureRecoverPubKey(
    _signature, recid, hash, compressed,
  );
  return pkBytes != null ? ECPublicKey(pkBytes) : null;
}