@waku/rln 0.1.6-006cd41.0 → 0.1.6-6d86b6f.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 (87) hide show
  1. package/bundle/_virtual/index2.js +1 -1
  2. package/bundle/index.js +2 -1
  3. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/checksum.js +3 -3
  4. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/cipher.js +4 -4
  5. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/class.js +7 -7
  6. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/functional.js +7 -7
  7. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/index.js +6 -6
  8. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/kdf.js +5 -5
  9. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/password.js +1 -1
  10. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1 -1
  11. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/schema-validation.js +2 -2
  12. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/types.js +1 -1
  13. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_assert.js +1 -1
  14. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_sha2.js +3 -3
  15. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_u64.js +1 -1
  16. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/cryptoBrowser.js +1 -1
  17. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/hmac.js +3 -3
  18. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/pbkdf2.js +4 -4
  19. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/scrypt.js +5 -5
  20. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/sha256.js +3 -3
  21. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/sha512.js +4 -4
  22. package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/utils.js +2 -2
  23. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +3 -3
  24. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +7 -7
  25. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +3 -3
  26. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +3 -3
  27. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +3 -3
  28. package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +7 -7
  29. package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +1 -1
  30. package/bundle/node_modules/@noble/hashes/esm/_assert.js +6 -32
  31. package/bundle/node_modules/@noble/hashes/esm/_md.js +22 -11
  32. package/bundle/node_modules/@noble/hashes/esm/_u64.js +4 -3
  33. package/bundle/{packages/rln/node_modules → node_modules}/@noble/hashes/esm/hmac.js +19 -10
  34. package/bundle/{packages/rln/node_modules/@noble/hashes/esm/sha256.js → node_modules/@noble/hashes/esm/sha2.js} +36 -50
  35. package/bundle/node_modules/@noble/hashes/esm/sha256.js +5 -102
  36. package/bundle/node_modules/@noble/hashes/esm/sha3.js +30 -24
  37. package/bundle/node_modules/@noble/hashes/esm/utils.js +69 -18
  38. package/bundle/node_modules/bn.js/lib/bn.js +1 -0
  39. package/bundle/node_modules/ethereum-cryptography/esm/sha256.js +1 -1
  40. package/bundle/node_modules/{@ethersproject/keccak256/node_modules/js-sha3 → js-sha3}/src/sha3.js +2 -2
  41. package/bundle/packages/rln/dist/contract/constants.js +1 -0
  42. package/bundle/packages/rln/dist/contract/rln_base_contract.js +127 -71
  43. package/bundle/packages/rln/dist/credentials_manager.js +3 -3
  44. package/bundle/packages/rln/dist/keystore/cipher.js +3 -3
  45. package/bundle/packages/rln/dist/keystore/keystore.js +1 -1
  46. package/dist/.tsbuildinfo +1 -1
  47. package/dist/contract/index.d.ts +1 -0
  48. package/dist/contract/index.js +1 -0
  49. package/dist/contract/index.js.map +1 -1
  50. package/dist/contract/rln_base_contract.d.ts +32 -22
  51. package/dist/contract/rln_base_contract.js +127 -71
  52. package/dist/contract/rln_base_contract.js.map +1 -1
  53. package/dist/contract/types.d.ts +5 -0
  54. package/dist/contract/types.js.map +1 -1
  55. package/dist/credentials_manager.js +1 -1
  56. package/dist/credentials_manager.js.map +1 -1
  57. package/dist/index.d.ts +2 -1
  58. package/dist/index.js +1 -0
  59. package/dist/index.js.map +1 -1
  60. package/dist/keystore/keystore.js.map +1 -1
  61. package/dist/keystore/types.d.ts +2 -2
  62. package/package.json +1 -1
  63. package/src/contract/index.ts +1 -0
  64. package/src/contract/rln_base_contract.ts +166 -102
  65. package/src/contract/types.ts +5 -0
  66. package/src/credentials_manager.ts +1 -1
  67. package/src/index.ts +3 -1
  68. package/src/keystore/keystore.ts +4 -2
  69. package/src/keystore/types.ts +2 -2
  70. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_assert.js +0 -43
  71. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_sha2.js +0 -116
  72. package/bundle/packages/rln/node_modules/@noble/hashes/esm/utils.js +0 -43
  73. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +0 -0
  74. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +0 -0
  75. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +0 -0
  76. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +0 -0
  77. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +0 -0
  78. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +0 -0
  79. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +0 -0
  80. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +0 -0
  81. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +0 -0
  82. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +0 -0
  83. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +0 -0
  84. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +0 -0
  85. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +0 -0
  86. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +0 -0
  87. /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import { getAugmentedNamespace } from './_commonjsHelpers.js';
