@waku/rln 0.1.5-cad3e7a.0 → 0.1.5-d17562d.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 (168) hide show
  1. package/bundle/index.js +4 -3
  2. package/bundle/packages/rln/dist/contract/constants.js +2 -1
  3. package/bundle/packages/rln/dist/contract/{rln_light_contract.js → rln_base_contract.js} +191 -186
  4. package/bundle/packages/rln/dist/contract/rln_contract.js +10 -420
  5. package/bundle/packages/rln/dist/contract/types.js +9 -0
  6. package/bundle/packages/rln/dist/create.js +1 -1
  7. package/bundle/packages/rln/dist/{rln_light.js → credentials_manager.js} +114 -48
  8. package/bundle/packages/rln/dist/identity.js +0 -9
  9. package/bundle/packages/rln/dist/keystore/keystore.js +31 -17
  10. package/bundle/packages/rln/dist/rln.js +57 -167
  11. package/bundle/packages/rln/dist/utils/bytes.js +8 -2
  12. package/bundle/packages/rln/dist/utils/metamask.js +2 -2
  13. package/bundle/packages/rln/dist/zerokit.js +5 -5
  14. package/dist/.tsbuildinfo +1 -1
  15. package/dist/contract/constants.d.ts +1 -1
  16. package/dist/contract/constants.js +1 -1
  17. package/dist/contract/constants.js.map +1 -1
  18. package/dist/contract/index.d.ts +1 -0
  19. package/dist/contract/index.js +1 -0
  20. package/dist/contract/index.js.map +1 -1
  21. package/dist/contract/{rln_light_contract.d.ts → rln_base_contract.d.ts} +24 -58
  22. package/dist/contract/{rln_light_contract.js → rln_base_contract.js} +189 -184
  23. package/dist/contract/rln_base_contract.js.map +1 -0
  24. package/dist/contract/rln_contract.d.ts +5 -122
  25. package/dist/contract/rln_contract.js +8 -417
  26. package/dist/contract/rln_contract.js.map +1 -1
  27. package/dist/contract/types.d.ts +45 -0
  28. package/dist/contract/types.js +8 -0
  29. package/dist/contract/types.js.map +1 -0
  30. package/dist/create.js +1 -1
  31. package/dist/create.js.map +1 -1
  32. package/dist/credentials_manager.d.ts +44 -0
  33. package/dist/credentials_manager.js +197 -0
  34. package/dist/credentials_manager.js.map +1 -0
  35. package/dist/identity.d.ts +0 -1
  36. package/dist/identity.js +0 -9
  37. package/dist/identity.js.map +1 -1
  38. package/dist/index.d.ts +5 -4
  39. package/dist/index.js +4 -3
  40. package/dist/index.js.map +1 -1
  41. package/dist/keystore/keystore.d.ts +1 -0
  42. package/dist/keystore/keystore.js +31 -17
  43. package/dist/keystore/keystore.js.map +1 -1
  44. package/dist/keystore/types.d.ts +3 -3
  45. package/dist/rln.d.ts +9 -52
  46. package/dist/rln.js +55 -164
  47. package/dist/rln.js.map +1 -1
  48. package/dist/types.d.ts +27 -0
  49. package/dist/types.js +2 -0
  50. package/dist/types.js.map +1 -0
  51. package/dist/utils/bytes.js +8 -2
  52. package/dist/utils/bytes.js.map +1 -1
  53. package/dist/zerokit.d.ts +3 -3
  54. package/dist/zerokit.js +5 -5
  55. package/dist/zerokit.js.map +1 -1
  56. package/package.json +1 -1
  57. package/src/contract/constants.ts +1 -1
  58. package/src/contract/index.ts +1 -0
  59. package/src/contract/{rln_light_contract.ts → rln_base_contract.ts} +308 -323
  60. package/src/contract/rln_contract.ts +9 -663
  61. package/src/contract/types.ts +53 -0
  62. package/src/create.ts +1 -1
  63. package/src/credentials_manager.ts +282 -0
  64. package/src/identity.ts +0 -10
  65. package/src/index.ts +7 -5
  66. package/src/keystore/keystore.ts +57 -31
  67. package/src/keystore/types.ts +3 -3
  68. package/src/rln.ts +68 -259
  69. package/src/types.ts +31 -0
  70. package/src/utils/bytes.ts +10 -2
  71. package/src/zerokit.ts +3 -3
  72. package/bundle/_virtual/__node-resolve_empty.js +0 -6
  73. package/bundle/_virtual/_node-resolve_empty.js +0 -3
  74. package/bundle/_virtual/bn.js +0 -3
  75. package/bundle/_virtual/common.js +0 -3
  76. package/bundle/_virtual/common2.js +0 -3
  77. package/bundle/_virtual/hash.js +0 -3
  78. package/bundle/_virtual/inherits_browser.js +0 -3
  79. package/bundle/_virtual/ripemd.js +0 -3
  80. package/bundle/_virtual/sha.js +0 -3
  81. package/bundle/_virtual/sha3.js +0 -3
  82. package/bundle/_virtual/utils3.js +0 -3
  83. package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +0 -3
  84. package/bundle/node_modules/@ethersproject/abi/lib.esm/abi-coder.js +0 -96
  85. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +0 -148
  86. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/address.js +0 -26
  87. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +0 -20
  88. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/array.js +0 -210
  89. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +0 -18
  90. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +0 -30
  91. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +0 -26
  92. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/null.js +0 -22
  93. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/number.js +0 -43
  94. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/string.js +0 -19
  95. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +0 -58
  96. package/bundle/node_modules/@ethersproject/abi/lib.esm/fragments.js +0 -854
  97. package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +0 -609
  98. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +0 -3
  99. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +0 -66
  100. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +0 -3
  101. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +0 -302
  102. package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +0 -3
  103. package/bundle/node_modules/@ethersproject/address/lib.esm/index.js +0 -110
  104. package/bundle/node_modules/@ethersproject/base64/lib.esm/base64.js +0 -20
  105. package/bundle/node_modules/@ethersproject/basex/lib.esm/index.js +0 -120
  106. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +0 -3
  107. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +0 -287
  108. package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +0 -3
  109. package/bundle/node_modules/@ethersproject/bytes/lib.esm/index.js +0 -402
  110. package/bundle/node_modules/@ethersproject/constants/lib.esm/addresses.js +0 -3
  111. package/bundle/node_modules/@ethersproject/constants/lib.esm/bignumbers.js +0 -8
  112. package/bundle/node_modules/@ethersproject/constants/lib.esm/hashes.js +0 -3
  113. package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +0 -3
  114. package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +0 -893
  115. package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +0 -3
  116. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +0 -256
  117. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +0 -36
  118. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +0 -135
  119. package/bundle/node_modules/@ethersproject/hash/lib.esm/id.js +0 -8
  120. package/bundle/node_modules/@ethersproject/hash/lib.esm/namehash.js +0 -64
  121. package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +0 -443
  122. package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +0 -8
  123. package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +0 -660
  124. package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +0 -3
  125. package/bundle/node_modules/@ethersproject/logger/lib.esm/index.js +0 -352
  126. package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +0 -3
  127. package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +0 -248
  128. package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +0 -3
  129. package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +0 -127
  130. package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +0 -3
  131. package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +0 -2007
  132. package/bundle/node_modules/@ethersproject/providers/lib.esm/formatter.js +0 -422
  133. package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +0 -674
  134. package/bundle/node_modules/@ethersproject/providers/lib.esm/web3-provider.js +0 -132
  135. package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +0 -3
  136. package/bundle/node_modules/@ethersproject/rlp/lib.esm/index.js +0 -120
  137. package/bundle/node_modules/@ethersproject/sha2/lib.esm/sha2.js +0 -8
  138. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +0 -3
  139. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +0 -2430
  140. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/index.js +0 -76
  141. package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +0 -3
  142. package/bundle/node_modules/@ethersproject/strings/lib.esm/utf8.js +0 -219
  143. package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +0 -3
  144. package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +0 -279
  145. package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +0 -3
  146. package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +0 -69
  147. package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +0 -404
  148. package/bundle/node_modules/bech32/index.js +0 -187
  149. package/bundle/node_modules/bn.js/lib/bn.js +0 -3361
  150. package/bundle/node_modules/hash.js/lib/hash/common.js +0 -97
  151. package/bundle/node_modules/hash.js/lib/hash/hmac.js +0 -51
  152. package/bundle/node_modules/hash.js/lib/hash/ripemd.js +0 -152
  153. package/bundle/node_modules/hash.js/lib/hash/sha/1.js +0 -81
  154. package/bundle/node_modules/hash.js/lib/hash/sha/224.js +0 -33
  155. package/bundle/node_modules/hash.js/lib/hash/sha/256.js +0 -113
  156. package/bundle/node_modules/hash.js/lib/hash/sha/384.js +0 -39
  157. package/bundle/node_modules/hash.js/lib/hash/sha/512.js +0 -336
  158. package/bundle/node_modules/hash.js/lib/hash/sha/common.js +0 -53
  159. package/bundle/node_modules/hash.js/lib/hash/sha.js +0 -14
  160. package/bundle/node_modules/hash.js/lib/hash/utils.js +0 -282
  161. package/bundle/node_modules/hash.js/lib/hash.js +0 -33
  162. package/bundle/node_modules/inherits/inherits_browser.js +0 -33
  163. package/bundle/node_modules/minimalistic-assert/index.js +0 -13
  164. package/dist/contract/rln_light_contract.js.map +0 -1
  165. package/dist/rln_light.d.ts +0 -64
  166. package/dist/rln_light.js +0 -144
  167. package/dist/rln_light.js.map +0 -1
  168. package/src/rln_light.ts +0 -235
