{"id":13735823,"url":"https://github.com/AmbireTech/signature-validator","last_synced_at":"2025-05-08T12:31:19.405Z","repository":{"id":57681347,"uuid":"488170638","full_name":"AmbireTech/signature-validator","owner":"AmbireTech","description":"TypeScript library that supports validation of any type of signature: account abstraction (ERC-1271, ERC-6492), standard signatures, ERC-712","archived":false,"fork":false,"pushed_at":"2024-04-05T10:51:34.000Z","size":609,"stargazers_count":48,"open_issues_count":3,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-23T10:07:15.689Z","etag":null,"topics":["eip1271","eip6492","eip712","erc1271","ethereum","ethereum-signer","ethers","ethersjs","evm","signature-validation","signtypeddata","smart-contracts"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AmbireTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-03T10:49:54.000Z","updated_at":"2024-06-03T15:12:11.783Z","dependencies_parsed_at":"2024-01-11T23:23:00.825Z","dependency_job_id":"e310c5ce-e56a-4691-a98e-d5f38606f4e8","html_url":"https://github.com/AmbireTech/signature-validator","commit_stats":{"total_commits":43,"total_committers":4,"mean_commits":10.75,"dds":0.2790697674418605,"last_synced_commit":"7e5e345ec215c47909856032c53d31119163e88d"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmbireTech%2Fsignature-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmbireTech%2Fsignature-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmbireTech%2Fsignature-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmbireTech%2Fsignature-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AmbireTech","download_url":"https://codeload.github.com/AmbireTech/signature-validator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224593865,"owners_count":17337185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eip1271","eip6492","eip712","erc1271","ethereum","ethereum-signer","ethers","ethersjs","evm","signature-validation","signtypeddata","smart-contracts"],"created_at":"2024-08-03T03:01:11.654Z","updated_at":"2025-05-08T12:31:19.388Z","avatar_url":"https://github.com/AmbireTech.png","language":"Solidity","funding_links":[],"categories":["Software Development"],"sub_categories":["JavaScript"],"readme":"# Signature Validator library\n\nAs signatures can be daunting at times, this is a library aiming to implement universal signature verification, supporting: \n\n- Standard message verification (`eth_sign`)\n- EIP-712 Typed data verification (`eth_signTypedData_v*`)\n- ERC-1271 Smart contract on-chain verification (`isValidSignature`)\n- [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492): Signature verification for pre-deploy counterfactual contracts\n\n### Usage\n\n---\n\nSimple `eth_sign` verification\n```ts\nimport ethers from 'ethers';\nimport { verifyMessage } from '@ambire/signature-validator';\n\nconst provider = new ethers.providers.JsonRpcProvider('https://polygon-rpc.com')\n\nasync function run() {\n\t// Replace `ethers.verifyMessage(message, signature) === signer` with this:\n\tconst isValidSig = await verifyMessage({\n\t    signer: '0xaC39b311DCEb2A4b2f5d8461c1cdaF756F4F7Ae9',\n\t    message: 'My funds are SAFU with Ambire Wallet',\n\t    signature: '0x9863d84f3119ac01d9e3bf9294e6c0c3572a07780fc7c49e8dc913806f4b1dbd4cc075462dc84422a9b981b2556f9c9197d76da7ba3603e53e9300869c574d821c',\n\t    // this is needed so that smart contract signatures can be verified; this property can also be a viem PublicClient\n\t    provider,\n\t})\n\tconsole.log('is the sig valid: ', isValidSig)\n}\nrun().catch(e =\u003e console.error(e))\n```\n\nFor more examples, you can check the /tests folder\n\n### viem support\nThe `provider` property can also be a `viem` `PublicClient`, as shown in the tests (`testConfig.js`).\n\n### On-chain usage\nFor on-chain usage, we've deployed a singleton here: https://etherscan.io/address/0x7dd271fa79df3a5feb99f73bebfa4395b2e4f4be#code\n\nAnd it can be deployed at the same address on every othe EVM network thanks to EIP-2470. If you wish to deploy it yourself, just use the [singleton factory](https://etherscan.io/address/0xce0042B868300000d44A59004Da54A005ffdcf9f) (use the target network's explorer) and use the bytecode resulted from compiling `UniversalSigValidator` from [EIP-6492](https://eips.ethereum.org/EIPS/eip-6492) with Solidity 0.8.28 and salt `0x0`.\n\nPlease note that onchain use cases are rare, but they do exist. For example, if you have a DEX that stores the user's orders in the form of signed messages that can be applied on-chain by anyone at any time, you may reason that sometimes an account that isn't deployed yet might want to submit such an order.\n\n### Porting the library to other languages (eg Golang, Rust)\nPorting can be done very easily because the library is now essentially just a single `eth_call`, thanks to the univeresal signature verifier being implemented in Solidity [here](https://github.com/AmbireTech/signature-validator/blob/main/contracts/EIP6492Full.sol).\n\n### Debugging utility / user interface\nTo test signatures in an easier manner, you can use the signature-validator UI here: https://sigtool.ambire.com/\n\n### Security\nA formal audit was done on the ERC-6492 reference implementation used here, and all remarks were resolved. You can find the audit [here](./ERC6492-Hunter-Security-Audit-Report-V1.0.pdf). This repo uses a [simplified variant of that reference implementation](./contracts/EIP6492.sol) that the audit also applies to (except all of the issues related to `prepare` which is not used here).\n\nFurthermore, you can self-audit the library quite easily as it's only ~80 lines of code (index.js).\n\n### Testing\n\n```\nnpm i --development\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAmbireTech%2Fsignature-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAmbireTech%2Fsignature-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAmbireTech%2Fsignature-validator/lists"}