All Projects → authereum → is-valid-signature

authereum / is-valid-signature

Licence: MIT License
EIP1271 signature checker implementation in JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language
solidity
1140 projects

Projects that are alternatives of or similar to is-valid-signature

wagmi
React Hooks for Ethereum
Stars: ✭ 1,691 (+9294.44%)
Mutual labels:  web3
augmented-finance-protocol
High-yield lending and low-rate borrowing DeFi protocol
Stars: ✭ 28 (+55.56%)
Mutual labels:  web3
ethjs-extras
All your dApp / App essentials for working with Ethereum.
Stars: ✭ 17 (-5.56%)
Mutual labels:  web3
exw3
High level Ethereum RPC Client for Elixir
Stars: ✭ 127 (+605.56%)
Mutual labels:  web3
web3
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.
Stars: ✭ 609 (+3283.33%)
Mutual labels:  web3
web4
Web4 is a new way to distribute decentralized apps. You only need to deploy one smart contract using WebAssembly to deploy whole web app.
Stars: ✭ 32 (+77.78%)
Mutual labels:  web3
TypeChain
🔌 TypeScript bindings for Ethereum smart contracts
Stars: ✭ 1,881 (+10350%)
Mutual labels:  web3
aragon.js
(Aragon 1) A monorepo of JavaScript libraries for interacting with Aragon
Stars: ✭ 84 (+366.67%)
Mutual labels:  web3
blockhead
Crypto portfolio tracker, DeFi dashboard, NFT viewer and data explorer for the Ethereum/EVM-based blockchain ecosystem and the web 3.0-powered metaverse https://gitcoin.co/grants/2966/blockhead
Stars: ✭ 41 (+127.78%)
Mutual labels:  web3
ocean.js
🦑 Ocean Protocol JavaScript library to privately & securely publish, exchange, and consume data.
Stars: ✭ 77 (+327.78%)
Mutual labels:  web3
react-nft-gallery
🖼️ React component to display your NFTs as a gallery
Stars: ✭ 50 (+177.78%)
Mutual labels:  web3
dApp-Builder
No description or website provided.
Stars: ✭ 108 (+500%)
Mutual labels:  web3
developerdao.com
A community of builders who believe in collective ownership of the internet
Stars: ✭ 381 (+2016.67%)
Mutual labels:  web3
web3-gear
Proxy Thor's RESTful API to Eth JSON-RPC, to support Remix, Truffle and more.
Stars: ✭ 27 (+50%)
Mutual labels:  web3
Wallet3
A secure mobile wallet for web3
Stars: ✭ 13 (-27.78%)
Mutual labels:  web3
awesome-web3-security
🕶 A high-level overview of the EVM security ecosystem
Stars: ✭ 42 (+133.33%)
Mutual labels:  web3
webflow-nft-components
Connect web3 to Webflow without coding skills
Stars: ✭ 69 (+283.33%)
Mutual labels:  web3
web3-is-going-great
A timeline of some of the greatest hits in cryptocurrencies, NFTs, and other web3 projects since the beginning of 2021
Stars: ✭ 334 (+1755.56%)
Mutual labels:  web3
babel-preset-react-native-web3
deprecated: babel preset for react native, web3 and babel 6
Stars: ✭ 22 (+22.22%)
Mutual labels:  web3
ar-nft
👾 A React Native app to visualize your NFTs in AR
Stars: ✭ 71 (+294.44%)
Mutual labels:  web3

is-valid-signature npm version

Check if a signature is valid for an Ethereum address. Works for both externally owned accounts and contract accounts that follow the ERC1271 standard.

Install

npm install is-valid-signature

Getting started

Check signatures for externally owned accounts

const isValidSignature = require('is-valid-signature')

const signer = YOUR_SIGNER_ADDRESS

// Get a signature
const message = web3.utils.soliditySha3('Hello world')
const signature = await web3.eth.sign(message, signer)

// Check if the signature is valid
const isValid = await isValidSignature(
  signer,
  message,
  signature,
  web3.currentProvider
)

Check signatures for ERC-1271 contracts

const isValidSignature = require('is-valid-signature')

const signer = YOUR_SIGNER_ADDRESS

// Get contract where `signer` can sign on behalf of contract
const contract = ERC1271.at(YOUR_CONTRACT_ADDRESS)

// Get a signature
const message = web3.utils.soliditySha3('Hello world')
const signature = await web3.eth.sign(message, signer)

// Check if the signature is valid
const isValid = await isValidSignature(
  contract.address,
  message,
  signature,
  web3.currentProvider
)

ERC-1271

ERC-1271 is currently a draft and there are multiple proposed interfaces. This package supports the following ERC-1271 interface.

contract ERC1271 {
  function isValidSignature(
    bytes memory _messageHash,
    bytes memory _signature)
    public
    view
    returns (bytes4 magicValue);
}

Test

npm test

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].