@semaphore-protocol/group 4.0.0-beta.8 → 4.0.0-beta.9

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/group
3
- * @version 4.0.0-beta.8
3
+ * @version 4.0.0-beta.9
4
4
  * @file A library to create and manage Semaphore groups.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
@@ -129,6 +129,11 @@ class Group {
129
129
  * @param members A list of identity commitments.
130
130
  */
131
131
  constructor(members = []) {
132
+ for (const member of members) {
133
+ if (member === 0n || member === "0") {
134
+ throw new Error("Failed to add member: value cannot be 0");
135
+ }
136
+ }
132
137
  this.leanIMT = new imt.LeanIMT((a, b) => poseidon2_2([a, b]), members.map(BigInt));
133
138
  }
134
139
  /**
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/group
3
- * @version 4.0.0-beta.8
3
+ * @version 4.0.0-beta.9
4
4
  * @file A library to create and manage Semaphore groups.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
@@ -127,6 +127,11 @@ class Group {
127
127
  * @param members A list of identity commitments.
128
128
  */
129
129
  constructor(members = []) {
130
+ for (const member of members) {
131
+ if (member === 0n || member === "0") {
132
+ throw new Error("Failed to add member: value cannot be 0");
133
+ }
134
+ }
130
135
  this.leanIMT = new LeanIMT((a, b) => poseidon2_2([a, b]), members.map(BigInt));
131
136
  }
132
137
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semaphore-protocol/group",
3
- "version": "4.0.0-beta.8",
3
+ "version": "4.0.0-beta.9",
4
4
  "description": "A library to create and manage Semaphore groups.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -23,6 +23,12 @@ export class Group {
23
23
  * @param members A list of identity commitments.
24
24
  */
25
25
  constructor(members: BigNumber[] = []) {
26
+ for (const member of members) {
27
+ if (member === 0n || member === "0") {
28
+ throw new Error("Failed to add member: value cannot be 0")
29
+ }
30
+ }
31
+
26
32
  this.leanIMT = new LeanIMT((a, b) => poseidon2([a, b]), members.map(BigInt))
27
33
  }
28
34