@zk-kit/identity
v1.4.1
Published
Library for managing identities for Semaphore and RLN protocols.
Downloads
29
Readme
🛠 Install
npm or yarn
Install the @zk-kit/identity
package with npm:
npm i @zk-kit/identity
or yarn:
yarn add @zk-kit/identity
📜 Usage
Creating an identity with a random strategy:
import { ZkIdentity } from "@zk-kit/identity"
// const { ZkIdentity } = require("@zk-kit/identity") // with commonJS
const identity = new ZkIdentity()
const trapdoor = identity.getTrapdoor()
const nullifier = identity.getNullifier()
const secret = identity.getSecret()
const multipartSecret = identity.getMultipartSecret()
const identityCommitment = identity.genIdentityCommitment()
Creating an identity with a message strategy:
import { ZkIdentity, Strategy } from "@zk-kit/identity"
const identity = new ZkIdentity(Strategy.MESSAGE, "message")
Creating an identity with a serialized strategy:
import { ZkIdentity, Strategy } from "@zk-kit/identity"
const identity = new ZkIdentity()
const serializedIdentity = identity.serializeIdentity()
const identity2 = new ZkIdentity(Strategy.SERIALIZED, serializedIdentity)