@unirep/crypto
Client library for cryptography related functions which are used in UniRep protocol.
๐ Install
npm or yarn
Install the @unirep/crypto package with npm:
npm i @unirep/cryptoor yarn:
yarn add @unirep/crypto๐ Usage
ZkIdentity
Generate a random ZkIdentity
import { ZkIdentity } from '@unirep/crypto'
const identity = new ZkIdentity()Generate identity commitment
const commitment = identity.genIdentityCommitment()Get identity nullifier
const commitment = identity.identityNullifierget identity trapdoor
Serialize/ unserialize identity
IncrementalMerkleTree
Create an IncrementalMerkleTree
Get tree root
Insert leaf
Generate merkle proof
Verify merkle proof
SparseMerkleTree
Create a SparseMerkleTree
Get tree root
Update leaf
Generate merkle proof
Verify merkle proof
Crypto utils
genRandomSalt
hash5
hashOne
hashLeftRight
stringifyBigInts/unstringifyBigInts
Last updated
Was this helpful?