@byline/admin 2.4.0 → 2.4.1

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 (177) hide show
  1. package/dist/abilities.js +5 -24
  2. package/dist/index.js +8 -30
  3. package/dist/lib/assert-admin-actor.js +13 -74
  4. package/dist/lib/create-command.js +6 -16
  5. package/dist/modules/admin-account/commands.js +35 -24
  6. package/dist/modules/admin-account/components/change-password.d.ts +8 -0
  7. package/dist/modules/admin-account/components/change-password.js +192 -0
  8. package/dist/modules/admin-account/components/change-password.module.js +8 -0
  9. package/dist/modules/admin-account/components/change-password_module.css +27 -0
  10. package/dist/modules/admin-account/components/container.d.ts +29 -0
  11. package/dist/modules/admin-account/components/container.js +298 -0
  12. package/dist/modules/admin-account/components/container.module.js +28 -0
  13. package/dist/modules/admin-account/components/container_module.css +106 -0
  14. package/dist/modules/admin-account/components/update.d.ts +8 -0
  15. package/dist/modules/admin-account/components/update.js +207 -0
  16. package/dist/modules/admin-account/components/update.module.js +8 -0
  17. package/dist/modules/admin-account/components/update_module.css +27 -0
  18. package/dist/modules/admin-account/errors.js +14 -45
  19. package/dist/modules/admin-account/index.js +4 -34
  20. package/dist/modules/admin-account/schemas.js +25 -59
  21. package/dist/modules/admin-account/service.js +56 -61
  22. package/dist/modules/admin-permissions/abilities.js +6 -24
  23. package/dist/modules/admin-permissions/commands.js +42 -28
  24. package/dist/modules/admin-permissions/components/inspector.d.ts +4 -0
  25. package/dist/modules/admin-permissions/components/inspector.js +284 -0
  26. package/dist/modules/admin-permissions/components/inspector.module.js +56 -0
  27. package/dist/modules/admin-permissions/components/inspector_module.css +238 -0
  28. package/dist/modules/admin-permissions/dto.js +3 -16
  29. package/dist/modules/admin-permissions/errors.js +14 -27
  30. package/dist/modules/admin-permissions/index.js +6 -26
  31. package/dist/modules/admin-permissions/repository.js +1 -8
  32. package/dist/modules/admin-permissions/schemas.js +33 -70
  33. package/dist/modules/admin-permissions/service.js +88 -92
  34. package/dist/modules/admin-roles/abilities.js +8 -30
  35. package/dist/modules/admin-roles/commands.js +89 -55
  36. package/dist/modules/admin-roles/components/create.d.ts +7 -0
  37. package/dist/modules/admin-roles/components/create.js +177 -0
  38. package/dist/modules/admin-roles/components/create.module.js +8 -0
  39. package/dist/modules/admin-roles/components/create_module.css +27 -0
  40. package/dist/modules/admin-roles/components/permissions.d.ts +10 -0
  41. package/dist/modules/admin-roles/components/permissions.js +303 -0
  42. package/dist/modules/admin-roles/components/permissions.module.js +44 -0
  43. package/dist/modules/admin-roles/components/permissions_module.css +192 -0
  44. package/dist/modules/admin-roles/components/update.d.ts +8 -0
  45. package/dist/modules/admin-roles/components/update.js +166 -0
  46. package/dist/modules/admin-roles/components/update.module.js +8 -0
  47. package/dist/modules/admin-roles/components/update_module.css +27 -0
  48. package/dist/modules/admin-roles/dto.js +3 -16
  49. package/dist/modules/admin-roles/errors.js +16 -40
  50. package/dist/modules/admin-roles/index.js +6 -26
  51. package/dist/modules/admin-roles/repository.js +1 -8
  52. package/dist/modules/admin-roles/schemas.js +41 -71
  53. package/dist/modules/admin-roles/service.js +79 -82
  54. package/dist/modules/admin-users/abilities.js +9 -38
  55. package/dist/modules/admin-users/commands.js +92 -50
  56. package/dist/modules/admin-users/components/create.d.ts +8 -0
  57. package/dist/modules/admin-users/components/create.js +268 -0
  58. package/dist/modules/admin-users/components/create.module.js +10 -0
  59. package/dist/modules/admin-users/components/create_module.css +45 -0
  60. package/dist/modules/admin-users/components/roles.d.ts +11 -0
  61. package/dist/modules/admin-users/components/roles.js +148 -0
  62. package/dist/modules/admin-users/components/roles.module.js +18 -0
  63. package/dist/modules/admin-users/components/roles_module.css +75 -0
  64. package/dist/modules/admin-users/components/set-password.d.ts +8 -0
  65. package/dist/modules/admin-users/components/set-password.js +170 -0
  66. package/dist/modules/admin-users/components/set-password.module.js +9 -0
  67. package/dist/modules/admin-users/components/set-password_module.css +31 -0
  68. package/dist/modules/admin-users/components/update.d.ts +8 -0
  69. package/dist/modules/admin-users/components/update.js +254 -0
  70. package/dist/modules/admin-users/components/update.module.js +9 -0
  71. package/dist/modules/admin-users/components/update_module.css +34 -0
  72. package/dist/modules/admin-users/dto.js +3 -18
  73. package/dist/modules/admin-users/errors.js +17 -43
  74. package/dist/modules/admin-users/index.js +7 -27
  75. package/dist/modules/admin-users/repository.js +1 -8
  76. package/dist/modules/admin-users/schemas.js +44 -75
  77. package/dist/modules/admin-users/seed-super-admin.js +9 -34
  78. package/dist/modules/admin-users/service.js +76 -91
  79. package/dist/modules/auth/components/sign-in-form.d.ts +12 -0
  80. package/dist/modules/auth/components/sign-in-form.js +115 -0
  81. package/dist/modules/auth/components/sign-in-form.module.js +12 -0
  82. package/dist/modules/auth/components/sign-in-form_module.css +41 -0
  83. package/dist/modules/auth/index.js +3 -24
  84. package/dist/modules/auth/jwt-session-provider.js +179 -149
  85. package/dist/modules/auth/password.js +11 -53
  86. package/dist/modules/auth/phc.js +21 -54
  87. package/dist/modules/auth/refresh-tokens-repository.js +1 -8
  88. package/dist/modules/auth/resolve-actor.js +6 -28
  89. package/dist/services/admin-services-context.d.ts +16 -0
  90. package/dist/services/admin-services-context.js +13 -0
  91. package/dist/services/admin-services-types.d.ts +129 -0
  92. package/dist/services/admin-services-types.js +1 -0
  93. package/dist/store.js +1 -8
  94. package/dist/vendor/noble-argon2/_blake.js +277 -45
  95. package/dist/vendor/noble-argon2/_md.js +81 -136
  96. package/dist/vendor/noble-argon2/_u64.js +65 -67
  97. package/dist/vendor/noble-argon2/argon2.js +181 -342
  98. package/dist/vendor/noble-argon2/blake2.js +252 -327
  99. package/dist/vendor/noble-argon2/utils.js +110 -490
  100. package/dist/vendor/noble-argon2/utils.js.LICENSE.txt +1 -0
  101. package/package.json +89 -10
  102. package/src/abilities.ts +32 -0
  103. package/src/declarations.d.ts +4 -0
  104. package/src/index.ts +39 -0
  105. package/src/lib/assert-admin-actor.ts +90 -0
  106. package/src/lib/create-command.ts +109 -0
  107. package/src/modules/admin-account/commands.ts +76 -0
  108. package/src/modules/admin-account/components/change-password.module.css +40 -0
  109. package/src/modules/admin-account/components/change-password.tsx +232 -0
  110. package/src/modules/admin-account/components/container.module.css +158 -0
  111. package/src/modules/admin-account/components/container.tsx +229 -0
  112. package/src/modules/admin-account/components/update.module.css +40 -0
  113. package/src/modules/admin-account/components/update.tsx +263 -0
  114. package/src/modules/admin-account/errors.ts +75 -0
  115. package/src/modules/admin-account/index.ts +60 -0
  116. package/src/modules/admin-account/schemas.ts +84 -0
  117. package/src/modules/admin-account/service.ts +92 -0
  118. package/src/modules/admin-permissions/abilities.ts +46 -0
  119. package/src/modules/admin-permissions/commands.ts +103 -0
  120. package/src/modules/admin-permissions/components/inspector.module.css +326 -0
  121. package/src/modules/admin-permissions/components/inspector.tsx +298 -0
  122. package/src/modules/admin-permissions/dto.ts +28 -0
  123. package/src/modules/admin-permissions/errors.ts +57 -0
  124. package/src/modules/admin-permissions/index.ts +72 -0
  125. package/src/modules/admin-permissions/repository.ts +49 -0
  126. package/src/modules/admin-permissions/schemas.ts +128 -0
  127. package/src/modules/admin-permissions/service.ts +137 -0
  128. package/src/modules/admin-roles/abilities.ts +62 -0
  129. package/src/modules/admin-roles/commands.ts +161 -0
  130. package/src/modules/admin-roles/components/create.module.css +40 -0
  131. package/src/modules/admin-roles/components/create.tsx +218 -0
  132. package/src/modules/admin-roles/components/permissions.module.css +279 -0
  133. package/src/modules/admin-roles/components/permissions.tsx +396 -0
  134. package/src/modules/admin-roles/components/update.module.css +40 -0
  135. package/src/modules/admin-roles/components/update.tsx +218 -0
  136. package/src/modules/admin-roles/dto.ts +30 -0
  137. package/src/modules/admin-roles/errors.ts +76 -0
  138. package/src/modules/admin-roles/index.ts +81 -0
  139. package/src/modules/admin-roles/repository.ts +96 -0
  140. package/src/modules/admin-roles/schemas.ts +139 -0
  141. package/src/modules/admin-roles/service.ts +136 -0
  142. package/src/modules/admin-users/abilities.ts +76 -0
  143. package/src/modules/admin-users/commands.ts +157 -0
  144. package/src/modules/admin-users/components/create.module.css +63 -0
  145. package/src/modules/admin-users/components/create.tsx +323 -0
  146. package/src/modules/admin-users/components/roles.module.css +119 -0
  147. package/src/modules/admin-users/components/roles.tsx +172 -0
  148. package/src/modules/admin-users/components/set-password.module.css +46 -0
  149. package/src/modules/admin-users/components/set-password.tsx +199 -0
  150. package/src/modules/admin-users/components/update.module.css +49 -0
  151. package/src/modules/admin-users/components/update.tsx +328 -0
  152. package/src/modules/admin-users/dto.ts +39 -0
  153. package/src/modules/admin-users/errors.ts +84 -0
  154. package/src/modules/admin-users/index.ts +91 -0
  155. package/src/modules/admin-users/repository.ts +161 -0
  156. package/src/modules/admin-users/schemas.ts +168 -0
  157. package/src/modules/admin-users/seed-super-admin.ts +102 -0
  158. package/src/modules/admin-users/service.ts +166 -0
  159. package/src/modules/auth/components/sign-in-form.module.css +62 -0
  160. package/src/modules/auth/components/sign-in-form.tsx +132 -0
  161. package/src/modules/auth/index.ts +31 -0
  162. package/src/modules/auth/jwt-session-provider.ts +301 -0
  163. package/src/modules/auth/password.ts +94 -0
  164. package/src/modules/auth/phc.ts +121 -0
  165. package/src/modules/auth/refresh-tokens-repository.ts +74 -0
  166. package/src/modules/auth/resolve-actor.ts +42 -0
  167. package/src/services/admin-services-context.tsx +52 -0
  168. package/src/services/admin-services-types.ts +177 -0
  169. package/src/store.ts +32 -0
  170. package/src/vendor/noble-argon2/LICENSE +21 -0
  171. package/src/vendor/noble-argon2/README.md +87 -0
  172. package/src/vendor/noble-argon2/_blake.ts +58 -0
  173. package/src/vendor/noble-argon2/_md.ts +223 -0
  174. package/src/vendor/noble-argon2/_u64.ts +118 -0
  175. package/src/vendor/noble-argon2/argon2.ts +668 -0
  176. package/src/vendor/noble-argon2/blake2.ts +583 -0
  177. package/src/vendor/noble-argon2/utils.ts +849 -0
