@webb-tools/semaphore-identity
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-3 • Public • Published

Semaphore identity

A library to create Semaphore identities.

Github license NPM version Downloads Linter eslint Code style prettier

This library provides a class that can be used to create identities compatible with the Semaphore circuits. Each identity contains two secret values: trapdoor and nullifier, and one public value: commitment. The Poseidon hash of the secret values is the identity secret, and its hash is the identity commitment.

🛠 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

# new Identity(identityOrMessage?: string): Identity

import { Identity } from "@semaphore-protocol/identity"

// The identity can be generated randomly.
const identity1 = new Identity(chainID)

// Deterministically from a secret message.
const identity2 = new Identity(chainID, "secret-message")

// Or it can be retrieved from an existing identity.
const identity3 = new Identity(chainID, identity1.toString())

// Trapdoor, nullifier and commitment are the attributes (e.g. JS getters).
const { trapdoor, nullifier, commitment } = identity1

Readme

Keywords

none

Package Sidebar

Install

npm i @webb-tools/semaphore-identity

Weekly Downloads

3

Version

0.0.1-3

License

GPL-3.0-or-later

Unpacked Size

26.7 kB

Total Files

15

Last publish

Collaborators

  • 1xstj
  • atelypham
  • salman01z
  • drewstone
  • shady-commonwealth
  • shekohex