@zk-kit/protocols
TypeScript icon, indicating that this package has built-in type declarations

1.11.1 • Public • Published

ZK protocols

Client library for generating and verifying Semaphore & RLN ZK proofs.

Github license NPM version Downloads Linter eslint Code style prettier


🛠 Install

npm or yarn

Install the @zk-kit/protocols package with npm:

npm i @zk-kit/protocols

or yarn:

yarn add @zk-kit/protocols

📜 Usage

Generating Merkle proofs

import { ZkIdentity } from "@zk-kit/identity"
import { generateMerkleProof } from "@zk-kit/protocols"

const depth = 20
const zeroValue = BigInt(0)
const identity = new ZkIdentity()
const identityCommitment = identity.genIdentityCommitment()
const identityCommitments = [BigInt(1), identityCommitment, BigInt(2)]

const merkleProof = generateMerkleProof(depth, zeroValue, identityCommitments, 1)

Creating Semaphore proofs

import { Semaphore } from "@zk-kit/protocols"

const signal = "Hello world"
const externalNullifier = BigInt(1)
const witness = Semaphore.genWitness(identity, merkleProof, externalNullifier, signal)

const { proof, publicSignals } = await Semaphore.genProof(witness, "./semaphore.wasm", "./semaphore.zkey")
const solidityProof = Semaphore.packToSolidityProof(proof)

Readme

Keywords

none

Package Sidebar

Install

npm i @zk-kit/protocols

Weekly Downloads

11

Version

1.11.1

License

MIT

Unpacked Size

55.4 kB

Total Files

15

Last publish

Collaborators

  • sripwoud
  • njofce
  • akinovak
  • cedoor