@@ -1,118 +1,105 @@
1
- // @ts-nocheck vendored from noble-hashes; see ./README.md
2
- /**
3
- * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions.
4
- * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
5
- * @module
6
- */
7
- import { BSIGMA, G1s, G2s } from './_blake.js';
8
- import { SHA256_IV } from './_md.js';
9
- import * as u64 from './_u64.js';
10
- // prettier-ignore
11
- import { abytes, aexists, anumber, aoutput, clean, createHasher, swap32IfBE, swap8IfBE, u32 } from './utils.js';
12
- // Same IV words as `SHA512_IV`, but endian-swapped into LE u32 low/high halves
13
- // for the BLAKE2b u64 helpers below.
1
+ import { BSIGMA, G1s, G2s } from "./_blake.js";
2
+ import { SHA256_IV } from "./_md.js";
3
+ import { abytes, aexists, anumber, aoutput, clean, createHasher, swap32IfBE, swap8IfBE, u32 } from "./utils.js";
4
+ import * as __rspack_external__u64_js_3c1fe104 from "./_u64.js";
14
5
  const B2B_IV = /* @__PURE__ */ Uint32Array.from([
15
- 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
16
- 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
6
+ 0xf3bcc908,
7
+ 0x6a09e667,
8
+ 0x84caa73b,
9
+ 0xbb67ae85,
10
+ 0xfe94f82b,
11
+ 0x3c6ef372,
12
+ 0x5f1d36f1,
13
+ 0xa54ff53a,
14
+ 0xade682d1,
15
+ 0x510e527f,
16
+ 0x2b3e6c1f,
17
+ 0x9b05688c,
18
+ 0xfb41bd6b,
19
+ 0x1f83d9ab,
20
+ 0x137e2179,
21
+ 0x5be0cd19
17
22
  ]);
