Ethsigning helps you validate signatures for both externally owned account (EOA) wallets and smart contract wallets. This includes validation support for:
- EIP-712: Typed structured data hashing and signing
- ERC-1271: Standard Signature Validation Method for Contracts
- ERC-6492: Signature Validation for Predeploy Contracts
We've also prepared a short guide on signatures; check it here if you'd like to learn more!
npm install ethsigning
or use any package manager you like!
Ethsigning package comes with 2 methods, which are
isValidMessageSignature: (
address: string,
message: string | Uint8Array,
signature: string,
provider: ethers.providers.Provider
) => Promise<boolean>and
isValidTypedDataSignature: (
address: string,
typedData: TypedData,
signature: string,
provider: ethers.providers.Provider
) => Promise<boolean>Example:
import { ethers } from 'ethers'
import { isValidMessageSignature } from 'ethsigning'
const provider = new ethers.providers.JsonRpcProvider('https://nodes.sequence.app/mainnet')
const isValid = await isValidMessageSignature(
address, // Address of the signer
message,
signature,
provider
)
console.log('isValid:', isValid)- If you are validating a signature that was signed with a smart contract, make sure the provider you pass is for the network the message was signed on.
You can try it here to see the package in action.