Semaphore Identity Proof
A library to prove the ownership of a Semaphore identity without revealing the private key.
This zero-knowledge library allows you to prove and verify that you have the private key of a Semaphore identity. It will be mainly used on-chain because you can get the same result off-chain using EdDSA signatures with the @semaphore-protocol/identity package. It facilitates the demonstration of having an EdDSA hash pre-image while keeping the pre-image value confidential. Additionally, it offers a mechanism to prevent the same proof from being reused. The circuit that forms the foundation of this library is accessible via this link. |
---|
[!WARNING]
The Snark artifacts currently used to generate zero-knowledge proofs are the result of an insecure trusted setup, and the library has not yet been audited. Therefore, it is advised not to use it in production.
🛠 Install
Install the @semaphore-extensions/identity-proof
package:
npm i @semaphore-extensions/identity-proof
or yarn:
yarn add @semaphore-extensions/identity-proof
📜 Usage
import { generate, verify } from "@semaphore-extensions/identity-proof"
const privateKey = "secret"
const scope = "scope"
const fullProof = await generate(privateKey, scope)
console.log(fullProof)
const response = await verify(fullProof)
console.log(response)
📈 Benchmarks
Benchmarks were run on an Intel Core i7-1165G7, 16 GB RAM machine.
Generate proof | Verify proof | Constraints |
---|
258ms | 15ms | 1017 |
import { generate, verify } from "@semaphore-extensions/identity-proof"
console.time("generate")
const proof = await generate("secret", "scope")
console.timeEnd("generate")
console.time("verify")
console.log(await verify(proof))
console.timeEnd("verify")