@waku/rln 0.1.5-cad3e7a.0 → 0.1.5-f39d215.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.
Files changed (36) hide show
  1. package/bundle/_virtual/utils.js +2 -2
  2. package/bundle/_virtual/utils2.js +2 -2
  3. package/bundle/packages/rln/dist/contract/rln_contract.js +2 -2
  4. package/bundle/packages/rln/dist/contract/rln_light_contract.js +2 -2
  5. package/bundle/packages/rln/dist/identity.js +7 -7
  6. package/bundle/packages/rln/dist/keystore/keystore.js +8 -8
  7. package/bundle/packages/rln/dist/rln.js +1 -1
  8. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
  9. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
  10. package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +1 -1
  11. package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +1 -1
  12. package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +1 -1
  13. package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +1 -1
  14. package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +1 -1
  15. package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +1 -1
  16. package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +1 -1
  17. package/dist/.tsbuildinfo +1 -1
  18. package/dist/contract/rln_contract.js +2 -2
  19. package/dist/contract/rln_contract.js.map +1 -1
  20. package/dist/contract/rln_light_contract.js +2 -2
  21. package/dist/contract/rln_light_contract.js.map +1 -1
  22. package/dist/identity.d.ts +1 -1
  23. package/dist/identity.js +7 -7
  24. package/dist/identity.js.map +1 -1
  25. package/dist/keystore/keystore.js +8 -8
  26. package/dist/keystore/keystore.js.map +1 -1
  27. package/dist/keystore/types.d.ts +1 -1
  28. package/dist/rln.js +1 -1
  29. package/dist/rln.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/contract/rln_contract.ts +2 -2
  32. package/src/contract/rln_light_contract.ts +2 -2
  33. package/src/identity.ts +8 -8
  34. package/src/keystore/keystore.ts +9 -9
  35. package/src/keystore/types.ts +1 -1
  36. package/src/rln.ts +1 -1
@@ -1,3 +1,3 @@
1
- var utils = {};
1
+ var utils = {exports: {}};
2
2
 
3
- export { utils as __exports };
3
+ export { utils as __module };
@@ -1,3 +1,3 @@
1
- var utils = {exports: {}};
1
+ var utils = {};
2
2
 
