0.10.0 • Published 4 years ago

@interrep/identity v0.10.0

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

The @interrep/identity package uses Semaphore identities by deriving parameters from a message signed with an Ethereum account. It is sufficient to pass the function to sign the message and the InterRep provider as parameters to obtain an identity to be used for the creation of the identity commitment and the zero-knowledge proofs.


🛠 Install

npm or yarn

Install the @interrep/semithid package with npm:

npm i @interrep/identity --save

or yarn:

yarn add @interrep/identity

📜 Usage

# identity(sign: (message: string) => Promise\<string>, provider: string, nonce?: number): ZKIdentity

import createIdentity from "@interrep/identity"
import { ZkIdentity } from "@libsem/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: ZkIdentity = await createIdentity((message) => signer.signMessage(message), "twitter")