ecRecover static method

String ecRecover({
  1. required String signature,
  2. required Uint8List message,
  3. int? chainId,
  4. required dynamic isPersonalSign,
})

Implementation

static String ecRecover(
    {required String signature,
    required Uint8List message,
    int? chainId,
    required isPersonalSign}) {
  final messageHash = isPersonalSign ? _getPersonalMessage(message) : message;
  final publicKey = recoverPublicKeyFromSignature(
      SignatureUtil.fromRpcSig(signature), messageHash);
  if (publicKey == null)
    throw Exception('Can not recover public key from signature');
  return bytesToHex(publicKeyToAddress(publicKey), include0x: true);
}