Library providing privacy enhancing cryptographic primitives.
- Schnorr proof of knowledge protocol to prove knowledge of discrete log. This is a good reference.
- BBS and BBS+ signatures for anonymous credentials. BBS+ is based on the paper Anonymous Attestation Using the Strong Diffie Hellman Assumption Revisited and BBS is based on the paper Revisiting BBS Signatures. Also implements the threshold variants of these based on the paper Threshold BBS+ Signatures for Distributed Anonymous Credential Issuance
- Dynamic accumulators, both positive and universal. Based on the paper Dynamic Universal Accumulator with Batch Update over Bilinear Groups
- Composite proof system that combines above primitives for use cases like
- prove knowledge of a BBS+ signature and the corresponding messages
- prove knowledge of a modified PS signature and the corresponding messages
- equality of signed messages (from same or different signatures) in zero knowledge
- the (non)membership of a certain signed message(s)in the accumulator
- numeric bounds (min, max) on the messages can be proved in zero-knowledge
- verifiable encryption of signed messages under BBS+.
- zk-SNARK created from R1CS and WASM generated by Circom with witnesses as BBS+ signed messages (not exclusively though).
- Verifiable encryption using SAVER.
- Compression and amortization of Sigma protocols. This is PoC implementation.
- Secret sharing schemes and DKG. Implements verifiable secret sharing schemes and DKG from Gennaro and FROST.
- Cocount and PS signatures. Based on the paper Security Analysis of Coconut, an Attribute-Based Credential Scheme with Threshold Issuance
- LegoGroth16. LegoGroth16, the LegoSNARK variant of Groth16 zkSNARK proof system
- Oblivious Transfer (OT) and Oblivious Transfer Extensions (OTE).
The proof system that uses above-mentioned primitives.
cargo build
or cargo build --release
By default, it uses standard library and rayon for parallelization
To build with standard library but without parallelization, use cargo build --no-default-features --features=std
For no_std
support, build as cargo build --no-default-features --features=wasmer-sys
For WASM, build as cargo build --no-default-features --features=wasmer-js --target wasm32-unknown-unknown
cargo test
The above maybe slower as it runs the tests in debug mode and some tests work on large inputs.
For running tests faster, run cargo test --release
Some tests also print time consumed by the operations, run cargo test --release -- --nocapture [test name]
A WASM wrapper has been created over this repo here. The wrapper is then used to create this Typescript library which is more ergonomic than using the wrapper as the wrapper contains free floating functions.