2
- import * as index from '../packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js';
2
+ import * as index from '../node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js';
3
3
 
4
4
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(index);
5
5
 
package/bundle/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  export { RLNDecoder, RLNEncoder } from './packages/rln/dist/codec.js';
2
2
  export { RLN_ABI } from './packages/rln/dist/contract/abi.js';
3
3
  export { RLNContract } from './packages/rln/dist/contract/rln_contract.js';
4
- export { LINEA_CONTRACT } from './packages/rln/dist/contract/constants.js';
4
+ export { DEFAULT_RATE_LIMIT, LINEA_CONTRACT, RATE_LIMIT_PARAMS, RATE_LIMIT_TIERS } from './packages/rln/dist/contract/constants.js';
5
+ export { MembershipState } from './packages/rln/dist/contract/types.js';
5
6
  export { RLNBaseContract } from './packages/rln/dist/contract/rln_base_contract.js';
6
7
  export { createRLN } from './packages/rln/dist/create.js';
7
8
  export { RLNCredentialsManager } from './packages/rln/dist/credentials_manager.js';
@@ -1,8 +1,8 @@
1
- import { commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as checksum$1 } from '../../../../../../_virtual/checksum.js';
1
+ import { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
2
+ import { __exports as checksum$1 } from '../../../../_virtual/checksum.js';
3
3
  import '../node_modules/ethereum-cryptography/sha256.js';
4
4
  import { u as utilsExports } from '../node_modules/ethereum-cryptography/utils.js';
5
- import { __exports as sha256 } from '../../../../../../_virtual/sha256.js';
5
+ import { __exports as sha256 } from '../../../../_virtual/sha256.js';
6
6
 
7
7
  var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
8
8
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -1,10 +1,10 @@
1
- import { commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as cipher } from '../../../../../../_virtual/cipher.js';
1
+ import { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
2
+ import { __exports as cipher } from '../../../../_virtual/cipher.js';
3
3
  import '../node_modules/ethereum-cryptography/random.js';
4
4
  import '../node_modules/ethereum-cryptography/aes.js';
5
5
  import { u as utilsExports } from '../node_modules/ethereum-cryptography/utils.js';
6
- import { __exports as random } from '../../../../../../_virtual/random.js';
7
- import { __exports as aes } from '../../../../../../_virtual/aes.js';
6
+ import { __exports as random } from '../../../../_virtual/random.js';
7
+ import { __exports as aes } from '../../../../_virtual/aes.js';
8
8
 
9
9
  var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
10
10
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -1,15 +1,15 @@
1
- import { commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as _class } from '../../../../../../_virtual/class.js';
1
+ import { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
2
+ import { __exports as _class } from '../../../../_virtual/class.js';
3
3
  import './kdf.js';
4
4
  import './checksum.js';
5
5
  import './cipher.js';
6
6
  import './functional.js';
7
7
  import './schema-validation.js';
8
- import { __exports as kdf } from '../../../../../../_virtual/kdf.js';
9
- import { __exports as checksum } from '../../../../../../_virtual/checksum.js';
10
- import { __exports as cipher } from '../../../../../../_virtual/cipher.js';
11
- import { __exports as functional } from '../../../../../../_virtual/functional.js';
12
- import { __exports as schemaValidation } from '../../../../../../_virtual/schema-validation.js';
8
+ import { __exports as kdf } from '../../../../_virtual/kdf.js';
9
+ import { __exports as checksum } from '../../../../_virtual/checksum.js';
10
+ import { __exports as cipher } from '../../../../_virtual/cipher.js';
11
+ import { __exports as functional } from '../../../../_virtual/functional.js';
12
+ import { __exports as schemaValidation } from '../../../../_virtual/schema-validation.js';
13
13
 
14
14
  var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
15
15
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -1,15 +1,15 @@
1
- import { commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as functional } from '../../../../../../_virtual/functional.js';
3
- import require$$0 from '../../../../../../_virtual/index2.js';
1
+ import { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
2
+ import { __exports as functional } from '../../../../_virtual/functional.js';
3
+ import require$$0 from '../../../../_virtual/index2.js';
4
4
  import './kdf.js';
5
5
  import './checksum.js';
6
6
  import './cipher.js';
7
7
  import './password.js';
8
8
  import { u as utilsExports } from '../node_modules/ethereum-cryptography/utils.js';
9
- import { __exports as kdf } from '../../../../../../_virtual/kdf.js';
10
- import { __exports as checksum } from '../../../../../../_virtual/checksum.js';
11
- import { __exports as cipher } from '../../../../../../_virtual/cipher.js';
12
- import { __exports as password } from '../../../../../../_virtual/password.js';
9
+ import { __exports as kdf } from '../../../../_virtual/kdf.js';
10
+ import { __exports as checksum } from '../../../../_virtual/checksum.js';
11
+ import { __exports as cipher } from '../../../../_virtual/cipher.js';
12
+ import { __exports as password } from '../../../../_virtual/password.js';
13
13
 
14
14
  (function (exports) {
15
15
  var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -1,13 +1,13 @@
1
- import { commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as lib } from '../../../../../../_virtual/index.js';
1
+ import { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
2
+ import { __exports as lib } from '../../../../_virtual/index.js';
3
3
  import './types.js';
4
4
  import './functional.js';
5
5
  import './class.js';
6
6
  import './schema-validation.js';
7
- import { __exports as types } from '../../../../../../_virtual/types.js';
8
- import { __exports as functional } from '../../../../../../_virtual/functional.js';
9
- import { __exports as _class } from '../../../../../../_virtual/class.js';
10
- import { __exports as schemaValidation } from '../../../../../../_virtual/schema-validation.js';
7
+ import { __exports as types } from '../../../../_virtual/types.js';
8
+ import { __exports as functional } from '../../../../_virtual/functional.js';
9
+ import { __exports as _class } from '../../../../_virtual/class.js';
10
+ import { __exports as schemaValidation } from '../../../../_virtual/schema-validation.js';
11
11
 
12
12
  (function (exports) {
13
13
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -1,12 +1,12 @@
1
- import { commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as kdf$1 } from '../../../../../../_virtual/kdf.js';
1
+ import { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
2
+ import { __exports as kdf$1 } from '../../../../_virtual/kdf.js';
3
3
  import '../node_modules/ethereum-cryptography/random.js';
4
4
  import '../node_modules/ethereum-cryptography/pbkdf2.js';
5
5
  import '../node_modules/ethereum-cryptography/scrypt.js';
6
6
  import { u as utilsExports } from '../node_modules/ethereum-cryptography/utils.js';
7
- import { __exports as random } from '../../../../../../_virtual/random.js';
8
- import { __exports as pbkdf2 } from '../../../../../../_virtual/pbkdf2.js';
9
- import { __exports as scrypt } from '../../../../../../_virtual/scrypt.js';
7
+ import { __exports as random } from '../../../../_virtual/random.js';
8
+ import { __exports as pbkdf2 } from '../../../../_virtual/pbkdf2.js';
9
+ import { __exports as scrypt } from '../../../../_virtual/scrypt.js';
10
10
 
11
11
  var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
12
12
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -1,4 +1,4 @@
1
- import { __exports as password } from '../../../../../../_virtual/password.js';
1
+ import { __exports as password } from '../../../../_virtual/password.js';
2
2
  import { u as utilsExports } from '../node_modules/ethereum-cryptography/utils.js';
3
3
 
4
4
  Object.defineProperty(password, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { __exports as schemaValidationGenerated } from '../../../../../../_virtual/schema-validation-generated.js';
1
+ import { __exports as schemaValidationGenerated } from '../../../../_virtual/schema-validation-generated.js';
2
2
 
3
3
  Object.defineProperty(schemaValidationGenerated, "__esModule", { value: true });
4
4
  schemaValidationGenerated.Keystore = void 0;
@@ -1,6 +1,6 @@
1
- import { __exports as schemaValidation } from '../../../../../../_virtual/schema-validation.js';
1
+ import { __exports as schemaValidation } from '../../../../_virtual/schema-validation.js';
2
2
  import './schema-validation-generated.js';
3
- import { __exports as schemaValidationGenerated } from '../../../../../../_virtual/schema-validation-generated.js';
3
+ import { __exports as schemaValidationGenerated } from '../../../../_virtual/schema-validation-generated.js';
4
4
 
5
5
  Object.defineProperty(schemaValidation, "__esModule", { value: true });
6
6
  schemaValidation.isValidKeystore = schemaValidation.validateKeystore = schemaValidation.schemaValidationErrors = void 0;
@@ -1,4 +1,4 @@
1
- import { __exports as types } from '../../../../../../_virtual/types.js';
1
+ import { __exports as types } from '../../../../_virtual/types.js';
2
2
 
3
3
  Object.defineProperty(types, "__esModule", { value: true });
4
4
 
@@ -1,4 +1,4 @@
1
- import { __exports as _assert } from '../../../../../_virtual/_assert.js';
1
+ import { __exports as _assert } from '../../../../../../_virtual/_assert.js';
2
2
 
3
3
  Object.defineProperty(_assert, "__esModule", { value: true });
4
4
  _assert.output = _assert.exists = _assert.hash = _assert.bytes = _assert.bool = _assert.number = void 0;
@@ -1,8 +1,8 @@
1
- import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
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';
5
- import { __exports as _assert } from '../../../../../_virtual/_assert.js';
4
+ import { __exports as utils } from '../../../../../../_virtual/utils.js';
5
+ import { __exports as _assert } from '../../../../../../_virtual/_assert.js';
6
6
 
7
7
  Object.defineProperty(_sha2, "__esModule", { value: true });
8
8
  _sha2.SHA2 = void 0;
@@ -1,4 +1,4 @@
1
- import { __exports as _u64 } from '../../../../../_virtual/_u64.js';
1
+ import { __exports as _u64 } from '../../../../../../_virtual/_u64.js';
2
2
 
3
3
  (function (exports) {
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { __exports as cryptoBrowser } from '../../../../../_virtual/cryptoBrowser.js';
1
+ import { __exports as cryptoBrowser } from '../../../../../../_virtual/cryptoBrowser.js';
2
2
 
3
3
  Object.defineProperty(cryptoBrowser, "__esModule", { value: true });
4
4
  cryptoBrowser.crypto = void 0;
@@ -1,8 +1,8 @@
1
- import { __exports as hmac } from '../../../../../_virtual/hmac.js';
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';
5
- import { __exports as _assert } from '../../../../../_virtual/_assert.js';
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 });
@@ -1,10 +1,10 @@
1
- import { __exports as pbkdf2$1 } from '../../../../../_virtual/pbkdf22.js';
1
+ 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';
6
- import { __exports as _assert } from '../../../../../_virtual/_assert.js';
7
- import { __exports as hmac } from '../../../../../_virtual/hmac.js';
5
+ import { __exports as utils } from '../../../../../../_virtual/utils.js';
6
+ import { __exports as _assert } from '../../../../../../_virtual/_assert.js';
7
+ import { __exports as hmac } from '../../../../../../_virtual/hmac.js';
8
8
 
9
9
  Object.defineProperty(pbkdf2$1, "__esModule", { value: true });
10
10
  pbkdf2$1.pbkdf2Async = pbkdf2$1.pbkdf2 = void 0;
@@ -1,12 +1,12 @@
1
- import { __exports as scrypt$1 } from '../../../../../_virtual/scrypt2.js';
1
+ import { __exports as scrypt$1 } from '../../../../../../_virtual/scrypt2.js';
2
2
  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';
7
- import { __exports as _assert } from '../../../../../_virtual/_assert.js';
8
- import { __exports as pbkdf2 } from '../../../../../_virtual/pbkdf22.js';
9
- import { __exports as sha256 } from '../../../../../_virtual/sha2562.js';
6
+ import { __exports as utils } from '../../../../../../_virtual/utils.js';
7
+ import { __exports as _assert } from '../../../../../../_virtual/_assert.js';
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
12
  scrypt$1.scryptAsync = scrypt$1.scrypt = void 0;
@@ -1,8 +1,8 @@
1
- import { __exports as sha256 } from '../../../../../_virtual/sha2562.js';
1
+ import { __exports as sha256 } from '../../../../../../_virtual/sha2562.js';
2
2
  import './_sha2.js';
3
3
  import './utils.js';
4
- import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
5
- import { __exports as utils } from '../../../../../_virtual/utils.js';
4
+ import { __exports as _sha2 } from '../../../../../../_virtual/_sha2.js';
5
+ import { __exports as utils } from '../../../../../../_virtual/utils.js';
6
6
 
7
7
  Object.defineProperty(sha256, "__esModule", { value: true });
8
8
  sha256.sha224 = sha256.sha256 = void 0;
@@ -1,10 +1,10 @@
1
- import { __exports as sha512 } from '../../../../../_virtual/sha512.js';
1
+ 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 _u64 } from '../../../../../_virtual/_u64.js';
6
- import { __exports as _sha2 } from '../../../../../_virtual/_sha2.js';
7
- import { __exports as utils } from '../../../../../_virtual/utils.js';
5
+ import { __exports as _u64 } from '../../../../../../_virtual/_u64.js';
6
+ import { __exports as _sha2 } from '../../../../../../_virtual/_sha2.js';
7
+ import { __exports as utils } from '../../../../../../_virtual/utils.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,6 +1,6 @@
1
- import { __exports as utils } from '../../../../../_virtual/utils.js';
1
+ import { __exports as utils } from '../../../../../../_virtual/utils.js';
2
2
  import './cryptoBrowser.js';
3
- import { __exports as cryptoBrowser } from '../../../../../_virtual/cryptoBrowser.js';
3
+ import { __exports as cryptoBrowser } from '../../../../../../_virtual/cryptoBrowser.js';
4
4
 
5
5
  (function (exports) {
6
6
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -1,7 +1,7 @@
1
- import { __exports as aes } from '../../../../../../../_virtual/aes.js';
2
- import '../../../../@noble/hashes/cryptoBrowser.js';
1
+ import { __exports as aes } from '../../../../../_virtual/aes.js';
2
+ import '../@noble/hashes/cryptoBrowser.js';
3
3
  import { u as utilsExports } from './utils.js';
4
- import { __exports as cryptoBrowser } from '../../../../../../../_virtual/cryptoBrowser.js';
4
+ import { __exports as cryptoBrowser } from '../../../../../_virtual/cryptoBrowser.js';
5
5
 
6
6
  Object.defineProperty(aes, "__esModule", { value: true });
7
7
  aes.decrypt = aes.encrypt = void 0;
@@ -1,11 +1,11 @@
1
- import { __exports as pbkdf2$1 } from '../../../../../../../_virtual/pbkdf2.js';
2
- import '../../../../@noble/hashes/pbkdf2.js';
3
- import '../../../../@noble/hashes/sha256.js';
4
- import '../../../../@noble/hashes/sha512.js';
1
+ import { __exports as pbkdf2$1 } from '../../../../../_virtual/pbkdf2.js';
2
+ import '../@noble/hashes/pbkdf2.js';
3
+ import '../@noble/hashes/sha256.js';
4
+ import '../@noble/hashes/sha512.js';
5
5
  import { u as utilsExports } from './utils.js';
6
- import { __exports as pbkdf2$2 } from '../../../../../../../_virtual/pbkdf22.js';
7
- import { __exports as sha256 } from '../../../../../../../_virtual/sha2562.js';
8
- import { __exports as sha512 } from '../../../../../../../_virtual/sha512.js';
6
+ import { __exports as pbkdf2$2 } from '../../../../../_virtual/pbkdf22.js';
7
+ import { __exports as sha256 } from '../../../../../_virtual/sha2562.js';
8
+ import { __exports as sha512 } from '../../../../../_virtual/sha512.js';
9
9
 
10
10
  Object.defineProperty(pbkdf2$1, "__esModule", { value: true });
11
11
  pbkdf2$1.pbkdf2Sync = pbkdf2$1.pbkdf2 = void 0;
@@ -1,6 +1,6 @@
1
- import { __exports as random } from '../../../../../../../_virtual/random.js';
2
- import '../../../../@noble/hashes/utils.js';
3
- import { __exports as utils } from '../../../../../../../_virtual/utils.js';
1
+ import { __exports as random } from '../../../../../_virtual/random.js';
2
+ import '../@noble/hashes/utils.js';
3
+ import { __exports as utils } from '../../../../../_virtual/utils.js';
4
4
 
5
5
  Object.defineProperty(random, "__esModule", { value: true });
6
6
  random.getRandomBytes = random.getRandomBytesSync = void 0;
@@ -1,7 +1,7 @@
1
- import { __exports as scrypt$1 } from '../../../../../../../_virtual/scrypt.js';
2
- import '../../../../@noble/hashes/scrypt.js';
1
+ import { __exports as scrypt$1 } from '../../../../../_virtual/scrypt.js';
2
+ import '../@noble/hashes/scrypt.js';
3
3
  import { u as utilsExports } from './utils.js';
4
- import { __exports as scrypt$2 } from '../../../../../../../_virtual/scrypt2.js';
4
+ import { __exports as scrypt$2 } from '../../../../../_virtual/scrypt2.js';
5
5
 
6
6
  Object.defineProperty(scrypt$1, "__esModule", { value: true });
7
7
  scrypt$1.scryptSync = scrypt$1.scrypt = void 0;
@@ -1,7 +1,7 @@
1
- import { __exports as sha256 } from '../../../../../../../_virtual/sha256.js';
2
- import '../../../../@noble/hashes/sha256.js';
1
+ import { __exports as sha256 } from '../../../../../_virtual/sha256.js';
2
+ import '../@noble/hashes/sha256.js';
3
3
  import { u as utilsExports } from './utils.js';
4
- import { __exports as sha256$1 } from '../../../../../../../_virtual/sha2562.js';
4
+ import { __exports as sha256$1 } from '../../../../../_virtual/sha2562.js';
5
5
 
6
6
  Object.defineProperty(sha256, "__esModule", { value: true });
7
7
  sha256.sha256 = void 0;
@@ -1,10 +1,10 @@
1
- import { commonjsGlobal } from '../../../../../../../_virtual/_commonjsHelpers.js';
2
- import { commonjsRequire } from '../../../../../../../_virtual/_commonjs-dynamic-modules.js';
3
- import { __module as utils } from '../../../../../../../_virtual/utils2.js';
4
- import '../../../../@noble/hashes/_assert.js';
5
- import '../../../../@noble/hashes/utils.js';
6
- import { __exports as _assert } from '../../../../../../../_virtual/_assert.js';
7
- import { __exports as utils$1 } from '../../../../../../../_virtual/utils.js';
1
+ import { commonjsGlobal } from '../../../../../_virtual/_commonjsHelpers.js';
2
+ import { commonjsRequire } from '../../../../../_virtual/_commonjs-dynamic-modules.js';
3
+ import { __module as utils } from '../../../../../_virtual/utils2.js';
4
+ import '../@noble/hashes/_assert.js';
5
+ import '../@noble/hashes/utils.js';
6
+ import { __exports as _assert } from '../../../../../_virtual/_assert.js';
7
+ import { __exports as utils$1 } from '../../../../../_virtual/utils.js';
8
8
 
9
9
  utils.exports;
10
10
 
@@ -1,4 +1,4 @@
1
- import sha3 from '../node_modules/js-sha3/src/sha3.js';
1
+ import sha3 from '../../../js-sha3/src/sha3.js';
2
2
  import { arrayify } from '../../bytes/lib.esm/index.js';
3
3
 
4
4
  function keccak256(data) {
@@ -1,37 +1,11 @@
1
+ import { abytes as abytes$1 } from './utils.js';
2
+
1
3
  /**
2
4
  * Internal assertion helpers.
3
5
  * @module
6
+ * @deprecated
4
7
  */
5
- /** Asserts something is positive integer. */
6
- function anumber(n) {
7
- if (!Number.isSafeInteger(n) || n < 0)
8
- throw new Error('positive integer expected, got ' + n);
9
- }
10
- /** Is number an Uint8Array? Copied from utils for perf. */
11
- function isBytes(a) {
12
- return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
13
- }
14
- /** Asserts something is Uint8Array. */
15
- function abytes(b, ...lengths) {
16
- if (!isBytes(b))
17
- throw new Error('Uint8Array expected');
18
- if (lengths.length > 0 && !lengths.includes(b.length))
19
- throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
20
- }
21
- /** Asserts a hash instance has not been destroyed / finished */
22
- function aexists(instance, checkFinished = true) {
23
- if (instance.destroyed)
24
- throw new Error('Hash instance has been destroyed');
25
- if (checkFinished && instance.finished)
26
- throw new Error('Hash#digest() has already been called');
27
- }
28
- /** Asserts output is properly-sized byte array */
29
- function aoutput(out, instance) {
30
- abytes(out);
31
- const min = instance.outputLen;
32
- if (out.length < min) {
33
- throw new Error('digestInto() expects output buffer of length at least ' + min);
34
- }
35
- }
8
+ /** @deprecated Use import from `noble/hashes/utils` module */
9
+ const abytes = abytes$1;
36
10
 
37
- export { abytes, aexists, anumber, aoutput };
11
+ export { abytes };
@@ -1,5 +1,4 @@
1
- import { aexists, aoutput } from './_assert.js';
2
- import { Hash, createView, toBytes } from './utils.js';
1
+ import { Hash, createView, aexists, toBytes, abytes, aoutput, clean } from './utils.js';
3
2
 
4
3
  /**
5
4
  * Internal Merkle-Damgard hash utils.
@@ -33,21 +32,22 @@ function Maj(a, b, c) {
33
32
  class HashMD extends Hash {
34
33
  constructor(blockLen, outputLen, padOffset, isLE) {
35
34
  super();
36
- this.blockLen = blockLen;
37
- this.outputLen = outputLen;
38
- this.padOffset = padOffset;
39
- this.isLE = isLE;
40
35
  this.finished = false;
41
36
  this.length = 0;
42
37
  this.pos = 0;
43
38
  this.destroyed = false;
39
+ this.blockLen = blockLen;
40
+ this.outputLen = outputLen;
41
+ this.padOffset = padOffset;
42
+ this.isLE = isLE;
44
43
  this.buffer = new Uint8Array(blockLen);
45
44
  this.view = createView(this.buffer);
46
45
  }
47
46
  update(data) {
48
47
  aexists(this);
49
- const { view, buffer, blockLen } = this;
50
48
  data = toBytes(data);
49
+ abytes(data);
50
+ const { view, buffer, blockLen } = this;
51
51
  const len = data.length;
52
52
  for (let pos = 0; pos < len;) {
53
53
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -81,7 +81,7 @@ class HashMD extends Hash {
81
81
  let { pos } = this;
82
82
  // append the bit '1' to the message
83
83
  buffer[pos++] = 0b10000000;
84
- this.buffer.subarray(pos).fill(0);
84
+ clean(this.buffer.subarray(pos));
85
85
  // we have less than padOffset left in buffer, so we cannot put length in
86
86
  // current block, need process it and pad again
87
87
  if (this.padOffset > blockLen - pos) {
@@ -119,14 +119,25 @@ class HashMD extends Hash {
119
119
  to || (to = new this.constructor());
120
120
  to.set(...this.get());
121
121
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
122
+ to.destroyed = destroyed;
123
+ to.finished = finished;
122
124
  to.length = length;
123
125
  to.pos = pos;
124
- to.finished = finished;
125
- to.destroyed = destroyed;
126
126
  if (length % blockLen)
127
127
  to.buffer.set(buffer);
128
128
  return to;
129
129
  }
130
+ clone() {
131
+ return this._cloneInto();
132
+ }
130
133
  }
134
+ /**
135
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
136
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
137
+ */
138
+ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
139
+ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
140
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
141
+ ]);
131
142
 
132
- export { Chi, HashMD, Maj, setBigUint64 };
143
+ export { Chi, HashMD, Maj, SHA256_IV, setBigUint64 };
@@ -11,9 +11,10 @@ function fromBig(n, le = false) {
11
11
  return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
12
12
  }
13
13
  function split(lst, le = false) {
14
- let Ah = new Uint32Array(lst.length);
15
- let Al = new Uint32Array(lst.length);
16
- for (let i = 0; i < lst.length; i++) {
14
+ const len = lst.length;
15
+ let Ah = new Uint32Array(len);
16
+ let Al = new Uint32Array(len);
17
+ for (let i = 0; i < len; i++) {
17
18
  const { h, l } = fromBig(lst[i], le);
18
19
  [Ah[i], Al[i]] = [h, l];
19
20
  }
@@ -1,17 +1,19 @@
1
- import assert from './_assert.js';
2
- import { Hash, toBytes } from './utils.js';
1
+ import { Hash, ahash, toBytes, clean, aexists, abytes } from './utils.js';
3
2
 
4
- // HMAC (RFC 2104)
3
+ /**
4
+ * HMAC: RFC2104 message authentication code.
5
+ * @module
6
+ */
5
7
  class HMAC extends Hash {
6
8
  constructor(hash, _key) {
7
9
  super();
8
10
  this.finished = false;
9
11
  this.destroyed = false;
10
- assert.hash(hash);
12
+ ahash(hash);
11
13
  const key = toBytes(_key);
12
14
  this.iHash = hash.create();
13
15
  if (typeof this.iHash.update !== 'function')
14
- throw new TypeError('Expected instance of class which extends utils.Hash');
16
+ throw new Error('Expected instance of class which extends utils.Hash');
15
17
  this.blockLen = this.iHash.blockLen;
16
18
  this.outputLen = this.iHash.outputLen;
17
19
  const blockLen = this.blockLen;
@@ -27,16 +29,16 @@ class HMAC extends Hash {
27
29
  for (let i = 0; i < pad.length; i++)
28
30
  pad[i] ^= 0x36 ^ 0x5c;
29
31
  this.oHash.update(pad);
30
- pad.fill(0);
32
+ clean(pad);
31
33
  }
32
34
  update(buf) {
33
- assert.exists(this);
35
+ aexists(this);
34
36
  this.iHash.update(buf);
35
37
  return this;
36
38
  }
37
39
  digestInto(out) {
38
- assert.exists(this);
39
- assert.bytes(out, this.outputLen);
40
+ aexists(this);
41
+ abytes(out, this.outputLen);
40
42
  this.finished = true;
41
43
  this.iHash.digestInto(out);
42
44
  this.oHash.update(out);
@@ -61,6 +63,9 @@ class HMAC extends Hash {
61
63
  to.iHash = iHash._cloneInto(to.iHash);
62
64
  return to;
63
65
  }
66
+ clone() {
67
+ return this._cloneInto();
68
+ }
64
69
  destroy() {
65
70
  this.destroyed = true;
66
71
  this.oHash.destroy();
@@ -72,8 +77,12 @@ class HMAC extends Hash {
72
77
  * @param hash - function that would be used e.g. sha256
73
78
  * @param key - message key
74
79
  * @param message - message data
80
+ * @example
81
+ * import { hmac } from '@noble/hashes/hmac';
82
+ * import { sha256 } from '@noble/hashes/sha2';
83
+ * const mac1 = hmac(sha256, 'key', 'message');
75
84
  */
76
85
  const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
77
86
  hmac.create = (hash, key) => new HMAC(hash, key);
78
87
 
79
- export { hmac };
88
+ export { HMAC, hmac };