TypeScript implementation of core libraries for interacting with Ziden protocol, supports all functions for Holders, Issuers and Verifiers.
Live Documentation
<link>
Installation
npm i @zidendev/zidenjs
Test
npm run test-all
Generate Documentation
npm run gen-doc
Build
npm run build
Usages
Setup Parameters
Some functions of the library require cryptograhic operators that require time to setup. To optimize your application, you should call the setup function for them first as precomputation.
The keys created can be later used to construct your identity
In the following example, the private key is created randomly, you may want to utilize some key generation techniques to make it more secure and easier to manage.
import { auth, db, state } from'@zidendev/zidenjs';import { randomBytes } from'crypto';constprivateKey=randomBytes(32);constauth=awaitauth.newAuthFromPrivateKey(privateKey);// setup level DB to store treesconstauthDb=smt.SMTLevelDb('/path/to/your/authDb');constclaimDb=smt.SMTLevelDb('/path/to/your/claimDb');constclaimRevDb=smt.SMTLevelDb('/path/to/your/claimRevDb');constidentity=awaitstate.State.generateState([auth], authDb, claimDb, claimRevDb);