18
- // Shared synchronous BLAKE2b work vector as LE u32 low/high halves.
19
23
  const BBUF = /* @__PURE__ */ new Uint32Array(32);
20
- // BLAKE2b G mix split into two half-rounds over LE u32 low/high limbs.
21
24
  function G1b(a, b, c, d, msg, x) {
22
- // NOTE: V is LE here
23
- const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
24
- let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
25
- let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
26
- let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
27
- let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
28
- // v[a] = (v[a] + v[b] + x) | 0;
29
- let ll = u64.add3L(Al, Bl, Xl);
30
- Ah = u64.add3H(ll, Ah, Bh, Xh);
31
- Al = ll | 0;
32
- // v[d] = rotr(v[d] ^ v[a], 32)
33
- ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
34
- ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
35
- // v[c] = (v[c] + v[d]) | 0;
36
- ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
37
- // v[b] = rotr(v[b] ^ v[c], 24)
38
- ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
39
- ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) });
40
- ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
41
- ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
42
- ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
43
- ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
25
+ const Xl = msg[x], Xh = msg[x + 1];
26
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
27
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
28
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
29
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
30
+ let ll = __rspack_external__u64_js_3c1fe104.add3L(Al, Bl, Xl);
31
+ Ah = __rspack_external__u64_js_3c1fe104.add3H(ll, Ah, Bh, Xh);
32
+ Al = 0 | ll;
33
+ ({ Dh, Dl } = {
34
+ Dh: Dh ^ Ah,
35
+ Dl: Dl ^ Al
36
+ });
37
+ ({ Dh, Dl } = {
38
+ Dh: __rspack_external__u64_js_3c1fe104.rotr32H(Dh, Dl),
39
+ Dl: __rspack_external__u64_js_3c1fe104.rotr32L(Dh, Dl)
40
+ });
41
+ ({ h: Ch, l: Cl } = __rspack_external__u64_js_3c1fe104.add(Ch, Cl, Dh, Dl));
42
+ ({ Bh, Bl } = {
43
+ Bh: Bh ^ Ch,
44
+ Bl: Bl ^ Cl
45
+ });
46
+ ({ Bh, Bl } = {
47
+ Bh: __rspack_external__u64_js_3c1fe104.rotrSH(Bh, Bl, 24),
48
+ Bl: __rspack_external__u64_js_3c1fe104.rotrSL(Bh, Bl, 24)
49
+ });
50
+ BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
51
+ BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
52
+ BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
53
+ BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
44
54
  }
