| Semaphore is a generic privacy layer. Leveraging zero-knowledge technology, users can prove their membership in groups and send messages (extending from votes to endorsements) off-chain or across EVM-compatible blockchains, all without revealing their personal identity. |
|---|
Semaphore Rust board
All tasks related to the Semaphore Rust implementation are public. You can track their progress, statuses, and additional details in the Semaphore Rust view.
Semaphore Rust Package
🛠Install
Add this to your Cargo.toml:
[]
= "0.1"
📜 Usage
Semaphore Identity
- Generate a semaphore identity from a string
use Identity; let identity = new; - Get the identity commitment
identity.commitment - Get the identity private key
identity.private_key
Semaphore Group
-
Generate a group member from an identity
use to_element; let member = to_element -
Generate a semaphore group from members
use ; const MEMBER1: Element = ; const MEMBER2: Element = ; let group = new.unwrap; -
Get the group root
let root = group.root;
Semaphore Proof
-
Generate a semaphore proof
use GroupOrMerkleProof; use Proof; let message = "message"; let scope = "scope"; let tree_depth = 20; let proof = generate_proof .unwrap; -
Verify a semaphore proof
let valid = verify_proof;
Serde
-
Please enable the feature in the
Cargo.toml= { = "0.1", = ["serde"] } -
Serialize a semaphore proof
let proof_json = proof.export.unwrap; -
Deserialize a semaphore proof
use SemaphoreProof; let proof_imported = import.unwrap;
Development
🛠Install
Clone this repository:
📜 Usage
Code quality and formatting
Run Rustfmt to automatically format the code
Run rust-clippy to catch common mistakes and improve your Rust code.
Testing
Update witness_graph with circom-witnesscalc