@semaphore-protocol/proof 3.13.0 → 3.15.0
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/dist/index.node.js +11 -1836
- package/dist/index.node.mjs +11 -1816
- package/package.json +8 -18
- package/src/generateProof.ts +2 -2
- package/src/verifyProof.ts +5 -6
- package/dist/index.browser.mjs +0 -3440
- package/dist/types/groth16/prove.d.ts +0 -4
- package/dist/types/groth16/utils.d.ts +0 -1
- package/dist/types/groth16/verify.d.ts +0 -1
- package/dist/types/groth16/wtns-calculate.d.ts +0 -1
- package/dist/types/groth16/wtns-utils.d.ts +0 -6
- package/dist/types/groth16/zkey-utils.d.ts +0 -1
- package/src/groth16/prove.ts +0 -226
- package/src/groth16/utils.ts +0 -14
- package/src/groth16/verify.ts +0 -73
- package/src/groth16/wtns-calculate.ts +0 -39
- package/src/groth16/wtns-utils.ts +0 -32
- package/src/groth16/zkey-utils.ts +0 -60
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semaphore-protocol/proof",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"description": "A library to generate and verify Semaphore proofs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.node.js",
|
|
7
7
|
"exports": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"require": "./dist/index.node.js"
|
|
11
|
-
},
|
|
12
|
-
"browser": "./dist/index.browser.mjs",
|
|
13
|
-
"default": "./dist/index.browser.mjs"
|
|
8
|
+
"import": "./dist/index.node.mjs",
|
|
9
|
+
"require": "./dist/index.node.js"
|
|
14
10
|
},
|
|
15
11
|
"types": "dist/types/index.d.ts",
|
|
16
12
|
"files": [
|
|
@@ -26,21 +22,16 @@
|
|
|
26
22
|
},
|
|
27
23
|
"scripts": {
|
|
28
24
|
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
|
29
|
-
"build": "rimraf dist &&
|
|
30
|
-
"build:browser": "rollup -c rollup.browser.config.ts --configPlugin typescript",
|
|
31
|
-
"build:node": "rollup -c rollup.node.config.ts --configPlugin typescript",
|
|
25
|
+
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
|
32
26
|
"prepublishOnly": "yarn build"
|
|
33
27
|
},
|
|
34
28
|
"publishConfig": {
|
|
35
29
|
"access": "public"
|
|
36
30
|
},
|
|
37
31
|
"devDependencies": {
|
|
38
|
-
"@iden3/binfileutils": "0.0.11",
|
|
39
32
|
"@rollup/plugin-commonjs": "^24.1.0",
|
|
40
33
|
"@rollup/plugin-json": "^5.0.1",
|
|
41
34
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
42
|
-
"@rollup/plugin-virtual": "^3.0.2",
|
|
43
|
-
"fastfile": "0.0.20",
|
|
44
35
|
"poseidon-lite": "^0.2.0",
|
|
45
36
|
"rimraf": "^5.0.5",
|
|
46
37
|
"rollup": "^4.0.2",
|
|
@@ -48,16 +39,15 @@
|
|
|
48
39
|
"rollup-plugin-typescript2": "^0.31.2"
|
|
49
40
|
},
|
|
50
41
|
"peerDependencies": {
|
|
51
|
-
"@semaphore-protocol/group": "3.
|
|
52
|
-
"@semaphore-protocol/identity": "3.
|
|
42
|
+
"@semaphore-protocol/group": "3.15.0",
|
|
43
|
+
"@semaphore-protocol/identity": "3.15.0"
|
|
53
44
|
},
|
|
54
45
|
"dependencies": {
|
|
55
46
|
"@ethersproject/bignumber": "^5.5.0",
|
|
56
47
|
"@ethersproject/bytes": "^5.7.0",
|
|
57
48
|
"@ethersproject/keccak256": "^5.7.0",
|
|
58
49
|
"@ethersproject/strings": "^5.5.0",
|
|
59
|
-
"@zk-kit/
|
|
60
|
-
"
|
|
61
|
-
"ffjavascript": "0.2.60"
|
|
50
|
+
"@zk-kit/groth16": "0.1.0",
|
|
51
|
+
"@zk-kit/incremental-merkle-tree": "0.4.3"
|
|
62
52
|
}
|
|
63
53
|
}
|
package/src/generateProof.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { BigNumber } from "@ethersproject/bignumber"
|
|
|
2
2
|
import { BytesLike, Hexable } from "@ethersproject/bytes"
|
|
3
3
|
import { Group } from "@semaphore-protocol/group"
|
|
4
4
|
import type { Identity } from "@semaphore-protocol/identity"
|
|
5
|
+
import { prove } from "@zk-kit/groth16"
|
|
5
6
|
import { MerkleProof } from "@zk-kit/incremental-merkle-tree"
|
|
6
7
|
import type { NumericString } from "snarkjs"
|
|
7
8
|
import hash from "./hash"
|
|
8
9
|
import packProof from "./packProof"
|
|
9
10
|
import { SemaphoreProof, SnarkArtifacts } from "./types"
|
|
10
|
-
import groth16Prove from "./groth16/prove"
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Generates a Semaphore proof.
|
|
@@ -46,7 +46,7 @@ export default async function generateProof(
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const { proof, publicSignals } = await
|
|
49
|
+
const { proof, publicSignals } = await prove(
|
|
50
50
|
{
|
|
51
51
|
identityTrapdoor: trapdoor,
|
|
52
52
|
identityNullifier: nullifier,
|
package/src/verifyProof.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { verify } from "@zk-kit/groth16"
|
|
1
2
|
import hash from "./hash"
|
|
2
3
|
import { SemaphoreProof } from "./types"
|
|
3
4
|
import unpackProof from "./unpackProof"
|
|
4
5
|
import verificationKeys from "./verificationKeys.json"
|
|
5
|
-
import groth16Verify from "./groth16/verify"
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Verifies a Semaphore proof.
|
|
@@ -24,9 +24,8 @@ export default function verifyProof(
|
|
|
24
24
|
IC: verificationKeys.IC[treeDepth - 16]
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
27
|
+
return verify(verificationKey, {
|
|
28
|
+
publicSignals: [merkleTreeRoot, nullifierHash, hash(signal), hash(externalNullifier)],
|
|
29
|
+
proof: unpackProof(proof)
|
|
30
|
+
})
|
|
32
31
|
}
|