@semaphore-protocol/group 3.1.0 → 3.2.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/README.md +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.node.js +3 -7
- package/package.json +43 -43
- package/src/group.ts +2 -2
- package/src/types/index.ts +1 -1
package/README.md
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/group
|
|
3
|
-
* @version 3.
|
|
3
|
+
* @version 3.2.0
|
|
4
4
|
* @file A library to create and manage Semaphore groups.
|
|
5
5
|
* @copyright Ethereum Foundation 2022
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/group}
|
|
8
8
|
*/
|
|
9
9
|
import { IncrementalMerkleTree } from '@zk-kit/incremental-merkle-tree';
|
|
10
|
-
import
|
|
10
|
+
import { poseidon2 } from 'poseidon-lite/poseidon2';
|
|
11
11
|
import { BigNumber } from '@ethersproject/bignumber';
|
|
12
12
|
import { zeroPad } from '@ethersproject/bytes';
|
|
13
13
|
import { keccak256 } from '@ethersproject/keccak256';
|
|
@@ -35,7 +35,7 @@ var Group = /** @class */ (function () {
|
|
|
35
35
|
throw new Error("The tree depth must be between 16 and 32");
|
|
36
36
|
}
|
|
37
37
|
this._id = id;
|
|
38
|
-
this.merkleTree = new IncrementalMerkleTree(
|
|
38
|
+
this.merkleTree = new IncrementalMerkleTree(poseidon2, treeDepth, hash(id), 2);
|
|
39
39
|
}
|
|
40
40
|
Object.defineProperty(Group.prototype, "id", {
|
|
41
41
|
/**
|
package/dist/index.node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/group
|
|
3
|
-
* @version 3.
|
|
3
|
+
* @version 3.2.0
|
|
4
4
|
* @file A library to create and manage Semaphore groups.
|
|
5
5
|
* @copyright Ethereum Foundation 2022
|
|
6
6
|
* @license MIT
|
|
@@ -11,15 +11,11 @@
|
|
|
11
11
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
|
|
13
13
|
var incrementalMerkleTree = require('@zk-kit/incremental-merkle-tree');
|
|
14
|
-
var
|
|
14
|
+
var poseidon2 = require('poseidon-lite/poseidon2');
|
|
15
15
|
var bignumber = require('@ethersproject/bignumber');
|
|
16
16
|
var bytes = require('@ethersproject/bytes');
|
|
17
17
|
var keccak256 = require('@ethersproject/keccak256');
|
|
18
18
|
|
|
19
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
-
|
|
21
|
-
var poseidon__default = /*#__PURE__*/_interopDefaultLegacy(poseidon);
|
|
22
|
-
|
|
23
19
|
/**
|
|
24
20
|
* Creates a keccak256 hash of a message compatible with the SNARK scalar modulus.
|
|
25
21
|
* @param message The message to be hashed.
|
|
@@ -43,7 +39,7 @@ var Group = /** @class */ (function () {
|
|
|
43
39
|
throw new Error("The tree depth must be between 16 and 32");
|
|
44
40
|
}
|
|
45
41
|
this._id = id;
|
|
46
|
-
this.merkleTree = new incrementalMerkleTree.IncrementalMerkleTree(
|
|
42
|
+
this.merkleTree = new incrementalMerkleTree.IncrementalMerkleTree(poseidon2.poseidon2, treeDepth, hash(id), 2);
|
|
47
43
|
}
|
|
48
44
|
Object.defineProperty(Group.prototype, "id", {
|
|
49
45
|
/**
|
package/package.json
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
2
|
+
"name": "@semaphore-protocol/group",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "A library to create and manage Semaphore groups.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.node.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
"import": "./dist/index.mjs",
|
|
9
|
+
"require": "./dist/index.node.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "dist/types/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/",
|
|
14
|
+
"src/",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"repository": "https://github.com/semaphore-protocol/semaphore",
|
|
19
|
+
"homepage": "https://github.com/semaphore-protocol/semaphore/tree/main/packages/group",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/semaphore-protocol/semaphore.git/issues"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
|
25
|
+
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
|
26
|
+
"prepublishOnly": "yarn build",
|
|
27
|
+
"docs": "typedoc src/index.ts --out ../../docs/group"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
34
|
+
"rollup-plugin-typescript2": "^0.31.2",
|
|
35
|
+
"typedoc": "^0.22.11"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@ethersproject/bignumber": "^5.7.0",
|
|
39
|
+
"@ethersproject/bytes": "^5.7.0",
|
|
40
|
+
"@ethersproject/keccak256": "^5.7.0",
|
|
41
|
+
"@zk-kit/incremental-merkle-tree": "1.0.0",
|
|
42
|
+
"poseidon-lite": "^0.1.0"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/group.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IncrementalMerkleTree, MerkleProof } from "@zk-kit/incremental-merkle-tree"
|
|
2
|
-
import
|
|
2
|
+
import { poseidon2 } from "poseidon-lite/poseidon2"
|
|
3
3
|
import hash from "./hash"
|
|
4
4
|
import { BigNumberish } from "./types"
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ export default class Group {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
this._id = id
|
|
22
|
-
this.merkleTree = new IncrementalMerkleTree(
|
|
22
|
+
this.merkleTree = new IncrementalMerkleTree(poseidon2, treeDepth, hash(id), 2)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
package/src/types/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type BigNumberish = string | number | bigint
|
|
1
|
+
export type BigNumberish = string | number | bigint
|