45
- // Second half-round of the same LE-limb BLAKE2b G mix; `x` is the message word offset.
46
55
  function G2b(a, b, c, d, msg, x) {
47
- // NOTE: V is LE here
48
- const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
49
- let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
50
- let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
51
- let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
52
- let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
53
- // v[a] = (v[a] + v[b] + x) | 0;
54
- let ll = u64.add3L(Al, Bl, Xl);
55
- Ah = u64.add3H(ll, Ah, Bh, Xh);
56
- Al = ll | 0;
57
- // v[d] = rotr(v[d] ^ v[a], 16)
58
- ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
59
- ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
60
- // v[c] = (v[c] + v[d]) | 0;
61
- ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
62
- // v[b] = rotr(v[b] ^ v[c], 63)
63
- ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
64
- ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) });
65
- ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
66
- ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
67
- ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
68
- ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
56
+ const Xl = msg[x], Xh = msg[x + 1];
57
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
58
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
59
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
60
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
61
+ let ll = __rspack_external__u64_js_3c1fe104.add3L(Al, Bl, Xl);
62
+ Ah = __rspack_external__u64_js_3c1fe104.add3H(ll, Ah, Bh, Xh);
63
+ Al = 0 | ll;
64
+ ({ Dh, Dl } = {
65
+ Dh: Dh ^ Ah,
66
+ Dl: Dl ^ Al
67
+ });
68
+ ({ Dh, Dl } = {
69
+ Dh: __rspack_external__u64_js_3c1fe104.rotrSH(Dh, Dl, 16),
70
+ Dl: __rspack_external__u64_js_3c1fe104.rotrSL(Dh, Dl, 16)
71
+ });
72
+ ({ h: Ch, l: Cl } = __rspack_external__u64_js_3c1fe104.add(Ch, Cl, Dh, Dl));
73
+ ({ Bh, Bl } = {
74
+ Bh: Bh ^ Ch,
75
+ Bl: Bl ^ Cl
76
+ });
77
+ ({ Bh, Bl } = {
78
+ Bh: __rspack_external__u64_js_3c1fe104.rotrBH(Bh, Bl, 63),
79
+ Bl: __rspack_external__u64_js_3c1fe104.rotrBL(Bh, Bl, 63)
80
+ });
81
+ BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
82
+ BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
83
+ BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
84
+ BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
69
85
  }
70
86
  function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
71
87
  anumber(keyLen);
72
- // RFC 7693 §2.1 requires digest length nn in 1..keyLen.
73
- if (outputLen <= 0 || outputLen > keyLen)
74
- throw new Error('outputLen bigger than keyLen');
88
+ if (outputLen <= 0 || outputLen > keyLen) throw new Error('outputLen bigger than keyLen');
75
89
  const { key, salt, personalization } = opts;
76
- // This API uses `undefined` for the RFC 7693 `kk = 0` case, so a provided key must be non-empty.
77
- if (key !== undefined && (key.length < 1 || key.length > keyLen))
78
- throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
79
- if (salt !== undefined)
80
- abytes(salt, saltLen, 'salt');
81
- if (personalization !== undefined)
82
- abytes(personalization, persLen, 'personalization');
90
+ if (void 0 !== key && (key.length < 1 || key.length > keyLen)) throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
91
+ if (void 0 !== salt) abytes(salt, saltLen, 'salt');
92
+ if (void 0 !== personalization) abytes(personalization, persLen, 'personalization');
83
93
  }
