update readme

Former-commit-id: f673bbe1c0c1be9afc770857e88fe89705a06140 [formerly 16c047fb14]
Former-commit-id: 566073adcf6f2e42401732ad11312132246d04d3
This commit is contained in:
Andrija Novakovic
2021-10-22 22:13:48 +02:00
parent e70704fba1
commit 94dad4e5a8
4 changed files with 9 additions and 16 deletions

View File

@@ -59,14 +59,14 @@ const { ZkIdentity } = require("@libsem/identity")
**Mainpulation**
```typescript
const identity: Identity = ZkIdentity.genIdentity()
const identityCommitment: bigint = ZkIdentity.genIdentityCommitment(identity)
const identity: ZkIdentity = new ZkIdentity();
const identityCommitment: bigint = identity.genIdentityCommitment();
```
**Serialization**
```typescript
const identity: Identity = ZkIdentity.genIdentity()
const serialized: string = ZkIdentity.serializeIdentity(identity)
const unserialized: Identity = ZkIdentity.unSerializeIdentity(serialized)
const identity: ZkIdentity = new ZkIdentity();
const serialized: string = identity.serializeIdentity()
const unserialized: ZkIdentity = ZkIdentity.genFromSerialized(serialized);
```

View File

@@ -1,6 +1,6 @@
{
"name": "@libsem/identity",
"version": "1.0.12",
"version": "1.0.13",
"description": "Library for managing identites for Semaphore and Rln protocols.",
"main": "dist/index.node.js",
"types": "dist/types/index.d.ts",

View File

@@ -70,7 +70,8 @@ Generate merkle proof for your identity given the array of registered identity c
```typescript
const identityCommitments: Array<bigint> = [...];
const identityCommitment: bigint = ZkIdentity.genIdentityCommitment(identity);
const identity: ZkIdentity = new ZkIdentity();
const identityCommitment: bigint = identity.genIdentityCommitment();
const merkleProof: MerkleProof = generateMerkleProof(TREE_DEPTH, ZERO_VALUE, NUMBER_OF_LEAVES_PER_NODE, identityCommitments, identityCommitment);
```
@@ -84,14 +85,6 @@ const witness = Semaphore.genWitness(identity, merkleProof, externalNullifier, s
const fullProof = await Semaphore.genProof(witness, wasmFilePath, finalZkeyPath)
```
**Serialization**
```typescript
const identity: Identity = ZkIdentity.genIdentity()
const serialized: string = ZkIdentity.serializeIdentity(identity)
const unserialized: Identity = ZkIdentity.unSerializeIdentity(serialized)
```
## 📜 Final Note
For full examples of how to integrate with contracts check https://github.com/appliedzkp/semaphore repository.

View File

@@ -1,6 +1,6 @@
{
"name": "@libsem/protocols",
"version": "1.0.13",
"version": "1.0.14",
"description": "Client library for generating and verifying Semaphore & Rln ZK proofs.",
"main": "dist/index.node.js",
"types": "dist/types/index.d.ts",