ecRecover static method
String
ecRecover(
{ - required String signature,
- required Uint8List message,
- int? chainId,
- 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);
}