@waku/rln 0.1.4-d27db21.0 → 0.1.5-5e19700.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 (107) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +5 -0
  3. package/bundle/index.js +3 -1
  4. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +1 -1
  5. package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +1 -1
  6. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +1 -1
  7. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +11 -11
  8. package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +1 -1
  9. package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +7 -7
  10. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +2 -2
  11. package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +2 -2
  12. package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +1 -1
  13. package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +1 -1
  14. package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +1 -1
  15. package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +44 -44
  16. package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +8 -8
  17. package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +1 -1
  18. package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +1 -1
  19. package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +1 -1
  20. package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +2 -2
  21. package/bundle/node_modules/@multiformats/multiaddr/dist/src/multiaddr.js +1 -0
  22. package/bundle/node_modules/@noble/hashes/esm/sha3.js +1 -1
  23. package/bundle/node_modules/bn.js/lib/bn.js +1 -1
  24. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +6 -6
  25. package/bundle/packages/rln/dist/contract/abi.js +502 -248
  26. package/bundle/packages/rln/dist/contract/constants.js +4 -5
  27. package/bundle/packages/rln/dist/contract/rln_contract.js +121 -37
  28. package/bundle/packages/rln/dist/contract/rln_light_contract.js +473 -0
  29. package/bundle/packages/rln/dist/keystore/keystore.js +2 -1
  30. package/bundle/packages/rln/dist/rln.js +6 -6
  31. package/bundle/packages/rln/dist/rln_light.js +149 -0
  32. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +2 -2
  33. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/cipher.js +3 -3
  34. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/class.js +4 -4
  35. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/functional.js +4 -4
  36. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/kdf.js +4 -4
  37. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/password.js +1 -1
  38. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1 -1
  39. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation.js +1 -1
  40. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +1 -1
  41. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +1 -1
  42. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
  43. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +1 -1
  44. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +1 -1
  45. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +1 -1
  46. package/bundle/packages/rln/node_modules/@noble/hashes/_assert.js +1 -1
  47. package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +2 -2
  48. package/bundle/packages/rln/node_modules/@noble/hashes/_u64.js +1 -1
  49. package/bundle/packages/rln/node_modules/@noble/hashes/cryptoBrowser.js +1 -1
  50. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_assert.js +43 -0
  51. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_sha2.js +116 -0
  52. package/bundle/packages/rln/node_modules/@noble/hashes/esm/hmac.js +79 -0
  53. package/bundle/packages/rln/node_modules/@noble/hashes/esm/sha256.js +126 -0
  54. package/bundle/packages/rln/node_modules/@noble/hashes/esm/utils.js +43 -0
  55. package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +2 -2
  56. package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +1 -1
  57. package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +2 -2
  58. package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +1 -1
  59. package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +2 -2
  60. package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +1 -1
  61. package/dist/.tsbuildinfo +1 -1
  62. package/dist/codec.test-utils.d.ts +36 -0
  63. package/dist/codec.test-utils.js +56 -0
  64. package/dist/codec.test-utils.js.map +1 -0
  65. package/dist/contract/abi.d.ts +21 -17
  66. package/dist/contract/abi.js +502 -248
  67. package/dist/contract/abi.js.map +1 -1
  68. package/dist/contract/constants.d.ts +22 -18
  69. package/dist/contract/constants.js +3 -3
  70. package/dist/contract/constants.js.map +1 -1
  71. package/dist/contract/rln_contract.d.ts +10 -3
  72. package/dist/contract/rln_contract.js +120 -36
  73. package/dist/contract/rln_contract.js.map +1 -1
  74. package/dist/contract/rln_light_contract.d.ts +124 -0
  75. package/dist/contract/rln_light_contract.js +456 -0
  76. package/dist/contract/rln_light_contract.js.map +1 -0
  77. package/dist/contract/test-setup.d.ts +26 -0
  78. package/dist/contract/test-setup.js +56 -0
  79. package/dist/contract/test-setup.js.map +1 -0
  80. package/dist/contract/test-utils.d.ts +39 -0
  81. package/dist/contract/test-utils.js +118 -0
  82. package/dist/contract/test-utils.js.map +1 -0
  83. package/dist/index.d.ts +5 -2
  84. package/dist/index.js +4 -2
  85. package/dist/index.js.map +1 -1
  86. package/dist/keystore/keystore.js +2 -1
  87. package/dist/keystore/keystore.js.map +1 -1
  88. package/dist/keystore/types.d.ts +1 -0
  89. package/dist/rln.d.ts +1 -1
  90. package/dist/rln.js +6 -6
  91. package/dist/rln.js.map +1 -1
  92. package/dist/rln_light.d.ts +64 -0
  93. package/dist/rln_light.js +144 -0
  94. package/dist/rln_light.js.map +1 -0
  95. package/package.json +1 -1
  96. package/src/codec.test-utils.ts +80 -0
  97. package/src/contract/abi.ts +502 -248
  98. package/src/contract/constants.ts +3 -3
  99. package/src/contract/rln_contract.ts +158 -46
  100. package/src/contract/rln_light_contract.ts +718 -0
  101. package/src/contract/test-setup.ts +86 -0
  102. package/src/contract/test-utils.ts +179 -0
  103. package/src/index.ts +17 -2
  104. package/src/keystore/keystore.ts +2 -1
  105. package/src/keystore/types.ts +1 -0
  106. package/src/rln.ts +7 -7
  107. package/src/rln_light.ts +235 -0
