1.0.27 • Published 3 years ago
@libsem/protocols v1.0.27
🛠 Install
npm or yarn
Install the @libsem/protocols
package with npm:
npm i @libsem/protocols
or yarn:
yarn add @libsem/protocols
📜 Usage
Import
import { ZkIdentity, Identity } from "@libsem/identity"
import {
Semaphore,
MerkleProof,
IProof,
generateMerkleProof,
genExternalNullifier,
genSignalHash
} from "@libsem/protocols"
const { ZkIdentity } = require("@libsem/identity")
const { Semaphore, Rln, NRln, generateMerkleProof, genExternalNullifier, genSignalHash } = require("@libsem/protocols")
Merkle Proofs Generate merkle proof for your identity given the array of registered identity commitments
const identityCommitments: Array<bigint> = [...];
const identity: ZkIdentity = new ZkIdentity();
const identityCommitment: bigint = identity.genIdentityCommitment();
const merkleProof: MerkleProof = generateMerkleProof(TREE_DEPTH, ZERO_VALUE, NUMBER_OF_LEAVES_PER_NODE, identityCommitments, identityCommitment);
Semaphore
In order to create semaphore proof, make sure to
const witness = Semaphore.genWitness(identity, merkleProof, externalNullifier, signal)
const fullProof = await Semaphore.genProof(witness, wasmFilePath, finalZkeyPath)
📜 Final Note
For full examples of how to integrate with contracts check https://github.com/appliedzkp/semaphore repository.
For additional info check tests directory.
1.0.26
3 years ago
1.0.27
3 years ago
1.0.25
4 years ago
1.0.24
4 years ago
1.0.23
4 years ago
1.0.22
4 years ago
1.0.19
4 years ago
1.0.18
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.21
4 years ago
1.0.20
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.0
4 years ago