JSPM

  • Created
  • Published
  • Downloads 2517
  • Score
    100M100P100Q123792F
  • License MIT

A library for managing Semaphore identities.

Package Exports

  • @semaphore-protocol/identity

Readme

Semaphore identity

A library for managing Semaphore identities.

Github license NPM version Downloads npm bundle size (scoped) Linter eslint Code style prettier


🛠 Install

npm or yarn

Install the @semaphore-protocol/identity package with npm:

npm i @semaphore-protocol/identity

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