@@ -0,0 +1,43 @@
1
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
+ // The import here is via the package name. This is to ensure
3
+ // that exports mapping/resolution does fall into place.
4
+ // Cast array to view
5
+ const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
6
+ // The rotate right (circular right shift) operation for uint32
7
+ const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
8
+ const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
9
+ // There is almost no big endian hardware, but js typed arrays uses platform specific endianness.
10
+ // So, just to be sure not to corrupt anything.
11
+ if (!isLE)
12
+ throw new Error('Non little-endian hardware is not supported');
13
+ Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));
14
+ function utf8ToBytes(str) {
15
+ if (typeof str !== 'string') {
16
+ throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`);
17
+ }
18
+ return new TextEncoder().encode(str);
19
+ }
20
+ function toBytes(data) {
21
+ if (typeof data === 'string')
22
+ data = utf8ToBytes(data);
23
+ if (!(data instanceof Uint8Array))
24
+ throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`);
25
+ return data;
26
+ }
27
+ // For runtime check if class implements interface
28
+ class Hash {
29
+ // Safe version that clones internal state
30
+ clone() {
31
+ return this._cloneInto();
32
+ }
33
+ }
34
+ function wrapConstructor(hashConstructor) {
35
+ const hashC = (message) => hashConstructor().update(toBytes(message)).digest();
36
+ const tmp = hashConstructor();
37
+ hashC.outputLen = tmp.outputLen;
38
+ hashC.blockLen = tmp.blockLen;
39
+ hashC.create = () => hashConstructor();
40
+ return hashC;
41
+ }
42
+
43
+ export { Hash, createView, isLE, rotr, toBytes, utf8ToBytes, wrapConstructor };
@@ -1,12 +1,12 @@
1
1
  import { __exports as hmac } from '../../../../../_virtual/hmac.js';
2
2
  import './_assert.js';
3
3
  import './utils.js';
4
- import { __exports as _assert } from '../../../../../_virtual/_assert.js';
5
4
  import { __exports as utils } from '../../../../../_virtual/utils.js';
5
+ import { __exports as _assert } from '../../../../../_virtual/_assert.js';
6
6
 
7
7
  (function (exports) {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.hmac = undefined;
9
+ exports.hmac = void 0;
10
10
  const _assert_js_1 = _assert;
11
11
  const utils_js_1 = utils;
12
12
  // HMAC (RFC 2104)
@@ -7,7 +7,7 @@ import { __exports as _assert } from '../../../../../_virtual/_assert.js';
7
7
  import { __exports as hmac } from '../../../../../_virtual/hmac.js';
8
8
 
9
9
  Object.defineProperty(pbkdf2$1, "__esModule", { value: true });
10
- pbkdf2$1.pbkdf2Async = pbkdf2$1.pbkdf2 = undefined;
10
+ pbkdf2$1.pbkdf2Async = pbkdf2$1.pbkdf2 = void 0;
11
11
  const _assert_js_1 = _assert;
12
12
  const hmac_js_1 = hmac;
13
13
  const utils_js_1 = utils;
@@ -5,11 +5,11 @@ import './pbkdf2.js';
5
5
  import './utils.js';
6
6
  import { __exports as utils } from '../../../../../_virtual/utils.js';
7
7
  import { __exports as _assert } from '../../../../../_virtual/_assert.js';
8
- import { __exports as sha256 } from '../../../../../_virtual/sha2562.js';
9
8
  import { __exports as pbkdf2 } from '../../../../../_virtual/pbkdf22.js';
9
+ import { __exports as sha256 } from '../../../../../_virtual/sha2562.js';
10
10
 
11
11
  Object.defineProperty(scrypt$1, "__esModule", { value: true });
12
- scrypt$1.scryptAsync = scrypt$1.scrypt = undefined;
12
+ scrypt$1.scryptAsync = scrypt$1.scrypt = void 0;
13
13
  const _assert_js_1 = _assert;
14
14
  const sha256_js_1 = sha256;
15
15
  const pbkdf2_js_1 = pbkdf2;
@@ -5,7 +5,7 @@ import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
5
5
  import { __exports as utils } from '../../../../../_virtual/utils.js';
6
6
 
7
7
  Object.defineProperty(sha256, "__esModule", { value: true });
8
- sha256.sha224 = sha256.sha256 = undefined;
8
+ sha256.sha224 = sha256.sha256 = void 0;
9
9
  const _sha2_js_1 = _sha2;
10
10
  const utils_js_1 = utils;
11
11
  // Choice: a ? b : c
@@ -2,12 +2,12 @@ import { __exports as sha512 } from '../../../../../_virtual/sha512.js';
2
2
  import './_sha2.js';
3
3
  import './_u64.js';
4
4
  import './utils.js';
5
- import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
6
5
  import { __exports as _u64 } from '../../../../../_virtual/_u64.js';
6
+ import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
7
7
  import { __exports as utils } from '../../../../../_virtual/utils.js';
8
8
 
9
9
  Object.defineProperty(sha512, "__esModule", { value: true });
10
- sha512.sha384 = sha512.sha512_256 = sha512.sha512_224 = sha512.sha512 = sha512.SHA512 = undefined;
10
+ sha512.sha384 = sha512.sha512_256 = sha512.sha512_224 = sha512.sha512 = sha512.SHA512 = void 0;
11
11
  const _sha2_js_1 = _sha2;
12
12
  const _u64_js_1 = _u64;
13
13
  const utils_js_1 = utils;
@@ -5,7 +5,7 @@ import { __exports as cryptoBrowser } from '../../../../../_virtual/cryptoBrowse
5
5
  (function (exports) {
6
6
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.randomBytes = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = undefined;
8
+ exports.randomBytes = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;
9
9
  // The import here is via the package name. This is to ensure
10
10
  // that exports mapping/resolution does fall into place.
11
11
  const crypto_1 = cryptoBrowser;