verifyMessage static method

bool verifyMessage(
  1. String message,
  2. String signature,
  3. Uint8List publicKey
)

Verify signature: recover signer address from message and signature

Implementation

static bool verifyMessage(String message, String signature, Uint8List publicKey) {
  if (signature.length != 132) { // 0x + 130 (r+s+v as hex)
    throw ArgumentError('Signature must be 132 characters (0x + r + s + v)');
  }

  final hashed = ethereumMessageHash(message);
  return EcdaSignature.verify(dynamicToString(hashed), publicKey, signature);
}