recoverPublicKey static method

Uint8List recoverPublicKey(
  1. Uint8List message,
  2. Uint8List signature65
)

Implementation

static Uint8List recoverPublicKey(Uint8List message, Uint8List signature65) {
  if (signature65.length != 65) {
    throw ArgumentError('Signature must be 65 bytes');
  }
  final hash = messageHash(message);
  final sigBytes = signature65.sublist(0, 64);
  final v = signature65[64];
  final recId = v >= 27 ? v - 27 : v;
  final recSig = RecoverableEcdsaSig(sigBytes, recId);
  return recSig.recover(hash, compressed: false);
}