@semaphore-protocol/proof 2.6.0 → 3.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -10
- package/dist/index.mjs +813 -31
- package/dist/index.node.js +811 -31
- package/dist/types/generateProof.d.ts +3 -2
- package/dist/types/hash.d.ts +7 -0
- package/dist/types/index.d.ts +1 -3
- package/dist/types/types/index.d.ts +7 -7
- package/dist/types/verifyProof.d.ts +2 -2
- package/package.json +6 -5
- package/src/generateProof.ts +9 -8
- package/src/hash.ts +15 -0
- package/src/index.test.ts +56 -36
- package/src/index.ts +1 -3
- package/src/types/index.ts +1 -1
- package/src/verificationKeys.json +712 -0
- package/src/verifyProof.ts +14 -3
- package/dist/types/generateNullifierHash.d.ts +0 -8
- package/dist/types/generateSignalHash.d.ts +0 -6
- package/src/generateNullifierHash.ts +0 -15
- package/src/generateSignalHash.ts +0 -16
package/README.md
CHANGED
|
@@ -67,37 +67,36 @@ yarn add @semaphore-protocol/identity @semaphore-protocol/group @semaphore-proto
|
|
|
67
67
|
|
|
68
68
|
## 📜 Usage
|
|
69
69
|
|
|
70
|
-
\# **generateProof**(identity: _Identity_, group: _Group_, externalNullifier: _BigNumberish_, signal: _string_, snarkArtifacts?: _SnarkArtifacts_): Promise\<_SemaphoreFullProof_>
|
|
70
|
+
\# **generateProof**(identity: _Identity_, group: _Group_ | _MerkleProof_, externalNullifier: _BigNumberish_, signal: _string_, snarkArtifacts?: _SnarkArtifacts_): Promise\<_SemaphoreFullProof_>
|
|
71
71
|
|
|
72
72
|
```typescript
|
|
73
73
|
import { Identity } from "@semaphore-protocol/identity"
|
|
74
74
|
import { Group } from "@semaphore-protocol/group"
|
|
75
75
|
import { generateProof } from "@semaphore-protocol/proof"
|
|
76
|
+
import { formatBytes32String } from "ethers/lib/utils"
|
|
76
77
|
|
|
77
78
|
const identity = new Identity()
|
|
78
79
|
const group = new Group()
|
|
79
|
-
const externalNullifier =
|
|
80
|
-
const signal = "Hello world"
|
|
80
|
+
const externalNullifier = 1
|
|
81
|
+
const signal = formatBytes32String("Hello world")
|
|
81
82
|
|
|
82
83
|
group.addMembers([...identityCommitments, identity.generateCommitment()])
|
|
83
84
|
|
|
84
|
-
const fullProof = await generateProof(identity,
|
|
85
|
+
const fullProof = await generateProof(identity, group, externalNullifier, signal, {
|
|
85
86
|
zkeyFilePath: "./semaphore.zkey",
|
|
86
87
|
wasmFilePath: "./semaphore.wasm"
|
|
87
88
|
})
|
|
88
89
|
|
|
89
|
-
// You can also use the default zkey/wasm files (only
|
|
90
|
-
// const fullProof = await generateProof(identity,
|
|
90
|
+
// You can also use the default zkey/wasm files (it only works from browsers!).
|
|
91
|
+
// const fullProof = await generateProof(identity, group, externalNullifier, signal)
|
|
91
92
|
```
|
|
92
93
|
|
|
93
|
-
\# **verifyProof**(
|
|
94
|
+
\# **verifyProof**(fullProof: _FullProof_, treeDepth: _number_): Promise\<_boolean_>
|
|
94
95
|
|
|
95
96
|
```typescript
|
|
96
97
|
import { verifyProof } from "@semaphore-protocol/proof"
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
await verifyProof(verificationKey, fullProof)
|
|
99
|
+
await verifyProof(fullProof, 20)
|
|
101
100
|
```
|
|
102
101
|
|
|
103
102
|
\# **packToSolidityProof**(proof: _Proof_): _SolidityProof_
|