84
- /** Internal base class for BLAKE2. */
85
- export class _BLAKE2 {
86
- buffer;
87
- buffer32;
88
- finished = false;
89
- destroyed = false;
90
- length = 0;
91
- pos = 0;
92
- blockLen;
93
- outputLen;
94
- canXOF = false;
95
- constructor(blockLen, outputLen) {
96
- anumber(blockLen);
97
- anumber(outputLen);
98
- this.blockLen = blockLen;
99
- this.outputLen = outputLen;
100
- this.buffer = new Uint8Array(blockLen);
101
- this.buffer32 = u32(this.buffer);
102
- }
94
+ class _BLAKE2 {
103
95
  update(data) {
104
96
  aexists(this);
105
97
  abytes(data);
106
- // Main difference with other hashes: there is flag for last block,
107
- // so we cannot process current block before we know that there
108
- // is the next one. This significantly complicates logic and reduces ability
109
- // to do zero-copy processing
110
98
  const { blockLen, buffer, buffer32 } = this;
111
99
  const len = data.length;
112
100
  const offset = data.byteOffset;
113
101
  const buf = data.buffer;
114
- for (let pos = 0; pos < len;) {
115
- // If buffer is full and we still have input (don't process last block, same as blake2s)
102
+ for(let pos = 0; pos < len;){
116
103
  if (this.pos === blockLen) {
117
104
  swap32IfBE(buffer32);
118
105
  this.compress(buffer32, 0, false);
@@ -121,11 +108,10 @@ export class _BLAKE2 {
121
108
  }
122
109
  const take = Math.min(blockLen - this.pos, len - pos);
123
110
  const dataOffset = offset + pos;
124
- // Zero-copy only for full, 4-byte-aligned, non-final blocks.
125
111
  if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
126
112
  const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
127
113
  swap32IfBE(data32);
128
- for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
114
+ for(let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen){
129
115
  this.length += blockLen;
130
116
  this.compress(data32, pos32, false);
131
117
  }
@@ -144,148 +130,112 @@ export class _BLAKE2 {
144
130
  aoutput(out, this);
145
131
  const { pos, buffer32 } = this;
146
132
  this.finished = true;
147
- // Padding
148
133
  clean(this.buffer.subarray(pos));
149
134
  swap32IfBE(buffer32);
150
135
  this.compress(buffer32, 0, true);
151
136
  swap32IfBE(buffer32);
152
- // Reject unaligned views explicitly instead of hiding them behind a full scratch copy.
153
- if (out.byteOffset & 3)
154
- throw new RangeError('"digestInto() output" expected 4-byte aligned byteOffset, got ' + out.byteOffset);
137
+ if (3 & out.byteOffset) throw new RangeError('"digestInto() output" expected 4-byte aligned byteOffset, got ' + out.byteOffset);
155
138
  const state = this.get();
156
139
  const out32 = u32(out);
157
140
  const full = Math.floor(this.outputLen / 4);
158
- for (let i = 0; i < full; i++)
159
- out32[i] = swap8IfBE(state[i]);
141
+ for(let i = 0; i < full; i++)out32[i] = swap8IfBE(state[i]);
160
142
  const tail = this.outputLen % 4;
161
- if (!tail)
162
- return;
163
- const off = full * 4;
143
+ if (!tail) return;
144
+ const off = 4 * full;
164
145
  const word = state[full];
165
- for (let i = 0; i < tail; i++)
166
- out[off + i] = word >>> (8 * i);
146
+ for(let i = 0; i < tail; i++)out[off + i] = word >>> 8 * i;
167
147
  }
168
148
  digest() {
169
149
  const { buffer, outputLen } = this;
170
150
  this.digestInto(buffer);
171
- // Return a copy so callers do not alias the instance scratch buffer used during finalization.
172
151
  const res = buffer.slice(0, outputLen);
173
152
  this.destroy();
174
153
  return res;
175
154
  }
176
155
  _cloneInto(to) {
177
156
  const { buffer, length, finished, destroyed, outputLen, pos } = this;
178
- // Recreate only `dkLen`; key/salt/personalization are already absorbed into the copied state.
179
- to ||= new this.constructor({ dkLen: outputLen });
157
+ to ||= new this.constructor({
158
+ dkLen: outputLen
159
+ });
180
160
  to.set(...this.get());
181
161
  to.buffer.set(buffer);
182
162
  to.destroyed = destroyed;
183
163
  to.finished = finished;
184
164
  to.length = length;
185
165
  to.pos = pos;
186
- // @ts-ignore
187
166
  to.outputLen = outputLen;
188
167
  return to;
189
168
  }
190
169
  clone() {
191
170
  return this._cloneInto();
192
171
  }
193
- }
194
- /** Internal blake2b hash class with state stored as LE u32 low/high halves. */
195
- export class _BLAKE2b extends _BLAKE2 {
196
- // Same IV words as SHA-512 / BLAKE2b, encoded as LE u32 low/high halves.
197
- v0l = B2B_IV[0] | 0;
198
- v0h = B2B_IV[1] | 0;
199
- v1l = B2B_IV[2] | 0;
200
- v1h = B2B_IV[3] | 0;
201
- v2l = B2B_IV[4] | 0;
202
- v2h = B2B_IV[5] | 0;
203
- v3l = B2B_IV[6] | 0;
204
- v3h = B2B_IV[7] | 0;
205
- v4l = B2B_IV[8] | 0;
206
- v4h = B2B_IV[9] | 0;
207
- v5l = B2B_IV[10] | 0;
208
- v5h = B2B_IV[11] | 0;
209
- v6l = B2B_IV[12] | 0;
210
- v6h = B2B_IV[13] | 0;
211
- v7l = B2B_IV[14] | 0;
212
- v7h = B2B_IV[15] | 0;
213
- constructor(opts = {}) {
214
- const olen = opts.dkLen === undefined ? 64 : opts.dkLen;
215
- super(128, olen);
216
- checkBlake2Opts(olen, opts, 64, 16, 16);
217
- let { key, personalization, salt } = opts;
218
- let keyLength = 0;
219
- if (key !== undefined) {
220
- abytes(key, undefined, 'key');
221
- keyLength = key.length;
222
- }
223
- // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` into the low 32 bits of `h[0]`;
224
- // the high 32 bits stay at `IV[0]`.
225
- this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
226
- if (salt !== undefined) {
227
- abytes(salt, undefined, 'salt');
228
- const slt = u32(salt);
229
- this.v4l ^= swap8IfBE(slt[0]);
230
- this.v4h ^= swap8IfBE(slt[1]);
231
- this.v5l ^= swap8IfBE(slt[2]);
232
- this.v5h ^= swap8IfBE(slt[3]);
233
- }
234
- if (personalization !== undefined) {
235
- abytes(personalization, undefined, 'personalization');
236
- const pers = u32(personalization);
237
- this.v6l ^= swap8IfBE(pers[0]);
238
- this.v6h ^= swap8IfBE(pers[1]);
239
- this.v7l ^= swap8IfBE(pers[2]);
240
- this.v7h ^= swap8IfBE(pers[3]);
241
- }
242
- if (key !== undefined) {
243
- // Pad to blockLen and update
244
- const tmp = new Uint8Array(this.blockLen);
245
- tmp.set(key);
246
- this.update(tmp);
247
- }
172
+ constructor(blockLen, outputLen){
173
+ this.finished = false;
174
+ this.destroyed = false;
175
+ this.length = 0;
176
+ this.pos = 0;
177
+ this.canXOF = false;
178
+ anumber(blockLen);
179
+ anumber(outputLen);
180
+ this.blockLen = blockLen;
181
+ this.outputLen = outputLen;
182
+ this.buffer = new Uint8Array(blockLen);
183
+ this.buffer32 = u32(this.buffer);
248
184
  }
249
- // prettier-ignore
185
+ }
186
+ class _BLAKE2b extends _BLAKE2 {
250
187
  get() {
251
188
  let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
252
- return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
189
+ return [
190
+ v0l,
191
+ v0h,
192
+ v1l,
193
+ v1h,
194
+ v2l,
195
+ v2h,
196
+ v3l,
197
+ v3h,
198
+ v4l,
199
+ v4h,
200
+ v5l,
201
+ v5h,
202
+ v6l,
203
+ v6h,
204
+ v7l,
205
+ v7h
206
+ ];
253
207
  }
254
- // prettier-ignore
255
208
  set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
256
- this.v0l = v0l | 0;
257
- this.v0h = v0h | 0;
258
- this.v1l = v1l | 0;
259
- this.v1h = v1h | 0;
260
- this.v2l = v2l | 0;
261
- this.v2h = v2h | 0;
262
- this.v3l = v3l | 0;
263
- this.v3h = v3h | 0;
264
- this.v4l = v4l | 0;
265
- this.v4h = v4h | 0;
266
- this.v5l = v5l | 0;
267
- this.v5h = v5h | 0;
268
- this.v6l = v6l | 0;
269
- this.v6h = v6h | 0;
270
- this.v7l = v7l | 0;
271
- this.v7h = v7h | 0;
209
+ this.v0l = 0 | v0l;
210
+ this.v0h = 0 | v0h;
211
+ this.v1l = 0 | v1l;
212
+ this.v1h = 0 | v1h;
213
+ this.v2l = 0 | v2l;
214
+ this.v2h = 0 | v2h;
215
+ this.v3l = 0 | v3l;
216
+ this.v3h = 0 | v3h;
217
+ this.v4l = 0 | v4l;
218
+ this.v4h = 0 | v4h;
219
+ this.v5l = 0 | v5l;
220
+ this.v5h = 0 | v5h;
221
+ this.v6l = 0 | v6l;
222
+ this.v6h = 0 | v6h;
223
+ this.v7l = 0 | v7l;
224
+ this.v7h = 0 | v7h;
272
225
  }
273
226
  compress(msg, offset, isLast) {
274
- this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
275
- BBUF.set(B2B_IV, 16); // Second half from IV.
276
- let { h, l } = u64.fromBig(BigInt(this.length));
277
- BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset.
278
- BBUF[25] = B2B_IV[9] ^ h; // High word.
279
- // Invert all bits for last block
227
+ this.get().forEach((v, i)=>BBUF[i] = v);
228
+ BBUF.set(B2B_IV, 16);
229
+ let { h, l } = __rspack_external__u64_js_3c1fe104.fromBig(BigInt(this.length));
230
+ BBUF[24] = B2B_IV[8] ^ l;
231
+ BBUF[25] = B2B_IV[9] ^ h;
280
232
  if (isLast) {
281
233
  BBUF[28] = ~BBUF[28];
282
234
  BBUF[29] = ~BBUF[29];
283
235
  }
284
236
  let j = 0;
285
237
  const s = BSIGMA;
286
- // SIGMA selects 64-bit message words; multiply by 2 because `msg` stores
287
- // each word as [low32, high32].
288
- for (let i = 0; i < 12; i++) {
238
+ for(let i = 0; i < 12; i++){
289
239
  G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
290
240
  G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
291
241
  G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
@@ -326,65 +276,44 @@ export class _BLAKE2b extends _BLAKE2 {
326
276
  clean(this.buffer32);
327
277
  this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
328
278
  }
279
+ constructor(opts = {}){
280
+ const olen = void 0 === opts.dkLen ? 64 : opts.dkLen;
281
+ super(128, olen), this.v0l = 0 | B2B_IV[0], this.v0h = 0 | B2B_IV[1], this.v1l = 0 | B2B_IV[2], this.v1h = 0 | B2B_IV[3], this.v2l = 0 | B2B_IV[4], this.v2h = 0 | B2B_IV[5], this.v3l = 0 | B2B_IV[6], this.v3h = 0 | B2B_IV[7], this.v4l = 0 | B2B_IV[8], this.v4h = 0 | B2B_IV[9], this.v5l = 0 | B2B_IV[10], this.v5h = 0 | B2B_IV[11], this.v6l = 0 | B2B_IV[12], this.v6h = 0 | B2B_IV[13], this.v7l = 0 | B2B_IV[14], this.v7h = 0 | B2B_IV[15];
282
+ checkBlake2Opts(olen, opts, 64, 16, 16);
283
+ let { key, personalization, salt } = opts;
284
+ let keyLength = 0;
285
+ if (void 0 !== key) {
286
+ abytes(key, void 0, 'key');
287
+ keyLength = key.length;
288
+ }
289
+ this.v0l ^= this.outputLen | keyLength << 8 | 16842752;
290
+ if (void 0 !== salt) {
291
+ abytes(salt, void 0, 'salt');
292
+ const slt = u32(salt);
293
+ this.v4l ^= swap8IfBE(slt[0]);
294
+ this.v4h ^= swap8IfBE(slt[1]);
295
+ this.v5l ^= swap8IfBE(slt[2]);
296
+ this.v5h ^= swap8IfBE(slt[3]);
297
+ }
298
+ if (void 0 !== personalization) {
299
+ abytes(personalization, void 0, 'personalization');
300
+ const pers = u32(personalization);
301
+ this.v6l ^= swap8IfBE(pers[0]);
302
+ this.v6h ^= swap8IfBE(pers[1]);
303
+ this.v7l ^= swap8IfBE(pers[2]);
304
+ this.v7h ^= swap8IfBE(pers[3]);
305
+ }
306
+ if (void 0 !== key) {
307
+ const tmp = new Uint8Array(this.blockLen);
308
+ tmp.set(key);
309
+ this.update(tmp);
310
+ }
311
+ }
329
312
  }
330
- /**
331
- * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
332
- * @param msg - message that would be hashed
333
- * @param opts - Optional output, MAC, salt, and personalization settings.
334
- * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present,
335
- * must be 16 bytes each. See {@link Blake2Opts}.
336
- * @returns Digest bytes.
337
- * @example
338
- * Hash a message with Blake2b.
339
- * ```ts
340
- * blake2b(new Uint8Array([97, 98, 99]));
341
- * ```
342
- */
343
- export const blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
344
- /**
345
- * BLAKE2-compress core method.
346
- * Runs only the round function over a caller-supplied local vector; callers initialize `v0..v15`
347
- * and apply the final `h[i] ^= v[i] ^ v[i + 8]` fold themselves.
348
- * @param s - flattened sigma schedule bytes
349
- * @param offset - starting word offset inside `msg`, not a byte offset
350
- * @param msg - message words
351
- * @param rounds - round count to execute
352
- * @param v0 - state word 0
353
- * @param v1 - state word 1
354
- * @param v2 - state word 2
355
- * @param v3 - state word 3
356
- * @param v4 - state word 4
357
- * @param v5 - state word 5
358
- * @param v6 - state word 6
359
- * @param v7 - state word 7
360
- * @param v8 - state word 8
361
- * @param v9 - state word 9
362
- * @param v10 - state word 10
363
- * @param v11 - state word 11
364
- * @param v12 - state word 12
365
- * @param v13 - state word 13
366
- * @param v14 - state word 14
367
- * @param v15 - state word 15
368
- * @returns Updated compression state words.
369
- * @example
370
- * Run the BLAKE2 compression core on zeroed state and message words.
371
- * ```ts
372
- * import { compress } from '@noble/hashes/blake2.js';
373
- * const state = compress(
374
- * new Uint8Array(16),
375
- * 0,
376
- * new Uint32Array(16),
377
- * 1,
378
- * 0, 0, 0, 0, 0, 0, 0, 0,
379
- * 0, 0, 0, 0, 0, 0, 0, 0
380
- * );
381
- * state.v0;
382
- * ```
383
- */
384
- // prettier-ignore
385
- export function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) {
313
+ const blake2b = /* @__PURE__ */ createHasher((opts)=>new _BLAKE2b(opts));
314
+ function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) {
386
315
  let j = 0;
387
- for (let i = 0; i < rounds; i++) {
316
+ for(let i = 0; i < rounds; i++){
388
317
  ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]]));
389
318
  ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]]));
390
319
  ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]]));
