Skip to main content
Verify the authenticity of signed messages and typed data to ensure they originated from the expected address.

Setup EVM Libraries First

Wagmi is not available on React Native. Use Ethers.js or Viem for EVM operations.

Verify Personal Signatures

import { ethers } from "ethers";

async function verifyPersonalSignature(
  message: string,
  signature: string,
  signerAddress: string
) {
  const recoveredAddress = ethers.verifyMessage(message, signature);
  const isValid = recoveredAddress.toLowerCase() === signerAddress.toLowerCase();
  console.log("Signature valid:", isValid);
  return isValid;
}

Verify Typed Data Signatures (EIP-712)

import { ethers } from "ethers";

async function verifyTypedDataSignature(
  domain: any,
  types: any,
  value: any,
  signature: string,
  signerAddress: string
) {
  const recoveredAddress = ethers.verifyTypedData(domain, types, value, signature);
  const isValid = recoveredAddress.toLowerCase() === signerAddress.toLowerCase();
  console.log("Signature valid:", isValid);
  return isValid;
}

Next Steps

Sign Messages

Sign Typed Data

Execute Transactions