From a373b108e32810f5b6045793630180cc08ede264 Mon Sep 17 00:00:00 2001
From: Andrija Novakovic
Date: Wed, 20 Oct 2021 13:25:28 +0200
Subject: [PATCH] readme files
---
packages/identity/README.md | 74 ++++++++++++++++++++++++++
packages/identity/package.json | 2 +-
packages/protocols/README.md | 93 +++++++++++++++++++++++++++++++++
packages/protocols/package.json | 2 +-
4 files changed, 169 insertions(+), 2 deletions(-)
create mode 100644 packages/identity/README.md
create mode 100644 packages/protocols/README.md
diff --git a/packages/identity/README.md b/packages/identity/README.md
new file mode 100644
index 0000000..62054a1
--- /dev/null
+++ b/packages/identity/README.md
@@ -0,0 +1,74 @@
+
+
+ Semaphore identities
+
+ Library for managing identites for Semaphore and Rln protocols.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+---
+
+## 🛠Install
+
+### npm or yarn
+
+Install the `@libsem/identity` package with npm:
+
+```bash
+npm i @libsem/identity
+```
+
+or yarn:
+
+```bash
+yarn add @libsem/identity
+```
+
+## 📜 Usage
+
+**Import**
+
+```typescript
+import { ZkIdentity, Identity } from "@libsem/identity";
+
+```
+```javascript
+
+const { ZkIdentity } = require("@libsem/identity");
+
+```
+
+**Mainpulation**
+
+```typescript
+const identity: Identity = ZkIdentity.genIdentity();
+const identityCommitment: bigint = ZkIdentity.genIdentityCommitment(identity);
+```
+**Serialization**
+
+```typescript
+const identity: Identity = ZkIdentity.genIdentity();
+const serialized: string = ZkIdentity.serializeIdentity(identity);
+const unserialized: Identity = ZkIdentity.unSerializeIdentity(serialized);
+
+```
diff --git a/packages/identity/package.json b/packages/identity/package.json
index 123324d..501a4c8 100644
--- a/packages/identity/package.json
+++ b/packages/identity/package.json
@@ -1,6 +1,6 @@
{
"name": "@libsem/identity",
- "version": "1.0.8",
+ "version": "1.0.9",
"description": "Library for managing identites for Semaphore and Rln protocols",
"main": "dist/index.node.js",
"types": "dist/types/index.d.ts",
diff --git a/packages/protocols/README.md b/packages/protocols/README.md
new file mode 100644
index 0000000..ebf9bdc
--- /dev/null
+++ b/packages/protocols/README.md
@@ -0,0 +1,93 @@
+
+
+ Semaphore identities
+
+ Library for managing identites for Semaphore and Rln protocols.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+---
+
+## 🛠Install
+
+### npm or yarn
+
+Install the `@libsem/protocols` package with npm:
+
+```bash
+npm i @libsem/protocols
+```
+
+or yarn:
+
+```bash
+yarn add @libsem/protocols
+```
+
+## 📜 Usage
+
+**Import**
+
+```typescript
+import { ZkIdentity, Identity } from '@libsem/identity';
+import { Semaphore, MerkleProof, IProof, generateMerkleProof, genExternalNullifier, genSignalHash } from '@libsem/protocols';
+
+
+```
+```javascript
+
+const { ZkIdentity } = require('@libsem/identity');
+const { Semaphore, Rln, NRln, generateMerkleProof, genExternalNullifier, genSignalHash } = require('@libsem/protocols');
+```
+
+**Merkle Proofs**
+Generate merkle proof for your identity given the array of registered identity commitments
+
+```typescript
+const identityCommitments: Array = [...];
+const identityCommitment: bigint = ZkIdentity.genIdentityCommitment(identity);
+
+const merkleProof: MerkleProof = generateMerkleProof(TREE_DEPTH, ZERO_VALUE, NUMBER_OF_LEAVES_PER_NODE, identityCommitments, identityCommitment);
+```
+
+**Semaphore**
+
+In order to create semaphore proof, make sure to
+
+```typescript
+const witness = Semaphore.genWitness(identity, merkleProof, externalNullifier, signal);
+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
+
+For additional info check tests directory
diff --git a/packages/protocols/package.json b/packages/protocols/package.json
index eb9d8f0..7e9399a 100644
--- a/packages/protocols/package.json
+++ b/packages/protocols/package.json
@@ -1,6 +1,6 @@
{
"name": "@libsem/protocols",
- "version": "1.0.9",
+ "version": "1.0.10",
"description": "Client library for generating and verifying Semaphore & Rln ZK proofs",
"main": "dist/index.node.js",
"types": "dist/types/index.d.ts",