1.4.1 • Published 2 years ago

@zk-kit/identity v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🛠 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)