|
18 | 18 | <a href="https://npmjs.org/package/@semaphore-protocol/proof"> |
19 | 19 | <img alt="Downloads" src="https://img.shields.io/npm/dm/@semaphore-protocol/proof.svg?style=flat-square" /> |
20 | 20 | </a> |
| 21 | + <a href="https://js.semaphore.appliedzkp.org/proof"> |
| 22 | + <img alt="Documentation typedoc" src="https://img.shields.io/badge/docs-typedoc-744C7C?style=flat-square"> |
| 23 | + </a> |
21 | 24 | <a href="https://eslint.org/"> |
22 | 25 | <img alt="Linter eslint" src="https://img.shields.io/badge/linter-eslint-8080f2?style=flat-square&logo=eslint" /> |
23 | 26 | </a> |
@@ -67,7 +70,13 @@ yarn add @semaphore-protocol/identity @semaphore-protocol/group @semaphore-proto |
67 | 70 |
|
68 | 71 | ## 📜 Usage |
69 | 72 |
|
70 | | -\# **generateProof**(identity: _Identity_, group: _Group_ | _MerkleProof_, externalNullifier: _BigNumberish_, signal: _string_, snarkArtifacts?: _SnarkArtifacts_): Promise\<_SemaphoreFullProof_> |
| 73 | +\# **generateProof**( |
| 74 | +identity: _Identity_, |
| 75 | +group: _Group_ | _MerkleProof_, |
| 76 | +externalNullifier: _BytesLike | Hexable | number | bigint_, |
| 77 | +signal: _BytesLike | Hexable | number | bigint_, |
| 78 | +snarkArtifacts?: _SnarkArtifacts_ |
| 79 | +): Promise\<_SemaphoreFullProof_> |
71 | 80 |
|
72 | 81 | ```typescript |
73 | 82 | import { Identity } from "@semaphore-protocol/identity" |
@@ -98,3 +107,18 @@ import { verifyProof } from "@semaphore-protocol/proof" |
98 | 107 |
|
99 | 108 | await verifyProof(fullProof, 20) |
100 | 109 | ``` |
| 110 | + |
| 111 | +\# **calculateNullifierHash**( |
| 112 | +identityNullifier: _bigint | number | string_, |
| 113 | +externalNullifier: \__BytesLike | Hexable | number | bigint_ |
| 114 | +): bigint |
| 115 | + |
| 116 | +```typescript |
| 117 | +import { Identity } from "@semaphore-protocol/identity" |
| 118 | +import { calculateNullifierHash } from "@semaphore-protocol/proof" |
| 119 | + |
| 120 | +const identity = new Identity() |
| 121 | +const externalNullifier = utils.formatBytes32String("Topic") |
| 122 | + |
| 123 | +const nullifierHash = calculateNullifierHash(identity.nullifier, externalNullifier) |
| 124 | +``` |
0 commit comments