@waku/rln 0.1.6-383e0b2.0 → 0.1.6-4997440.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 (95) hide show
  1. package/bundle/_virtual/index2.js +1 -1
  2. package/bundle/_virtual/utils.js +2 -2
  3. package/bundle/_virtual/utils2.js +2 -2
  4. package/bundle/index.js +2 -1
  5. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/checksum.js +3 -3
  6. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/cipher.js +4 -4
  7. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/class.js +7 -7
  8. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/functional.js +7 -7
  9. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/index.js +6 -6
  10. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/kdf.js +5 -5
  11. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/password.js +1 -1
  12. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1 -1
  13. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/schema-validation.js +2 -2
  14. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/types.js +1 -1
  15. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_assert.js +1 -1
  16. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_sha2.js +3 -3
  17. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_u64.js +1 -1
  18. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/cryptoBrowser.js +1 -1
  19. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/hmac.js +3 -3
  20. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/pbkdf2.js +4 -4
  21. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/scrypt.js +5 -5
  22. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/sha256.js +3 -3
  23. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/sha512.js +4 -4
  24. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/utils.js +2 -2
  25. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +3 -3
  26. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +7 -7
  27. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +3 -3
  28. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +3 -3
  29. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +3 -3
  30. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +7 -7
  31. package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +1 -1
  32. package/bundle/node_modules/@noble/hashes/esm/_assert.js +6 -32
  33. package/bundle/node_modules/@noble/hashes/esm/_md.js +22 -11
  34. package/bundle/node_modules/@noble/hashes/esm/_u64.js +4 -3
  35. package/bundle/{packages/rln/node_modules → node_modules}/@noble/hashes/esm/hmac.js +19 -10
  36. package/bundle/{packages/rln/node_modules/@noble/hashes/esm/sha256.js → node_modules/@noble/hashes/esm/sha2.js} +36 -50
  37. package/bundle/node_modules/@noble/hashes/esm/sha256.js +5 -102
  38. package/bundle/node_modules/@noble/hashes/esm/sha3.js +30 -24
  39. package/bundle/node_modules/@noble/hashes/esm/utils.js +69 -18
  40. package/bundle/node_modules/bn.js/lib/bn.js +1 -0
  41. package/bundle/node_modules/ethereum-cryptography/esm/sha256.js +1 -1
  42. package/bundle/node_modules/{@ethersproject/keccak256/node_modules/js-sha3 → js-sha3}/src/sha3.js +2 -2
  43. package/bundle/packages/core/dist/lib/message/version_0.js +1 -4
  44. package/bundle/packages/rln/dist/contract/constants.js +1 -0
  45. package/bundle/packages/rln/dist/contract/rln_base_contract.js +127 -71
  46. package/bundle/packages/rln/dist/credentials_manager.js +3 -3
  47. package/bundle/packages/rln/dist/keystore/cipher.js +3 -3
  48. package/bundle/packages/rln/dist/keystore/keystore.js +1 -1
  49. package/bundle/packages/rln/dist/message.js +11 -0
  50. package/dist/.tsbuildinfo +1 -1
  51. package/dist/contract/index.d.ts +1 -0
  52. package/dist/contract/index.js +1 -0
  53. package/dist/contract/index.js.map +1 -1
  54. package/dist/contract/rln_base_contract.d.ts +32 -22
  55. package/dist/contract/rln_base_contract.js +127 -71
  56. package/dist/contract/rln_base_contract.js.map +1 -1
  57. package/dist/contract/types.d.ts +5 -0
  58. package/dist/contract/types.js.map +1 -1
  59. package/dist/credentials_manager.js +1 -1
  60. package/dist/credentials_manager.js.map +1 -1
  61. package/dist/index.d.ts +2 -1
  62. package/dist/index.js +1 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/keystore/keystore.js.map +1 -1
  65. package/dist/keystore/types.d.ts +2 -2
  66. package/dist/message.d.ts +5 -4
  67. package/dist/message.js +2 -0
  68. package/dist/message.js.map +1 -1
  69. package/package.json +1 -1
  70. package/src/contract/index.ts +1 -0
  71. package/src/contract/rln_base_contract.ts +166 -102
  72. package/src/contract/types.ts +5 -0
  73. package/src/credentials_manager.ts +1 -1
  74. package/src/index.ts +3 -1
  75. package/src/keystore/keystore.ts +4 -2
  76. package/src/keystore/types.ts +2 -2
  77. package/src/message.ts +7 -4
  78. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_assert.js +0 -43
  79. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_sha2.js +0 -116
  80. package/bundle/packages/rln/node_modules/@noble/hashes/esm/utils.js +0 -43
  81. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +0 -0
  82. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +0 -0
  83. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +0 -0
  84. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +0 -0
  85. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +0 -0
  86. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +0 -0
  87. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +0 -0
  88. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +0 -0
  89. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +0 -0
  90. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +0 -0
  91. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +0 -0
  92. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +0 -0
  93. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +0 -0
  94. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +0 -0
  95. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +0 -0
