@semaphore-protocol-mitonly/proof
v4.0.2
Published
drop-in replacement for @semaphore-protocol/proof
Maintainers
Readme
@semaphore-protocol-mitonly/proof
Semaphore proof generation and verification - drop-in replacement for @semaphore-protocol/proof.
This package provides only the proof functionality with cryptographic libraries (Rust + arkworks). For identity and group functionality, it uses the official @semaphore-protocol/identity and @semaphore-protocol/group packages.
Features
- Drop-in replacement - Same API as
@semaphore-protocol/proof - Full Groth16 support - ZK proof generation and verification using Rust WASM
Installation
npm install @semaphore-protocol-mitonly/proofUsage
import { Identity } from '@semaphore-protocol/identity';
import { Group } from '@semaphore-protocol/group';
import { generateProof, verifyProof } from '@semaphore-protocol-mitonly/proof';
// Create an identity
const identity = new Identity();
// Create a group and add members
const group = new Group([identity.commitment]);
// Generate a proof
const message = BigInt(42);
const scope = BigInt(1);
const proof = await generateProof(identity, group, message, scope);
// Verify the proof
const isValid = await verifyProof(proof);
console.log('Proof valid:', isValid);Artifacts
SNARK artifacts (WASM and zkey files) are automatically loaded using @zk-kit/artifacts when needed.
Architecture
This package uses Rust WASM for Groth16 proof generation and verification:
Project Structure
@semaphore-protocol-mitonly/proof/
├── rust/ # Rust source code (WASM for cryptography)
│ └── zkey.rs # ZKey parser + Groth16 prover
├── src/ # JavaScript API
│ └── index.js # Proof generation/verification
├── wasm/ # Built WASM module
├── Cargo.toml # Rust dependencies
└── build.sh # WASM build scriptBuilding from Source
Prerequisites
- Rust
- wasm-pack
# Install wasm-pack
cargo install wasm-pack
# Build WASM module
./build.shLicense
MIT
Credits & Source Attribution
This project is made possible by the following excellent open-source libraries:
Rust Libraries
- arkworks - Rust ZK cryptography ecosystem
- ark-groth16: Groth16 proving system
- ark-bn254: BN254 elliptic curve
- ark-circom - ZKey parsing approach
JavaScript Libraries
- @semaphore-protocol/identity - Identity management
- @semaphore-protocol/group - Group operations
- @zk-kit/artifacts - Artifact download utilities
- poseidon-lite - Poseidon hash function
- ethers - Ethereum utilities
