1.0.27 • Published 2 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
2 years ago
1.0.27
2 years ago
1.0.25
2 years ago
1.0.24
2 years ago
1.0.23
2 years ago
1.0.22
3 years ago
1.0.19
3 years ago
1.0.18
3 years ago
1.0.17
3 years ago
1.0.16
3 years ago
1.0.21
3 years ago
1.0.20
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.0
3 years ago