@@ -402,73 +331,52 @@ export function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7,
402
331
  ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]]));
403
332
  ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]]));
404
333
  }
405
- return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
334
+ return {
335
+ v0,
336
+ v1,
337
+ v2,
338
+ v3,
339
+ v4,
340
+ v5,
341
+ v6,
342
+ v7,
343
+ v8,
344
+ v9,
345
+ v10,
346
+ v11,
347
+ v12,
348
+ v13,
349
+ v14,
350
+ v15
351
+ };
406
352
  }
407
- // Blake2s reuses the SHA-256 IV words as-is.
408
353
  const B2S_IV = /* @__PURE__ */ SHA256_IV.slice();
409
- /** Internal blake2s hash class. */
410
- export class _BLAKE2s extends _BLAKE2 {
411
- // Internal state, same as SHA-256
412
- v0 = B2S_IV[0] | 0;
413
- v1 = B2S_IV[1] | 0;
414
- v2 = B2S_IV[2] | 0;
415
- v3 = B2S_IV[3] | 0;
416
- v4 = B2S_IV[4] | 0;
417
- v5 = B2S_IV[5] | 0;
418
- v6 = B2S_IV[6] | 0;
419
- v7 = B2S_IV[7] | 0;
420
- constructor(opts = {}) {
421
- const olen = opts.dkLen === undefined ? 32 : opts.dkLen;
422
- super(64, olen);
423
- checkBlake2Opts(olen, opts, 32, 8, 8);
424
- let { key, personalization, salt } = opts;
425
- let keyLength = 0;
426
- if (key !== undefined) {
427
- abytes(key, undefined, 'key');
428
- keyLength = key.length;
429
- }
430
- // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` directly into `h[0]`, since
431
- // BLAKE2s stores each state word as one `u32`.
432
- this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
433
- if (salt !== undefined) {
434
- abytes(salt, undefined, 'salt');
435
- const slt = u32(salt);
436
- this.v4 ^= swap8IfBE(slt[0]);
437
- this.v5 ^= swap8IfBE(slt[1]);
438
- }
439
- if (personalization !== undefined) {
440
- abytes(personalization, undefined, 'personalization');
441
- const pers = u32(personalization);
442
- this.v6 ^= swap8IfBE(pers[0]);
443
- this.v7 ^= swap8IfBE(pers[1]);
444
- }
445
- if (key !== undefined) {
446
- // Pad to blockLen and update
447
- const tmp = new Uint8Array(this.blockLen);
448
- tmp.set(key);
449
- this.update(tmp);
450
- }
451
- }
354
+ class _BLAKE2s extends _BLAKE2 {
452
355
  get() {
453
356
  const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
454
- return [v0, v1, v2, v3, v4, v5, v6, v7];
357
+ return [
358
+ v0,
359
+ v1,
360
+ v2,
361
+ v3,
362
+ v4,
363
+ v5,
364
+ v6,
365
+ v7
366
+ ];
455
367
  }
456
- // prettier-ignore
457
368
  set(v0, v1, v2, v3, v4, v5, v6, v7) {
458
- this.v0 = v0 | 0;
459
- this.v1 = v1 | 0;
460
- this.v2 = v2 | 0;
461
- this.v3 = v3 | 0;
462
- this.v4 = v4 | 0;
463
- this.v5 = v5 | 0;
464
- this.v6 = v6 | 0;
465
- this.v7 = v7 | 0;
369
+ this.v0 = 0 | v0;
370
+ this.v1 = 0 | v1;
371
+ this.v2 = 0 | v2;
372
+ this.v3 = 0 | v3;
373
+ this.v4 = 0 | v4;
374
+ this.v5 = 0 | v5;
375
+ this.v6 = 0 | v6;
376
+ this.v7 = 0 | v7;
466
377
  }
467
378
  compress(msg, offset, isLast) {
468
- const { h, l } = u64.fromBig(BigInt(this.length));
469
- // Seed v8..v15 from the IV, xor the low/high 32-bit byte counter into
470
- // v12/v13, and invert v14 on the final block.
471
- // prettier-ignore
379
+ const { h, l } = __rspack_external__u64_js_3c1fe104.fromBig(BigInt(this.length));
472
380
  const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(BSIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]);
473
381
  this.v0 ^= v0 ^ v8;
474
382
  this.v1 ^= v1 ^ v9;
@@ -484,18 +392,35 @@ export class _BLAKE2s extends _BLAKE2 {
484
392
  clean(this.buffer32);
485
393
  this.set(0, 0, 0, 0, 0, 0, 0, 0);
486
394
  }
395
+ constructor(opts = {}){
396
+ const olen = void 0 === opts.dkLen ? 32 : opts.dkLen;
397
+ super(64, olen), this.v0 = 0 | B2S_IV[0], this.v1 = 0 | B2S_IV[1], this.v2 = 0 | B2S_IV[2], this.v3 = 0 | B2S_IV[3], this.v4 = 0 | B2S_IV[4], this.v5 = 0 | B2S_IV[5], this.v6 = 0 | B2S_IV[6], this.v7 = 0 | B2S_IV[7];
398
+ checkBlake2Opts(olen, opts, 32, 8, 8);
399
+ let { key, personalization, salt } = opts;
400
+ let keyLength = 0;
401
+ if (void 0 !== key) {
402
+ abytes(key, void 0, 'key');
403
+ keyLength = key.length;
404
+ }
405
+ this.v0 ^= this.outputLen | keyLength << 8 | 16842752;
406
+ if (void 0 !== salt) {
407
+ abytes(salt, void 0, 'salt');
408
+ const slt = u32(salt);
409
+ this.v4 ^= swap8IfBE(slt[0]);
410
+ this.v5 ^= swap8IfBE(slt[1]);
411
+ }
412
+ if (void 0 !== personalization) {
413
+ abytes(personalization, void 0, 'personalization');
414
+ const pers = u32(personalization);
415
+ this.v6 ^= swap8IfBE(pers[0]);
416
+ this.v7 ^= swap8IfBE(pers[1]);
417
+ }
418
+ if (void 0 !== key) {
419
+ const tmp = new Uint8Array(this.blockLen);
420
+ tmp.set(key);
421
+ this.update(tmp);
422
+ }
423
+ }
487
424
  }
488
- /**
489
- * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
490
- * @param msg - message that would be hashed
491
- * @param opts - Optional output, MAC, salt, and personalization settings.
492
- * `dkLen` must be 1..32 bytes; `salt` and `personalization`, if present,
493
- * must be 8 bytes each. See {@link Blake2Opts}.
494
- * @returns Digest bytes.
495
- * @example
496
- * Hash a message with Blake2s.
497
- * ```ts
498
- * blake2s(new Uint8Array([97, 98, 99]));
499
- * ```
500
- */
501
- export const blake2s = /* @__PURE__ */ createHasher((opts) => new _BLAKE2s(opts));
425
+ const blake2s = /* @__PURE__ */ createHasher((opts)=>new _BLAKE2s(opts));
426
+ export { _BLAKE2, _BLAKE2b, _BLAKE2s, blake2b, blake2s, compress };