@@ -1,116 +0,0 @@
1
- import assert from './_assert.js';
2
- import { Hash, createView, toBytes } from './utils.js';
3
-
4
- // Polyfill for Safari 14
5
- function setBigUint64(view, byteOffset, value, isLE) {
6
- if (typeof view.setBigUint64 === 'function')
7
- return view.setBigUint64(byteOffset, value, isLE);
8
- const _32n = BigInt(32);
9
- const _u32_max = BigInt(0xffffffff);
10
- const wh = Number((value >> _32n) & _u32_max);
11
- const wl = Number(value & _u32_max);
12
- const h = isLE ? 4 : 0;
13
- const l = isLE ? 0 : 4;
14
- view.setUint32(byteOffset + h, wh, isLE);
15
- view.setUint32(byteOffset + l, wl, isLE);
16
- }
17
- // Base SHA2 class (RFC 6234)
18
- class SHA2 extends Hash {
19
- constructor(blockLen, outputLen, padOffset, isLE) {
20
- super();
21
- this.blockLen = blockLen;
22
- this.outputLen = outputLen;
23
- this.padOffset = padOffset;
24
- this.isLE = isLE;
25
- this.finished = false;
26
- this.length = 0;
27
- this.pos = 0;
28
- this.destroyed = false;
29
- this.buffer = new Uint8Array(blockLen);
30
- this.view = createView(this.buffer);
31
- }
32
- update(data) {
33
- assert.exists(this);
34
- const { view, buffer, blockLen } = this;
35
- data = toBytes(data);
36
- const len = data.length;
37
- for (let pos = 0; pos < len;) {
38
- const take = Math.min(blockLen - this.pos, len - pos);
39
- // Fast path: we have at least one block in input, cast it to view and process
40
- if (take === blockLen) {
41
- const dataView = createView(data);
42
- for (; blockLen <= len - pos; pos += blockLen)
43
- this.process(dataView, pos);
44
- continue;
45
- }
46
- buffer.set(data.subarray(pos, pos + take), this.pos);
47
- this.pos += take;
48
- pos += take;
49
- if (this.pos === blockLen) {
50
- this.process(view, 0);
51
- this.pos = 0;
52
- }
53
- }
54
- this.length += data.length;
55
- this.roundClean();
56
- return this;
57
- }
58
- digestInto(out) {
59
- assert.exists(this);
60
- assert.output(out, this);
61
- this.finished = true;
62
- // Padding
63
- // We can avoid allocation of buffer for padding completely if it
64
- // was previously not allocated here. But it won't change performance.
65
- const { buffer, view, blockLen, isLE } = this;
66
- let { pos } = this;
67
- // append the bit '1' to the message
68
- buffer[pos++] = 0b10000000;
69
- this.buffer.subarray(pos).fill(0);
70
- // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again
71
- if (this.padOffset > blockLen - pos) {
72
- this.process(view, 0);
73
- pos = 0;
74
- }
75
- // Pad until full block byte with zeros
76
- for (let i = pos; i < blockLen; i++)
77
- buffer[i] = 0;
78
- // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
79
- // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
80
- // So we just write lowest 64 bits of that value.
81
- setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
82
- this.process(view, 0);
83
- const oview = createView(out);
84
- const len = this.outputLen;
85
- // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
86
- if (len % 4)
87
- throw new Error('_sha2: outputLen should be aligned to 32bit');
88
- const outLen = len / 4;
89
- const state = this.get();
90
- if (outLen > state.length)
91
- throw new Error('_sha2: outputLen bigger than state');
92
- for (let i = 0; i < outLen; i++)
93
- oview.setUint32(4 * i, state[i], isLE);
94
- }
95
- digest() {
96
- const { buffer, outputLen } = this;
97
- this.digestInto(buffer);
98
- const res = buffer.slice(0, outputLen);
99
- this.destroy();
100
- return res;
101
- }
102
- _cloneInto(to) {
103
- to || (to = new this.constructor());
104
- to.set(...this.get());
105
- const { blockLen, buffer, length, finished, destroyed, pos } = this;
106
- to.length = length;
107
- to.pos = pos;
108
- to.finished = finished;
109
- to.destroyed = destroyed;
110
- if (length % blockLen)
111
- to.buffer.set(buffer);
112
- return to;
113
- }
114
- }
115
-
116
- export { SHA2 };
@@ -1,43 +0,0 @@
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 };