3
- export { utils as __module };
3
+ export { utils as __exports };
@@ -305,7 +305,7 @@ class RLNContract {
305
305
  identity,
306
306
  membership: {
307
307
  address,
308
- treeIndex: `0x${membershipId}`,
308
+ treeIndex: parseInt(membershipId),
309
309
  chainId: network.chainId.toString(),
310
310
  rateLimit: decodedData.membershipRateLimit.toNumber()
311
311
  }
@@ -385,7 +385,7 @@ class RLNContract {
385
385
  identity,
386
386
  membership: {
387
387
  address,
388
- treeIndex: `0x${membershipId}`,
388
+ treeIndex: parseInt(membershipId),
389
389
  chainId: network.chainId.toString(),
390
390
  rateLimit: decodedData.membershipRateLimit.toNumber()
391
391
  }
@@ -258,7 +258,7 @@ class RLNLightContract {
258
258
  identity,
259
259
  membership: {
260
260
  address,
261
- treeIndex: `0x${membershipId}`,
261
+ treeIndex: parseInt(membershipId),
262
262
  chainId: network.chainId.toString(),
263
263
  rateLimit: decodedData.membershipRateLimit.toNumber()
264
264
  }
@@ -340,7 +340,7 @@ class RLNLightContract {
340
340
  identity,
341
341
  membership: {
342
342
  address,
343
- treeIndex: `0x${membershipId}`,
343
+ treeIndex: parseInt(membershipId),
344
344
  chainId: network.chainId.toString(),
345
345
  rateLimit: decodedData.membershipRateLimit.toNumber()
346
346
  }
@@ -26,13 +26,13 @@ class IdentityCredential {
26
26
  return new IdentityCredential(idTrapdoor, idNullifier, idSecretHash, idCommitment, idCommitmentBigInt);
27
27
  }
28
28
  toJSON() {
29
- return [
30
- Array.from(this.IDTrapdoor),
31
- Array.from(this.IDNullifier),
32
- Array.from(this.IDSecretHash),
33
- Array.from(this.IDCommitment),
34
- this.IDCommitmentBigInt.toString()
35
- ];
29
+ return {
30
+ idTrapdoor: Array.from(this.IDTrapdoor),
31
+ idNullifier: Array.from(this.IDNullifier),
32
+ idSecretHash: Array.from(this.IDSecretHash),
33
+ idCommitment: Array.from(this.IDCommitment),
34
+ idCommitmentBigInt: this.IDCommitmentBigInt.toString()
35
+ };
36
36
  }
37
37
  }
38
38
 
@@ -165,8 +165,8 @@ class Keystore {
165
165
  try {
166
166
  const str = bytesToUtf8(bytes);
167
167
  const obj = JSON.parse(str);
168
- // Get identity arrays
169
- const [idTrapdoor, idNullifier, idSecretHash, idCommitment] = _.get(obj, "identityCredential", []);
168
+ // Get identity fields from named object
169
+ const { idTrapdoor, idNullifier, idSecretHash, idCommitment } = _.get(obj, "identityCredential", {});
170
170
  const idTrapdoorArray = new Uint8Array(idTrapdoor || []);
171
171
  const idNullifierArray = new Uint8Array(idNullifier || []);
172
172
  const idSecretHashArray = new Uint8Array(idSecretHash || []);
@@ -197,12 +197,12 @@ class Keystore {
197
197
  static fromIdentityToBytes(options) {
198
198
  return utf8ToBytes(JSON.stringify({
199
199
  treeIndex: options.membership.treeIndex,
200
- identityCredential: [
201
- Array.from(options.identity.IDTrapdoor),
202
- Array.from(options.identity.IDNullifier),
203
- Array.from(options.identity.IDSecretHash),
204
- Array.from(options.identity.IDCommitment)
205
- ],
200
+ identityCredential: {
201
+ idTrapdoor: Array.from(options.identity.IDTrapdoor),
202
+ idNullifier: Array.from(options.identity.IDNullifier),
203
+ idSecretHash: Array.from(options.identity.IDSecretHash),
204
+ idCommitment: Array.from(options.identity.IDCommitment)
205
+ },
206
206
  membershipContract: {
207
207
  chainId: options.membership.chainId,
208
208
  address: options.membership.address
@@ -189,7 +189,7 @@ class RLNInstance {
189
189
  return createRLNEncoder({
190
190
  encoder: createEncoder(options),
191
191
  rlnInstance: this,
192
- index: parseInt(credentials.membership.treeIndex),
192
+ index: credentials.membership.treeIndex,
193
193
  credential: credentials.identity
194
194
  });
195
195
  }
@@ -1,6 +1,6 @@
1
1
  import { __exports as random } from '../../../../../../../_virtual/random.js';
2
2
  import '../../../../@noble/hashes/utils.js';
3
- import { __exports as utils } from '../../../../../../../_virtual/utils.js';
3
+ import { __exports as utils } from '../../../../../../../_virtual/utils2.js';
4
4
 
5
5
  Object.defineProperty(random, "__esModule", { value: true });
6
6
  random.getRandomBytes = random.getRandomBytesSync = void 0;
@@ -1,10 +1,10 @@
1
1
  import { commonjsGlobal } from '../../../../../../../_virtual/_commonjsHelpers.js';
2
2
  import { commonjsRequire } from '../../../../../../../_virtual/_commonjs-dynamic-modules.js';
3
- import { __module as utils } from '../../../../../../../_virtual/utils2.js';
3
+ import { __module as utils } from '../../../../../../../_virtual/utils.js';
4
4
  import '../../../../@noble/hashes/_assert.js';
5
5
  import '../../../../@noble/hashes/utils.js';
6
6
  import { __exports as _assert } from '../../../../../../../_virtual/_assert.js';
7
- import { __exports as utils$1 } from '../../../../../../../_virtual/utils.js';
7
+ import { __exports as utils$1 } from '../../../../../../../_virtual/utils2.js';
8
8
 
9
9
  utils.exports;
10
10
 
@@ -1,7 +1,7 @@
1
1
  import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
2
2
  import './_assert.js';
3
3
  import './utils.js';
4
- import { __exports as utils } from '../../../../../_virtual/utils.js';
4
+ import { __exports as utils } from '../../../../../_virtual/utils2.js';
5
5
  import { __exports as _assert } from '../../../../../_virtual/_assert.js';
6
6
 
7
7
  Object.defineProperty(_sha2, "__esModule", { value: true });
@@ -1,7 +1,7 @@
1
1
  import { __exports as hmac } from '../../../../../_virtual/hmac.js';
2
2
  import './_assert.js';
3
3
  import './utils.js';
4
- import { __exports as utils } from '../../../../../_virtual/utils.js';
4
+ import { __exports as utils } from '../../../../../_virtual/utils2.js';
5
5
  import { __exports as _assert } from '../../../../../_virtual/_assert.js';
6
6
 
7
7
  (function (exports) {
@@ -2,7 +2,7 @@ import { __exports as pbkdf2$1 } from '../../../../../_virtual/pbkdf22.js';
2
2
  import './_assert.js';
3
3
  import './hmac.js';
4
4
  import './utils.js';
5
- import { __exports as utils } from '../../../../../_virtual/utils.js';
5
+ import { __exports as utils } from '../../../../../_virtual/utils2.js';
6
6
  import { __exports as _assert } from '../../../../../_virtual/_assert.js';
7
7
  import { __exports as hmac } from '../../../../../_virtual/hmac.js';
8
8
 
@@ -3,7 +3,7 @@ import './_assert.js';
3
3
  import './sha256.js';
4
4
  import './pbkdf2.js';
5
5
  import './utils.js';
6
- import { __exports as utils } from '../../../../../_virtual/utils.js';
6
+ import { __exports as utils } from '../../../../../_virtual/utils2.js';
7
7
  import { __exports as _assert } from '../../../../../_virtual/_assert.js';
8
8
  import { __exports as pbkdf2 } from '../../../../../_virtual/pbkdf22.js';
9
9
  import { __exports as sha256 } from '../../../../../_virtual/sha2562.js';
@@ -2,7 +2,7 @@ import { __exports as sha256 } from '../../../../../_virtual/sha2562.js';
2
2
  import './_sha2.js';
3
3
  import './utils.js';
4
4
  import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
5
- import { __exports as utils } from '../../../../../_virtual/utils.js';
5
+ import { __exports as utils } from '../../../../../_virtual/utils2.js';
6
6
 
7
7
  Object.defineProperty(sha256, "__esModule", { value: true });
8
8
  sha256.sha224 = sha256.sha256 = void 0;
@@ -4,7 +4,7 @@ import './_u64.js';
4
4
  import './utils.js';
5
5
  import { __exports as _u64 } from '../../../../../_virtual/_u64.js';
6
6
  import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
7
- import { __exports as utils } from '../../../../../_virtual/utils.js';
7
+ import { __exports as utils } from '../../../../../_virtual/utils2.js';
8
8
 
9
9
  Object.defineProperty(sha512, "__esModule", { value: true });
10
10
  sha512.sha384 = sha512.sha512_256 = sha512.sha512_224 = sha512.sha512 = sha512.SHA512 = void 0;
@@ -1,4 +1,4 @@
1
- import { __exports as utils } from '../../../../../_virtual/utils.js';
1
+ import { __exports as utils } from '../../../../../_virtual/utils2.js';
2
2
  import './cryptoBrowser.js';
3
3
  import { __exports as cryptoBrowser } from '../../../../../_virtual/cryptoBrowser.js';
4
4