@semaphore-protocol/proof 4.0.0-beta.10 → 4.0.0-beta.11
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.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/proof
|
|
3
|
-
* @version 4.0.0-beta.
|
|
3
|
+
* @version 4.0.0-beta.11
|
|
4
4
|
* @file A library to generate and verify Semaphore proofs.
|
|
5
5
|
* @copyright Ethereum Foundation 2024
|
|
6
6
|
* @license MIT
|
|
@@ -10,7 +10,7 @@ import { packGroth16Proof, unpackGroth16Proof } from '@zk-kit/utils/proof-packin
|
|
|
10
10
|
export { packGroth16Proof, unpackGroth16Proof } from '@zk-kit/utils/proof-packing';
|
|
11
11
|
import { MIN_DEPTH, MAX_DEPTH } from '@semaphore-protocol/utils/constants';
|
|
12
12
|
import { requireDefined, requireObject, requireTypes, requireNumber, requireString, requireArray } from '@zk-kit/utils/error-handlers';
|
|
13
|
-
import {
|
|
13
|
+
import { maybeGetSnarkArtifacts, Project } from '@zk-kit/artifacts';
|
|
14
14
|
import { groth16 } from 'snarkjs';
|
|
15
15
|
import { keccak256 } from 'ethers/crypto';
|
|
16
16
|
import { toBeHex, toBigInt as toBigInt$1 } from 'ethers/utils';
|
|
@@ -101,7 +101,7 @@ async function generateProof(identity, groupOrMerkleProof, message, scope, merkl
|
|
|
101
101
|
merkleTreeDepth = merkleProofLength;
|
|
102
102
|
}
|
|
103
103
|
// If the Snark artifacts are not defined they will be automatically downloaded.
|
|
104
|
-
snarkArtifacts ?? (snarkArtifacts = await
|
|
104
|
+
snarkArtifacts ?? (snarkArtifacts = await maybeGetSnarkArtifacts(Project.SEMAPHORE, { parameters: [merkleTreeDepth] }));
|
|
105
105
|
const { wasm, zkey } = snarkArtifacts;
|
|
106
106
|
// The index must be converted to a list of indices, 1 for each tree level.
|
|
107
107
|
// The missing siblings can be set to 0, as they won't be used in the circuit.
|
package/dist/index.node.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/proof
|
|
3
|
-
* @version 4.0.0-beta.
|
|
3
|
+
* @version 4.0.0-beta.11
|
|
4
4
|
* @file A library to generate and verify Semaphore proofs.
|
|
5
5
|
* @copyright Ethereum Foundation 2024
|
|
6
6
|
* @license MIT
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
var proofPacking = require('@zk-kit/utils/proof-packing');
|
|
12
12
|
var constants = require('@semaphore-protocol/utils/constants');
|
|
13
13
|
var errorHandlers = require('@zk-kit/utils/error-handlers');
|
|
14
|
-
var
|
|
14
|
+
var artifacts = require('@zk-kit/artifacts');
|
|
15
15
|
var snarkjs = require('snarkjs');
|
|
16
16
|
var crypto = require('ethers/crypto');
|
|
17
17
|
var utils = require('ethers/utils');
|
|
@@ -102,7 +102,7 @@ async function generateProof(identity, groupOrMerkleProof, message, scope, merkl
|
|
|
102
102
|
merkleTreeDepth = merkleProofLength;
|
|
103
103
|
}
|
|
104
104
|
// If the Snark artifacts are not defined they will be automatically downloaded.
|
|
105
|
-
snarkArtifacts ?? (snarkArtifacts = await
|
|
105
|
+
snarkArtifacts ?? (snarkArtifacts = await artifacts.maybeGetSnarkArtifacts(artifacts.Project.SEMAPHORE, { parameters: [merkleTreeDepth] }));
|
|
106
106
|
const { wasm, zkey } = snarkArtifacts;
|
|
107
107
|
// The index must be converted to a list of indices, 1 for each tree level.
|
|
108
108
|
// The missing siblings can be set to 0, as they won't be used in the circuit.
|
package/dist/index.node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/proof
|
|
3
|
-
* @version 4.0.0-beta.
|
|
3
|
+
* @version 4.0.0-beta.11
|
|
4
4
|
* @file A library to generate and verify Semaphore proofs.
|
|
5
5
|
* @copyright Ethereum Foundation 2024
|
|
6
6
|
* @license MIT
|
|
@@ -10,7 +10,7 @@ import { packGroth16Proof, unpackGroth16Proof } from '@zk-kit/utils/proof-packin
|
|
|
10
10
|
export { packGroth16Proof, unpackGroth16Proof } from '@zk-kit/utils/proof-packing';
|
|
11
11
|
import { MIN_DEPTH, MAX_DEPTH } from '@semaphore-protocol/utils/constants';
|
|
12
12
|
import { requireDefined, requireObject, requireTypes, requireNumber, requireString, requireArray } from '@zk-kit/utils/error-handlers';
|
|
13
|
-
import {
|
|
13
|
+
import { maybeGetSnarkArtifacts, Project } from '@zk-kit/artifacts';
|
|
14
14
|
import { groth16 } from 'snarkjs';
|
|
15
15
|
import { keccak256 } from 'ethers/crypto';
|
|
16
16
|
import { toBeHex, toBigInt as toBigInt$1 } from 'ethers/utils';
|
|
@@ -101,7 +101,7 @@ async function generateProof(identity, groupOrMerkleProof, message, scope, merkl
|
|
|
101
101
|
merkleTreeDepth = merkleProofLength;
|
|
102
102
|
}
|
|
103
103
|
// If the Snark artifacts are not defined they will be automatically downloaded.
|
|
104
|
-
snarkArtifacts ?? (snarkArtifacts = await
|
|
104
|
+
snarkArtifacts ?? (snarkArtifacts = await maybeGetSnarkArtifacts(Project.SEMAPHORE, { parameters: [merkleTreeDepth] }));
|
|
105
105
|
const { wasm, zkey } = snarkArtifacts;
|
|
106
106
|
// The index must be converted to a list of indices, 1 for each tree level.
|
|
107
107
|
// The missing siblings can be set to 0, as they won't be used in the circuit.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Group, MerkleProof } from "@semaphore-protocol/group";
|
|
2
2
|
import type { Identity } from "@semaphore-protocol/identity";
|
|
3
|
-
import { type SnarkArtifacts } from "@zk-kit/
|
|
3
|
+
import { type SnarkArtifacts } from "@zk-kit/artifacts";
|
|
4
4
|
import type { BigNumberish } from "ethers";
|
|
5
5
|
import type { SemaphoreProof } from "./types";
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semaphore-protocol/proof",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.11",
|
|
4
4
|
"description": "A library to generate and verify Semaphore proofs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,12 +48,13 @@
|
|
|
48
48
|
"rollup-plugin-cleanup": "^3.2.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@semaphore-protocol/group": "4.0.0-beta.
|
|
52
|
-
"@semaphore-protocol/identity": "4.0.0-beta.
|
|
51
|
+
"@semaphore-protocol/group": "4.0.0-beta.11",
|
|
52
|
+
"@semaphore-protocol/identity": "4.0.0-beta.11"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@semaphore-protocol/utils": "4.0.0-beta.
|
|
56
|
-
"@zk-kit/
|
|
55
|
+
"@semaphore-protocol/utils": "4.0.0-beta.11",
|
|
56
|
+
"@zk-kit/artifacts": "^1.3.2",
|
|
57
|
+
"@zk-kit/utils": "1.0.0",
|
|
57
58
|
"ethers": "6.10.0",
|
|
58
59
|
"snarkjs": "0.7.4"
|
|
59
60
|
}
|
package/src/generate-proof.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Identity } from "@semaphore-protocol/identity"
|
|
|
3
3
|
import { MAX_DEPTH, MIN_DEPTH } from "@semaphore-protocol/utils/constants"
|
|
4
4
|
import { requireDefined, requireNumber, requireObject, requireTypes } from "@zk-kit/utils/error-handlers"
|
|
5
5
|
import { packGroth16Proof } from "@zk-kit/utils/proof-packing"
|
|
6
|
-
import {
|
|
6
|
+
import { maybeGetSnarkArtifacts, Project, type SnarkArtifacts } from "@zk-kit/artifacts"
|
|
7
7
|
import type { BigNumberish } from "ethers"
|
|
8
8
|
import { type NumericString, groth16 } from "snarkjs"
|
|
9
9
|
import hash from "./hash"
|
|
@@ -83,7 +83,7 @@ export default async function generateProof(
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// If the Snark artifacts are not defined they will be automatically downloaded.
|
|
86
|
-
snarkArtifacts ??= await
|
|
86
|
+
snarkArtifacts ??= await maybeGetSnarkArtifacts(Project.SEMAPHORE, { parameters: [merkleTreeDepth] })
|
|
87
87
|
const { wasm, zkey } = snarkArtifacts
|
|
88
88
|
|
|
89
89
|
// The index must be converted to a list of indices, 1 for each tree level.
|