@semaphore-protocol/proof 3.15.1 → 4.0.0-alpha
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/LICENSE +1 -1
- package/README.md +18 -28
- package/dist/index.browser.mjs +800 -0
- package/dist/index.node.js +272 -1065
- package/dist/index.node.mjs +270 -1065
- package/dist/types/generate-proof.d.ts +15 -0
- package/dist/types/get-snark-artifacts.browser.d.ts +2 -0
- package/dist/types/get-snark-artifacts.node.d.ts +2 -0
- package/dist/types/hash.d.ts +1 -1
- package/dist/types/index.d.ts +6 -5
- package/dist/types/{packProof.d.ts → pack-proof.d.ts} +1 -1
- package/dist/types/types/index.d.ts +6 -4
- package/dist/types/{unpackProof.d.ts → unpack-proof.d.ts} +1 -1
- package/dist/types/verify-proof.d.ts +8 -0
- package/package.json +20 -13
- package/src/generate-proof.ts +81 -0
- package/src/get-snark-artifacts.browser.ts +9 -0
- package/src/get-snark-artifacts.node.ts +24 -0
- package/src/hash.ts +1 -1
- package/src/index.ts +6 -5
- package/src/{packProof.ts → pack-proof.ts} +1 -1
- package/src/types/index.ts +7 -4
- package/src/{unpackProof.ts → unpack-proof.ts} +1 -1
- package/src/verification-keys.json +522 -0
- package/src/verify-proof.ts +36 -0
- package/dist/types/calculateNullifierHash.d.ts +0 -8
- package/dist/types/generateProof.d.ts +0 -15
- package/dist/types/index.test.d.ts +0 -1
- package/dist/types/verifyProof.d.ts +0 -8
- package/src/calculateNullifierHash.ts +0 -16
- package/src/generateProof.ts +0 -69
- package/src/index.test.ts +0 -147
- package/src/verificationKeys.json +0 -712
- package/src/verifyProof.ts +0 -31
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -72,9 +72,10 @@ yarn add @semaphore-protocol/identity @semaphore-protocol/group @semaphore-proto
|
|
|
72
72
|
|
|
73
73
|
\# **generateProof**(
|
|
74
74
|
identity: _Identity_,
|
|
75
|
-
group: _Group_
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
group: _Group_,
|
|
76
|
+
message: _BytesLike | Hexable | number | bigint_,
|
|
77
|
+
scope: _BytesLike | Hexable | number | bigint_,
|
|
78
|
+
merkleTreeDepth: _number_,
|
|
78
79
|
snarkArtifacts?: _SnarkArtifacts_
|
|
79
80
|
): Promise\<_SemaphoreProof_>
|
|
80
81
|
|
|
@@ -86,39 +87,28 @@ import { utils } from "ethers"
|
|
|
86
87
|
|
|
87
88
|
const identity = new Identity()
|
|
88
89
|
const group = new Group()
|
|
89
|
-
const externalNullifier = utils.formatBytes32String("Topic")
|
|
90
|
-
const signal = utils.formatBytes32String("Hello world")
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const fullProof = await generateProof(identity, group, externalNullifier, signal, {
|
|
95
|
-
zkeyFilePath: "./semaphore.zkey",
|
|
96
|
-
wasmFilePath: "./semaphore.wasm"
|
|
97
|
-
})
|
|
91
|
+
const scope = utils.formatBytes32String("Topic")
|
|
92
|
+
const message = utils.formatBytes32String("Hello world")
|
|
98
93
|
|
|
99
|
-
|
|
100
|
-
// const fullProof = await generateProof(identity, group, externalNullifier, signal)
|
|
101
|
-
```
|
|
94
|
+
group.addMembers([...identityCommitments, identity.generateCommitment()])
|
|
102
95
|
|
|
103
|
-
|
|
96
|
+
const fullProof1 = await generateProof(identity, group, message, scope)
|
|
104
97
|
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
// You can also specify the maximum tree depth supported by the proof.
|
|
99
|
+
const fullProof2 = await generateProof(identity, group, message, scope, 20)
|
|
107
100
|
|
|
108
|
-
|
|
101
|
+
// You can also specify the default zkey/wasm files.
|
|
102
|
+
const fullProof3 = await generateProof(identity, group, message, scope, 20, {
|
|
103
|
+
wasmFilePath: "./semaphore.wasm",
|
|
104
|
+
zkeyFilePath: "./semaphore.zkey"
|
|
105
|
+
})
|
|
109
106
|
```
|
|
110
107
|
|
|
111
|
-
\# **
|
|
112
|
-
identityNullifier: _bigint | number | string_,
|
|
113
|
-
externalNullifier: \__BytesLike | Hexable | number | bigint_
|
|
114
|
-
): bigint
|
|
108
|
+
\# **verifyProof**(semaphoreProof: _SemaphoreProof_): Promise\<_boolean_>
|
|
115
109
|
|
|
116
110
|
```typescript
|
|
117
|
-
import {
|
|
118
|
-
import { calculateNullifierHash } from "@semaphore-protocol/proof"
|
|
119
|
-
|
|
120
|
-
const identity = new Identity()
|
|
121
|
-
const externalNullifier = utils.formatBytes32String("Topic")
|
|
111
|
+
import { verifyProof } from "@semaphore-protocol/proof"
|
|
122
112
|
|
|
123
|
-
|
|
113
|
+
await verifyProof(fullProof)
|
|
124
114
|
```
|