Skip to content

0xsequence/ethsigning

Repository files navigation

header

Ethsigning helps you validate signatures for both externally owned account (EOA) wallets and smart contract wallets. This includes validation support for:

We've also prepared a short guide on signatures; check it here if you'd like to learn more!

Installation

npm install ethsigning

or use any package manager you like!

Usage

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)

Notes

  • 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.

Package in action

You can try it here to see the package in action.

About

npm install ethsigning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors