Package Exports
- @semaphore-protocol/identity
Readme
Semaphore identity
A library for managing Semaphore identities.
🛠 Install
npm or yarn
Install the @semaphore-protocol/identity package with npm:
npm i @semaphore-protocol/identityor yarn:
yarn add @semaphore-protocol/identity📜 Usage
Creating an identity with a random strategy:
import { Identity } from "@semaphore-protocol/identity"
// const { Identity } = require("@semaphore-protocol/identity") // with commonJS
const identity = new Identity()
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 { Identity, Strategy } from "@semaphore-protocol/identity"
const identity = new Identity(Strategy.MESSAGE, "message")Creating an identity with a serialized strategy:
import { Identity, Strategy } from "@semaphore-protocol/identity"
const identity = new Identity()
const serializedIdentity = identity.serializeIdentity()
const identity2 = new Identity(Strategy.SERIALIZED, serializedIdentity)