isValidSignature static method
Implementation
static bool isValidSignature(BigInt r, BigInt s, int v,
{bool homesteadOrLater = true, int? chainId}) {
var SECP256K1_N_DIV_2 = decodeBigInt(hex.decode(
'7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0'));
var SECP256K1_N = decodeBigInt(hex.decode(
'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'));
if (encodeBigInt(r).length != 32 || encodeBigInt(s).length != 32) {
return false;
}
if (!_isValidSigRecovery(_calculateSigRecovery(v, chainId: chainId))) {
return false;
}
if (r == BigInt.zero ||
r > SECP256K1_N ||
s == BigInt.zero ||
s > SECP256K1_N) {
return false;
}
if (homesteadOrLater && s > SECP256K1_N_DIV_2) {
return false;
}
return true;
}