@interep/identity
v0.3.0
Published
A simple JS function to create Semaphore identities.
Downloads
4
Readme
The @interep/identity
package allows you to create Semaphore identities by deriving them from a message signed with an Ethereum account. The identity can be used to generate identity commitments and other parameters needed to create zero-knowledge proofs with Semaphore.
🛠 Install
npm or yarn
Install the @interep/semithid
package with npm:
npm i @interep/identity --save
or yarn:
yarn add @interep/identity
📜 Usage
# createIdentity(sign: (message: string) => Promise<string>, provider: string, nonce?: number): ZKIdentity
import createIdentity from "@interep/identity"
import detectEthereumProvider from "@metamask/detect-provider"
import { ethers } from "ethers"
const ethereumProvider = (await detectEthereumProvider()) as any
const provider = new ethers.providers.Web3Provider(ethereumProvider)
const signer = provider.getSigner()
const identity = await createIdentity((message) => signer.signMessage(message), "Twitter")