@@ -1,660 +0,0 @@
1
- import { getDefaultExportFromCjs, commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
2
- import { __module as sha3$1 } from '../../../../../../_virtual/sha3.js';
3
-
4
- /**
5
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
6
- *
7
- * @version 0.8.0
8
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
9
- * @copyright Chen, Yi-Cyuan 2015-2018
10
- * @license MIT
11
- */
12
-
13
- (function (module) {
14
- /*jslint bitwise: true */
15
- (function () {
16
-
17
- var INPUT_ERROR = 'input is invalid type';
18
- var FINALIZE_ERROR = 'finalize already called';
19
- var WINDOW = typeof window === 'object';
20
- var root = WINDOW ? window : {};
21
- if (root.JS_SHA3_NO_WINDOW) {
22
- WINDOW = false;
23
- }
24
- var WEB_WORKER = !WINDOW && typeof self === 'object';
25
- var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
26
- if (NODE_JS) {
27
- root = commonjsGlobal;
28
- } else if (WEB_WORKER) {
29
- root = self;
30
- }
31
- var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports;
32
- var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
33
- var HEX_CHARS = '0123456789abcdef'.split('');
34
- var SHAKE_PADDING = [31, 7936, 2031616, 520093696];
35
- var CSHAKE_PADDING = [4, 1024, 262144, 67108864];
36
- var KECCAK_PADDING = [1, 256, 65536, 16777216];
37
- var PADDING = [6, 1536, 393216, 100663296];
38
- var SHIFT = [0, 8, 16, 24];
39
- var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,
40
- 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,
41
- 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,
42
- 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,
43
- 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];
44
- var BITS = [224, 256, 384, 512];
45
- var SHAKE_BITS = [128, 256];
46
- var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];
47
- var CSHAKE_BYTEPAD = {
48
- '128': 168,
49
- '256': 136
50
- };
51
-
52
- if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {
53
- Array.isArray = function (obj) {
54
- return Object.prototype.toString.call(obj) === '[object Array]';
55
- };
56
- }
57
-
58
- if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
59
- ArrayBuffer.isView = function (obj) {
60
- return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
61
- };
62
- }
63
-
64
- var createOutputMethod = function (bits, padding, outputType) {
65
- return function (message) {
66
- return new Keccak(bits, padding, bits).update(message)[outputType]();
67
- };
68
- };
69
-
70
- var createShakeOutputMethod = function (bits, padding, outputType) {
71
- return function (message, outputBits) {
72
- return new Keccak(bits, padding, outputBits).update(message)[outputType]();
73
- };
74
- };
75
-
76
- var createCshakeOutputMethod = function (bits, padding, outputType) {
77
- return function (message, outputBits, n, s) {
78
- return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();
79
- };
80
- };
81
-
82
- var createKmacOutputMethod = function (bits, padding, outputType) {
83
- return function (key, message, outputBits, s) {
84
- return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();
85
- };
86
- };
87
-
88
- var createOutputMethods = function (method, createMethod, bits, padding) {
89
- for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
90
- var type = OUTPUT_TYPES[i];
91
- method[type] = createMethod(bits, padding, type);
92
- }
93
- return method;
94
- };
95
-
96
- var createMethod = function (bits, padding) {
97
- var method = createOutputMethod(bits, padding, 'hex');
98
- method.create = function () {
99
- return new Keccak(bits, padding, bits);
100
- };
101
- method.update = function (message) {
102
- return method.create().update(message);
103
- };
104
- return createOutputMethods(method, createOutputMethod, bits, padding);
105
- };
106
-
107
- var createShakeMethod = function (bits, padding) {
108
- var method = createShakeOutputMethod(bits, padding, 'hex');
109
- method.create = function (outputBits) {
110
- return new Keccak(bits, padding, outputBits);
111
- };
112
- method.update = function (message, outputBits) {
113
- return method.create(outputBits).update(message);
114
- };
115
- return createOutputMethods(method, createShakeOutputMethod, bits, padding);
116
- };
117
-
118
- var createCshakeMethod = function (bits, padding) {
119
- var w = CSHAKE_BYTEPAD[bits];
120
- var method = createCshakeOutputMethod(bits, padding, 'hex');
121
- method.create = function (outputBits, n, s) {
122
- if (!n && !s) {
123
- return methods['shake' + bits].create(outputBits);
124
- } else {
125
- return new Keccak(bits, padding, outputBits).bytepad([n, s], w);
126
- }
127
- };
128
- method.update = function (message, outputBits, n, s) {
129
- return method.create(outputBits, n, s).update(message);
130
- };
131
- return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
132
- };
133
-
134
- var createKmacMethod = function (bits, padding) {
135
- var w = CSHAKE_BYTEPAD[bits];
136
- var method = createKmacOutputMethod(bits, padding, 'hex');
137
- method.create = function (key, outputBits, s) {
138
- return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);
139
- };
140
- method.update = function (key, message, outputBits, s) {
141
- return method.create(key, outputBits, s).update(message);
142
- };
143
- return createOutputMethods(method, createKmacOutputMethod, bits, padding);
144
- };
145
-
146
- var algorithms = [
147
- { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },
148
- { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },
149
- { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },
150
- { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },
151
- { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }
152
- ];
153
-
154
- var methods = {}, methodNames = [];
155
-
156
- for (var i = 0; i < algorithms.length; ++i) {
157
- var algorithm = algorithms[i];
158
- var bits = algorithm.bits;
159
- for (var j = 0; j < bits.length; ++j) {
160
- var methodName = algorithm.name + '_' + bits[j];
161
- methodNames.push(methodName);
162
- methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);
163
- if (algorithm.name !== 'sha3') {
164
- var newMethodName = algorithm.name + bits[j];
165
- methodNames.push(newMethodName);
166
- methods[newMethodName] = methods[methodName];
167
- }
168
- }
169
- }
170
-
171
- function Keccak(bits, padding, outputBits) {
172
- this.blocks = [];
173
- this.s = [];
174
- this.padding = padding;
175
- this.outputBits = outputBits;
176
- this.reset = true;
177
- this.finalized = false;
178
- this.block = 0;
179
- this.start = 0;
180
- this.blockCount = (1600 - (bits << 1)) >> 5;
181
- this.byteCount = this.blockCount << 2;
182
- this.outputBlocks = outputBits >> 5;
183
- this.extraBytes = (outputBits & 31) >> 3;
184
-
185
- for (var i = 0; i < 50; ++i) {
186
- this.s[i] = 0;
187
- }
188
- }
189
-
190
- Keccak.prototype.update = function (message) {
191
- if (this.finalized) {
192
- throw new Error(FINALIZE_ERROR);
193
- }
194
- var notString, type = typeof message;
195
- if (type !== 'string') {
196
- if (type === 'object') {
197
- if (message === null) {
198
- throw new Error(INPUT_ERROR);
199
- } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
200
- message = new Uint8Array(message);
201
- } else if (!Array.isArray(message)) {
202
- if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
203
- throw new Error(INPUT_ERROR);
204
- }
205
- }
206
- } else {
207
- throw new Error(INPUT_ERROR);
208
- }
209
- notString = true;
210
- }
211
- var blocks = this.blocks, byteCount = this.byteCount, length = message.length,
212
- blockCount = this.blockCount, index = 0, s = this.s, i, code;
213
-
214
- while (index < length) {
215
- if (this.reset) {
216
- this.reset = false;
217
- blocks[0] = this.block;
218
- for (i = 1; i < blockCount + 1; ++i) {
219
- blocks[i] = 0;
220
- }
221
- }
222
- if (notString) {
223
- for (i = this.start; index < length && i < byteCount; ++index) {
224
- blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
225
- }
226
- } else {
227
- for (i = this.start; index < length && i < byteCount; ++index) {
228
- code = message.charCodeAt(index);
229
- if (code < 0x80) {
230
- blocks[i >> 2] |= code << SHIFT[i++ & 3];
231
- } else if (code < 0x800) {
232
- blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
233
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
234
- } else if (code < 0xd800 || code >= 0xe000) {
235
- blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
236
- blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
237
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
238
- } else {
239
- code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
240
- blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
241
- blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
242
- blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
243
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
244
- }
245
- }
246
- }
247
- this.lastByteIndex = i;
248
- if (i >= byteCount) {
249
- this.start = i - byteCount;
250
- this.block = blocks[blockCount];
251
- for (i = 0; i < blockCount; ++i) {
252
- s[i] ^= blocks[i];
253
- }
254
- f(s);
255
- this.reset = true;
256
- } else {
257
- this.start = i;
258
- }
259
- }
260
- return this;
261
- };
262
-
263
- Keccak.prototype.encode = function (x, right) {
264
- var o = x & 255, n = 1;
265
- var bytes = [o];
266
- x = x >> 8;
267
- o = x & 255;
268
- while (o > 0) {
269
- bytes.unshift(o);
270
- x = x >> 8;
271
- o = x & 255;
272
- ++n;
273
- }
274
- if (right) {
275
- bytes.push(n);
276
- } else {
277
- bytes.unshift(n);
278
- }
279
- this.update(bytes);
280
- return bytes.length;
281
- };
282
-
283
- Keccak.prototype.encodeString = function (str) {
284
- var notString, type = typeof str;
285
- if (type !== 'string') {
286
- if (type === 'object') {
287
- if (str === null) {
288
- throw new Error(INPUT_ERROR);
289
- } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {
290
- str = new Uint8Array(str);
291
- } else if (!Array.isArray(str)) {
292
- if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {
293
- throw new Error(INPUT_ERROR);
294
- }
295
- }
296
- } else {
297
- throw new Error(INPUT_ERROR);
298
- }
299
- notString = true;
300
- }
301
- var bytes = 0, length = str.length;
302
- if (notString) {
303
- bytes = length;
304
- } else {
305
- for (var i = 0; i < str.length; ++i) {
306
- var code = str.charCodeAt(i);
307
- if (code < 0x80) {
308
- bytes += 1;
309
- } else if (code < 0x800) {
310
- bytes += 2;
311
- } else if (code < 0xd800 || code >= 0xe000) {
312
- bytes += 3;
313
- } else {
314
- code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
315
- bytes += 4;
316
- }
317
- }
318
- }
319
- bytes += this.encode(bytes * 8);
320
- this.update(str);
321
- return bytes;
322
- };
323
-
324
- Keccak.prototype.bytepad = function (strs, w) {
325
- var bytes = this.encode(w);
326
- for (var i = 0; i < strs.length; ++i) {
327
- bytes += this.encodeString(strs[i]);
328
- }
329
- var paddingBytes = w - bytes % w;
330
- var zeros = [];
331
- zeros.length = paddingBytes;
332
- this.update(zeros);
333
- return this;
334
- };
335
-
336
- Keccak.prototype.finalize = function () {
337
- if (this.finalized) {
338
- return;
339
- }
340
- this.finalized = true;
341
- var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;
342
- blocks[i >> 2] |= this.padding[i & 3];
343
- if (this.lastByteIndex === this.byteCount) {
344
- blocks[0] = blocks[blockCount];
345
- for (i = 1; i < blockCount + 1; ++i) {
346
- blocks[i] = 0;
347
- }
348
- }
349
- blocks[blockCount - 1] |= 0x80000000;
350
- for (i = 0; i < blockCount; ++i) {
351
- s[i] ^= blocks[i];
352
- }
353
- f(s);
354
- };
355
-
356
- Keccak.prototype.toString = Keccak.prototype.hex = function () {
357
- this.finalize();
358
-
359
- var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
360
- extraBytes = this.extraBytes, i = 0, j = 0;
361
- var hex = '', block;
362
- while (j < outputBlocks) {
363
- for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
364
- block = s[i];
365
- hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +
366
- HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +
367
- HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +
368
- HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];
369
- }
370
- if (j % blockCount === 0) {
371
- f(s);
372
- i = 0;
373
- }
374
- }
375
- if (extraBytes) {
376
- block = s[i];
377
- hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];
378
- if (extraBytes > 1) {
379
- hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];
380
- }
381
- if (extraBytes > 2) {
382
- hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];
383
- }
384
- }
385
- return hex;
386
- };
387
-
388
- Keccak.prototype.arrayBuffer = function () {
389
- this.finalize();
390
-
391
- var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
392
- extraBytes = this.extraBytes, i = 0, j = 0;
393
- var bytes = this.outputBits >> 3;
394
- var buffer;
395
- if (extraBytes) {
396
- buffer = new ArrayBuffer((outputBlocks + 1) << 2);
397
- } else {
398
- buffer = new ArrayBuffer(bytes);
399
- }
400
- var array = new Uint32Array(buffer);
401
- while (j < outputBlocks) {
402
- for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
403
- array[j] = s[i];
404
- }
405
- if (j % blockCount === 0) {
406
- f(s);
407
- }
408
- }
409
- if (extraBytes) {
410
- array[i] = s[i];
411
- buffer = buffer.slice(0, bytes);
412
- }
413
- return buffer;
414
- };
415
-
416
- Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;
417
-
418
- Keccak.prototype.digest = Keccak.prototype.array = function () {
419
- this.finalize();
420
-
421
- var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
422
- extraBytes = this.extraBytes, i = 0, j = 0;
423
- var array = [], offset, block;
424
- while (j < outputBlocks) {
425
- for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
426
- offset = j << 2;
427
- block = s[i];
428
- array[offset] = block & 0xFF;
429
- array[offset + 1] = (block >> 8) & 0xFF;
430
- array[offset + 2] = (block >> 16) & 0xFF;
431
- array[offset + 3] = (block >> 24) & 0xFF;
432
- }
433
- if (j % blockCount === 0) {
434
- f(s);
435
- }
436
- }
437
- if (extraBytes) {
438
- offset = j << 2;
439
- block = s[i];
440
- array[offset] = block & 0xFF;
441
- if (extraBytes > 1) {
442
- array[offset + 1] = (block >> 8) & 0xFF;
443
- }
444
- if (extraBytes > 2) {
445
- array[offset + 2] = (block >> 16) & 0xFF;
446
- }
447
- }
448
- return array;
449
- };
450
-
451
- function Kmac(bits, padding, outputBits) {
452
- Keccak.call(this, bits, padding, outputBits);
453
- }
454
-
455
- Kmac.prototype = new Keccak();
456
-
457
- Kmac.prototype.finalize = function () {
458
- this.encode(this.outputBits, true);
459
- return Keccak.prototype.finalize.call(this);
460
- };
461
-
462
- var f = function (s) {
463
- var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,
464
- b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,
465
- b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,
466
- b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;
467
- for (n = 0; n < 48; n += 2) {
468
- c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];
469
- c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];
470
- c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];
471
- c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];
472
- c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];
473
- c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];
474
- c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];
475
- c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];
476
- c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];
477
- c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];
478
-
479
- h = c8 ^ ((c2 << 1) | (c3 >>> 31));
480
- l = c9 ^ ((c3 << 1) | (c2 >>> 31));
481
- s[0] ^= h;
482
- s[1] ^= l;
483
- s[10] ^= h;
484
- s[11] ^= l;
485
- s[20] ^= h;
486
- s[21] ^= l;
487
- s[30] ^= h;
488
- s[31] ^= l;
489
- s[40] ^= h;
490
- s[41] ^= l;
491
- h = c0 ^ ((c4 << 1) | (c5 >>> 31));
492
- l = c1 ^ ((c5 << 1) | (c4 >>> 31));
493
- s[2] ^= h;
494
- s[3] ^= l;
495
- s[12] ^= h;
496
- s[13] ^= l;
497
- s[22] ^= h;
498
- s[23] ^= l;
499
- s[32] ^= h;
500
- s[33] ^= l;
501
- s[42] ^= h;
502
- s[43] ^= l;
503
- h = c2 ^ ((c6 << 1) | (c7 >>> 31));
504
- l = c3 ^ ((c7 << 1) | (c6 >>> 31));
505
- s[4] ^= h;
506
- s[5] ^= l;
507
- s[14] ^= h;
508
- s[15] ^= l;
509
- s[24] ^= h;
510
- s[25] ^= l;
511
- s[34] ^= h;
512
- s[35] ^= l;
513
- s[44] ^= h;
514
- s[45] ^= l;
515
- h = c4 ^ ((c8 << 1) | (c9 >>> 31));
516
- l = c5 ^ ((c9 << 1) | (c8 >>> 31));
517
- s[6] ^= h;
518
- s[7] ^= l;
519
- s[16] ^= h;
520
- s[17] ^= l;
521
- s[26] ^= h;
522
- s[27] ^= l;
523
- s[36] ^= h;
524
- s[37] ^= l;
525
- s[46] ^= h;
526
- s[47] ^= l;
527
- h = c6 ^ ((c0 << 1) | (c1 >>> 31));
528
- l = c7 ^ ((c1 << 1) | (c0 >>> 31));
529
- s[8] ^= h;
530
- s[9] ^= l;
531
- s[18] ^= h;
532
- s[19] ^= l;
533
- s[28] ^= h;
534
- s[29] ^= l;
535
- s[38] ^= h;
536
- s[39] ^= l;
537
- s[48] ^= h;
538
- s[49] ^= l;
539
-
540
- b0 = s[0];
541
- b1 = s[1];
542
- b32 = (s[11] << 4) | (s[10] >>> 28);
543
- b33 = (s[10] << 4) | (s[11] >>> 28);
544
- b14 = (s[20] << 3) | (s[21] >>> 29);
545
- b15 = (s[21] << 3) | (s[20] >>> 29);
546
- b46 = (s[31] << 9) | (s[30] >>> 23);
547
- b47 = (s[30] << 9) | (s[31] >>> 23);
548
- b28 = (s[40] << 18) | (s[41] >>> 14);
549
- b29 = (s[41] << 18) | (s[40] >>> 14);
550
- b20 = (s[2] << 1) | (s[3] >>> 31);
551
- b21 = (s[3] << 1) | (s[2] >>> 31);
552
- b2 = (s[13] << 12) | (s[12] >>> 20);
553
- b3 = (s[12] << 12) | (s[13] >>> 20);
554
- b34 = (s[22] << 10) | (s[23] >>> 22);
555
- b35 = (s[23] << 10) | (s[22] >>> 22);
556
- b16 = (s[33] << 13) | (s[32] >>> 19);
557
- b17 = (s[32] << 13) | (s[33] >>> 19);
558
- b48 = (s[42] << 2) | (s[43] >>> 30);
559
- b49 = (s[43] << 2) | (s[42] >>> 30);
560
- b40 = (s[5] << 30) | (s[4] >>> 2);
561
- b41 = (s[4] << 30) | (s[5] >>> 2);
562
- b22 = (s[14] << 6) | (s[15] >>> 26);
563
- b23 = (s[15] << 6) | (s[14] >>> 26);
564
- b4 = (s[25] << 11) | (s[24] >>> 21);
565
- b5 = (s[24] << 11) | (s[25] >>> 21);
566
- b36 = (s[34] << 15) | (s[35] >>> 17);
567
- b37 = (s[35] << 15) | (s[34] >>> 17);
568
- b18 = (s[45] << 29) | (s[44] >>> 3);
569
- b19 = (s[44] << 29) | (s[45] >>> 3);
570
- b10 = (s[6] << 28) | (s[7] >>> 4);
571
- b11 = (s[7] << 28) | (s[6] >>> 4);
572
- b42 = (s[17] << 23) | (s[16] >>> 9);
573
- b43 = (s[16] << 23) | (s[17] >>> 9);
574
- b24 = (s[26] << 25) | (s[27] >>> 7);
575
- b25 = (s[27] << 25) | (s[26] >>> 7);
576
- b6 = (s[36] << 21) | (s[37] >>> 11);
577
- b7 = (s[37] << 21) | (s[36] >>> 11);
578
- b38 = (s[47] << 24) | (s[46] >>> 8);
579
- b39 = (s[46] << 24) | (s[47] >>> 8);
580
- b30 = (s[8] << 27) | (s[9] >>> 5);
581
- b31 = (s[9] << 27) | (s[8] >>> 5);
582
- b12 = (s[18] << 20) | (s[19] >>> 12);
583
- b13 = (s[19] << 20) | (s[18] >>> 12);
584
- b44 = (s[29] << 7) | (s[28] >>> 25);
585
- b45 = (s[28] << 7) | (s[29] >>> 25);
586
- b26 = (s[38] << 8) | (s[39] >>> 24);
587
- b27 = (s[39] << 8) | (s[38] >>> 24);
588
- b8 = (s[48] << 14) | (s[49] >>> 18);
589
- b9 = (s[49] << 14) | (s[48] >>> 18);
590
-
591
- s[0] = b0 ^ (~b2 & b4);
592
- s[1] = b1 ^ (~b3 & b5);
593
- s[10] = b10 ^ (~b12 & b14);
594
- s[11] = b11 ^ (~b13 & b15);
595
- s[20] = b20 ^ (~b22 & b24);
596
- s[21] = b21 ^ (~b23 & b25);
597
- s[30] = b30 ^ (~b32 & b34);
598
- s[31] = b31 ^ (~b33 & b35);
599
- s[40] = b40 ^ (~b42 & b44);
600
- s[41] = b41 ^ (~b43 & b45);
601
- s[2] = b2 ^ (~b4 & b6);
602
- s[3] = b3 ^ (~b5 & b7);
603
- s[12] = b12 ^ (~b14 & b16);
604
- s[13] = b13 ^ (~b15 & b17);
605
- s[22] = b22 ^ (~b24 & b26);
606
- s[23] = b23 ^ (~b25 & b27);
607
- s[32] = b32 ^ (~b34 & b36);
608
- s[33] = b33 ^ (~b35 & b37);
609
- s[42] = b42 ^ (~b44 & b46);
610
- s[43] = b43 ^ (~b45 & b47);
611
- s[4] = b4 ^ (~b6 & b8);
612
- s[5] = b5 ^ (~b7 & b9);
613
- s[14] = b14 ^ (~b16 & b18);
614
- s[15] = b15 ^ (~b17 & b19);
615
- s[24] = b24 ^ (~b26 & b28);
616
- s[25] = b25 ^ (~b27 & b29);
617
- s[34] = b34 ^ (~b36 & b38);
618
- s[35] = b35 ^ (~b37 & b39);
619
- s[44] = b44 ^ (~b46 & b48);
620
- s[45] = b45 ^ (~b47 & b49);
621
- s[6] = b6 ^ (~b8 & b0);
622
- s[7] = b7 ^ (~b9 & b1);
623
- s[16] = b16 ^ (~b18 & b10);
624
- s[17] = b17 ^ (~b19 & b11);
625
- s[26] = b26 ^ (~b28 & b20);
626
- s[27] = b27 ^ (~b29 & b21);
627
- s[36] = b36 ^ (~b38 & b30);
628
- s[37] = b37 ^ (~b39 & b31);
629
- s[46] = b46 ^ (~b48 & b40);
630
- s[47] = b47 ^ (~b49 & b41);
631
- s[8] = b8 ^ (~b0 & b2);
632
- s[9] = b9 ^ (~b1 & b3);
633
- s[18] = b18 ^ (~b10 & b12);
634
- s[19] = b19 ^ (~b11 & b13);
635
- s[28] = b28 ^ (~b20 & b22);
636
- s[29] = b29 ^ (~b21 & b23);
637
- s[38] = b38 ^ (~b30 & b32);
638
- s[39] = b39 ^ (~b31 & b33);
639
- s[48] = b48 ^ (~b40 & b42);
640
- s[49] = b49 ^ (~b41 & b43);
641
-
642
- s[0] ^= RC[n];
643
- s[1] ^= RC[n + 1];
644
- }
645
- };
646
-
647
- if (COMMON_JS) {
648
- module.exports = methods;
649
- } else {
650
- for (i = 0; i < methodNames.length; ++i) {
651
- root[methodNames[i]] = methods[methodNames[i]];
652
- }
653
- }
654
- })();
655
- } (sha3$1));
656
-
657
- var sha3Exports = sha3$1.exports;
658
- var sha3 = /*@__PURE__*/getDefaultExportFromCjs(sha3Exports);
659
-
660
- export { sha3 as default };
@@ -1,3 +0,0 @@
1
- const version = "logger/5.8.0";
2
-
3
- export { version };