@blamejs/core 0.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 (160) hide show
  1. package/CHANGELOG.md +230 -0
  2. package/LICENSE +201 -0
  3. package/LTS-CALENDAR.md +29 -0
  4. package/MIGRATING.md +7 -0
  5. package/NOTICE +59 -0
  6. package/README.md +100 -0
  7. package/bin/blamejs.js +13 -0
  8. package/index.js +253 -0
  9. package/lib/api-key.js +705 -0
  10. package/lib/api-snapshot.js +335 -0
  11. package/lib/app-shutdown.js +381 -0
  12. package/lib/app.js +364 -0
  13. package/lib/atomic-file.js +525 -0
  14. package/lib/audit-chain.js +168 -0
  15. package/lib/audit-sign.js +319 -0
  16. package/lib/audit-tools.js +682 -0
  17. package/lib/audit.js +753 -0
  18. package/lib/auth/jwt.js +280 -0
  19. package/lib/auth/oauth.js +691 -0
  20. package/lib/auth/passkey.js +185 -0
  21. package/lib/auth/password.js +139 -0
  22. package/lib/auth/totp.js +17 -0
  23. package/lib/auth-header.js +81 -0
  24. package/lib/backup/bundle.js +219 -0
  25. package/lib/backup/crypto.js +174 -0
  26. package/lib/backup/index.js +490 -0
  27. package/lib/backup/manifest.js +275 -0
  28. package/lib/bundler.js +295 -0
  29. package/lib/cache.js +819 -0
  30. package/lib/chain-writer.js +234 -0
  31. package/lib/cli-helpers.js +201 -0
  32. package/lib/cli.js +1377 -0
  33. package/lib/cluster-provider-db.js +245 -0
  34. package/lib/cluster-storage.js +166 -0
  35. package/lib/cluster.js +691 -0
  36. package/lib/consent.js +222 -0
  37. package/lib/constants.js +186 -0
  38. package/lib/cookies.js +293 -0
  39. package/lib/credential-hash.js +303 -0
  40. package/lib/crypto-field.js +159 -0
  41. package/lib/crypto.js +250 -0
  42. package/lib/db-query.js +297 -0
  43. package/lib/db-schema.js +250 -0
  44. package/lib/db.js +1054 -0
  45. package/lib/deprecate.js +226 -0
  46. package/lib/dev.js +324 -0
  47. package/lib/error-page.js +424 -0
  48. package/lib/events.js +135 -0
  49. package/lib/external-db.js +422 -0
  50. package/lib/forms.js +378 -0
  51. package/lib/framework-error.js +189 -0
  52. package/lib/framework-schema.js +604 -0
  53. package/lib/handlers.js +350 -0
  54. package/lib/html-balance.js +227 -0
  55. package/lib/http-client.js +615 -0
  56. package/lib/i18n.js +780 -0
  57. package/lib/jobs.js +181 -0
  58. package/lib/lazy-require.js +48 -0
  59. package/lib/log-stream-local.js +137 -0
  60. package/lib/log-stream-webhook.js +170 -0
  61. package/lib/log-stream.js +211 -0
  62. package/lib/log.js +355 -0
  63. package/lib/mail-bounce.js +507 -0
  64. package/lib/mail.js +701 -0
  65. package/lib/metrics.js +647 -0
  66. package/lib/middleware/api-encrypt.js +553 -0
  67. package/lib/middleware/attach-user.js +156 -0
  68. package/lib/middleware/body-parser.js +883 -0
  69. package/lib/middleware/bot-guard.js +148 -0
  70. package/lib/middleware/compression.js +436 -0
  71. package/lib/middleware/cors.js +236 -0
  72. package/lib/middleware/csp-nonce.js +332 -0
  73. package/lib/middleware/csrf-protect.js +275 -0
  74. package/lib/middleware/error-handler.js +46 -0
  75. package/lib/middleware/health.js +358 -0
  76. package/lib/middleware/index.js +52 -0
  77. package/lib/middleware/rate-limit.js +319 -0
  78. package/lib/middleware/request-id.js +53 -0
  79. package/lib/middleware/require-auth.js +95 -0
  80. package/lib/middleware/security-headers.js +91 -0
  81. package/lib/migrations.js +353 -0
  82. package/lib/mtls-ca.js +333 -0
  83. package/lib/mtls-engine-default.js +285 -0
  84. package/lib/nonce-store.js +177 -0
  85. package/lib/notify.js +643 -0
  86. package/lib/ntp-check.js +178 -0
  87. package/lib/object-store/azure-blob.js +467 -0
  88. package/lib/object-store/gcs.js +469 -0
  89. package/lib/object-store/http-put.js +153 -0
  90. package/lib/object-store/index.js +140 -0
  91. package/lib/object-store/local.js +163 -0
  92. package/lib/object-store/retry.js +15 -0
  93. package/lib/object-store/sigv4.js +535 -0
  94. package/lib/observability.js +114 -0
  95. package/lib/pagination.js +371 -0
  96. package/lib/parsers/index.js +64 -0
  97. package/lib/parsers/safe-csv.js +224 -0
  98. package/lib/parsers/safe-env.js +614 -0
  99. package/lib/parsers/safe-toml.js +745 -0
  100. package/lib/parsers/safe-xml.js +379 -0
  101. package/lib/parsers/safe-yaml.js +977 -0
  102. package/lib/permissions.js +430 -0
  103. package/lib/pqc-agent.js +85 -0
  104. package/lib/pqc-gate.js +266 -0
  105. package/lib/protocol-dispatcher.js +144 -0
  106. package/lib/queue-local.js +327 -0
  107. package/lib/queue.js +430 -0
  108. package/lib/redact.js +192 -0
  109. package/lib/render.js +193 -0
  110. package/lib/request-helpers.js +178 -0
  111. package/lib/restore-bundle.js +239 -0
  112. package/lib/restore-rollback.js +254 -0
  113. package/lib/restore.js +301 -0
  114. package/lib/retry.js +329 -0
  115. package/lib/router.js +437 -0
  116. package/lib/safe-async.js +520 -0
  117. package/lib/safe-buffer.js +162 -0
  118. package/lib/safe-json.js +532 -0
  119. package/lib/safe-schema.js +1176 -0
  120. package/lib/safe-sql.js +157 -0
  121. package/lib/safe-url.js +109 -0
  122. package/lib/scheduler.js +680 -0
  123. package/lib/seeders.js +622 -0
  124. package/lib/session.js +304 -0
  125. package/lib/slug.js +243 -0
  126. package/lib/static.js +268 -0
  127. package/lib/storage.js +470 -0
  128. package/lib/subject.js +281 -0
  129. package/lib/template.js +781 -0
  130. package/lib/testing.js +621 -0
  131. package/lib/totp.js +285 -0
  132. package/lib/tracing.js +484 -0
  133. package/lib/validate-opts.js +56 -0
  134. package/lib/vault/index.js +299 -0
  135. package/lib/vault/passphrase-ops.js +311 -0
  136. package/lib/vault/passphrase-source.js +198 -0
  137. package/lib/vault/rotate.js +761 -0
  138. package/lib/vault/wrap.js +289 -0
  139. package/lib/vendor/MANIFEST.json +84 -0
  140. package/lib/vendor/argon2/argon2.cjs +466 -0
  141. package/lib/vendor/argon2/argon2.d.cts +62 -0
  142. package/lib/vendor/argon2/package.json +1 -0
  143. package/lib/vendor/argon2/prebuilds/darwin-arm64/argon2.armv8.glibc.node +0 -0
  144. package/lib/vendor/argon2/prebuilds/darwin-x64/argon2.glibc.node +0 -0
  145. package/lib/vendor/argon2/prebuilds/freebsd-arm64/argon2.armv8.glibc.node +0 -0
  146. package/lib/vendor/argon2/prebuilds/freebsd-x64/argon2.glibc.node +0 -0
  147. package/lib/vendor/argon2/prebuilds/linux-arm/argon2.armv7.glibc.node +0 -0
  148. package/lib/vendor/argon2/prebuilds/linux-arm/argon2.armv7.musl.node +0 -0
  149. package/lib/vendor/argon2/prebuilds/linux-arm64/argon2.armv8.glibc.node +0 -0
  150. package/lib/vendor/argon2/prebuilds/linux-arm64/argon2.armv8.musl.node +0 -0
  151. package/lib/vendor/argon2/prebuilds/linux-x64/argon2.glibc.node +0 -0
  152. package/lib/vendor/argon2/prebuilds/linux-x64/argon2.musl.node +0 -0
  153. package/lib/vendor/argon2/prebuilds/win32-x64/argon2.glibc.node +0 -0
  154. package/lib/vendor/noble-ciphers.cjs +9 -0
  155. package/lib/vendor/pki.cjs +181 -0
  156. package/lib/vendor/simplewebauthn-server.cjs +328 -0
  157. package/lib/webhook.js +632 -0
  158. package/lib/websocket-channels.js +413 -0
  159. package/lib/websocket.js +833 -0
  160. package/package.json +39 -0
@@ -0,0 +1,466 @@
1
+ // argon2 v0.44.0 — MIT License (c) Ranieri Althoff — https://github.com/ranisalt/node-argon2
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __commonJS = (cb, mod) => function __require() {
4
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
+ };
6
+
7
+ // node_modules/@phc/format/index.js
8
+ var require_format = __commonJS({
9
+ "node_modules/@phc/format/index.js"(exports2, module2) {
10
+ var idRegex = /^[a-z0-9-]{1,32}$/;
11
+ var nameRegex = /^[a-z0-9-]{1,32}$/;
12
+ var valueRegex = /^[a-zA-Z0-9/+.-]+$/;
13
+ var b64Regex = /^([a-zA-Z0-9/+.-]+|)$/;
14
+ var decimalRegex = /^((-)?[1-9]\d*|0)$/;
15
+ var versionRegex = /^v=(\d+)$/;
16
+ function objToKeyVal(obj) {
17
+ return objectKeys(obj).map((k) => [k, obj[k]].join("=")).join(",");
18
+ }
19
+ function keyValtoObj(str) {
20
+ const obj = {};
21
+ str.split(",").forEach((ps) => {
22
+ const pss = ps.split("=");
23
+ if (pss.length < 2) {
24
+ throw new TypeError(`params must be in the format name=value`);
25
+ }
26
+ obj[pss.shift()] = pss.join("=");
27
+ });
28
+ return obj;
29
+ }
30
+ function objectKeys(object) {
31
+ return Object.keys(object);
32
+ }
33
+ function objectValues(object) {
34
+ if (typeof Object.values === "function") return Object.values(object);
35
+ return objectKeys(object).map((k) => object[k]);
36
+ }
37
+ function serialize(opts) {
38
+ const fields = [""];
39
+ if (typeof opts !== "object" || opts === null) {
40
+ throw new TypeError("opts must be an object");
41
+ }
42
+ if (typeof opts.id !== "string") {
43
+ throw new TypeError("id must be a string");
44
+ }
45
+ if (!idRegex.test(opts.id)) {
46
+ throw new TypeError(`id must satisfy ${idRegex}`);
47
+ }
48
+ fields.push(opts.id);
49
+ if (typeof opts.version !== "undefined") {
50
+ if (typeof opts.version !== "number" || opts.version < 0 || !Number.isInteger(opts.version)) {
51
+ throw new TypeError("version must be a positive integer number");
52
+ }
53
+ fields.push(`v=${opts.version}`);
54
+ }
55
+ if (typeof opts.params !== "undefined") {
56
+ if (typeof opts.params !== "object" || opts.params === null) {
57
+ throw new TypeError("params must be an object");
58
+ }
59
+ const pk = objectKeys(opts.params);
60
+ if (!pk.every((p) => nameRegex.test(p))) {
61
+ throw new TypeError(`params names must satisfy ${nameRegex}`);
62
+ }
63
+ pk.forEach((k) => {
64
+ if (typeof opts.params[k] === "number") {
65
+ opts.params[k] = opts.params[k].toString();
66
+ } else if (Buffer.isBuffer(opts.params[k])) {
67
+ opts.params[k] = opts.params[k].toString("base64").split("=")[0];
68
+ }
69
+ });
70
+ const pv = objectValues(opts.params);
71
+ if (!pv.every((v) => typeof v === "string")) {
72
+ throw new TypeError("params values must be strings");
73
+ }
74
+ if (!pv.every((v) => valueRegex.test(v))) {
75
+ throw new TypeError(`params values must satisfy ${valueRegex}`);
76
+ }
77
+ const strpar = objToKeyVal(opts.params);
78
+ fields.push(strpar);
79
+ }
80
+ if (typeof opts.salt !== "undefined") {
81
+ if (!Buffer.isBuffer(opts.salt)) {
82
+ throw new TypeError("salt must be a Buffer");
83
+ }
84
+ fields.push(opts.salt.toString("base64").split("=")[0]);
85
+ if (typeof opts.hash !== "undefined") {
86
+ if (!Buffer.isBuffer(opts.hash)) {
87
+ throw new TypeError("hash must be a Buffer");
88
+ }
89
+ fields.push(opts.hash.toString("base64").split("=")[0]);
90
+ }
91
+ }
92
+ const phcstr = fields.join("$");
93
+ return phcstr;
94
+ }
95
+ function deserialize(phcstr) {
96
+ if (typeof phcstr !== "string" || phcstr === "") {
97
+ throw new TypeError("pchstr must be a non-empty string");
98
+ }
99
+ if (phcstr[0] !== "$") {
100
+ throw new TypeError("pchstr must contain a $ as first char");
101
+ }
102
+ const fields = phcstr.split("$");
103
+ fields.shift();
104
+ let maxf = 5;
105
+ if (!versionRegex.test(fields[1])) maxf--;
106
+ if (fields.length > maxf) {
107
+ throw new TypeError(
108
+ `pchstr contains too many fileds: ${fields.length}/${maxf}`
109
+ );
110
+ }
111
+ const id = fields.shift();
112
+ if (!idRegex.test(id)) {
113
+ throw new TypeError(`id must satisfy ${idRegex}`);
114
+ }
115
+ let version;
116
+ if (versionRegex.test(fields[0])) {
117
+ version = parseInt(fields.shift().match(versionRegex)[1], 10);
118
+ }
119
+ let hash;
120
+ let salt;
121
+ if (b64Regex.test(fields[fields.length - 1])) {
122
+ if (fields.length > 1 && b64Regex.test(fields[fields.length - 2])) {
123
+ hash = Buffer.from(fields.pop(), "base64");
124
+ salt = Buffer.from(fields.pop(), "base64");
125
+ } else {
126
+ salt = Buffer.from(fields.pop(), "base64");
127
+ }
128
+ }
129
+ let params;
130
+ if (fields.length > 0) {
131
+ const parstr = fields.pop();
132
+ params = keyValtoObj(parstr);
133
+ if (!objectKeys(params).every((p) => nameRegex.test(p))) {
134
+ throw new TypeError(`params names must satisfy ${nameRegex}`);
135
+ }
136
+ const pv = objectValues(params);
137
+ if (!pv.every((v) => valueRegex.test(v))) {
138
+ throw new TypeError(`params values must satisfy ${valueRegex}`);
139
+ }
140
+ const pk = objectKeys(params);
141
+ pk.forEach((k) => {
142
+ params[k] = decimalRegex.test(params[k]) ? parseInt(params[k], 10) : params[k];
143
+ });
144
+ }
145
+ if (fields.length > 0) {
146
+ throw new TypeError(`pchstr contains unrecognized fileds: ${fields}`);
147
+ }
148
+ const phcobj = { id };
149
+ if (version) phcobj.version = version;
150
+ if (params) phcobj.params = params;
151
+ if (salt) phcobj.salt = salt;
152
+ if (hash) phcobj.hash = hash;
153
+ return phcobj;
154
+ }
155
+ module2.exports = {
156
+ serialize,
157
+ deserialize
158
+ };
159
+ }
160
+ });
161
+
162
+ // node_modules/node-gyp-build/node-gyp-build.js
163
+ var require_node_gyp_build = __commonJS({
164
+ "node_modules/node-gyp-build/node-gyp-build.js"(exports2, module2) {
165
+ var fs = require("fs");
166
+ var path = require("path");
167
+ var os = require("os");
168
+ var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
169
+ var vars = process.config && process.config.variables || {};
170
+ var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
171
+ var abi = process.versions.modules;
172
+ var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
173
+ var arch = process.env.npm_config_arch || os.arch();
174
+ var platform = process.env.npm_config_platform || os.platform();
175
+ var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc");
176
+ var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
177
+ var uv = (process.versions.uv || "").split(".")[0];
178
+ module2.exports = load;
179
+ function load(dir) {
180
+ return runtimeRequire(load.resolve(dir));
181
+ }
182
+ load.resolve = load.path = function(dir) {
183
+ dir = path.resolve(dir || ".");
184
+ try {
185
+ var name = runtimeRequire(path.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
186
+ if (process.env[name + "_PREBUILD"]) dir = process.env[name + "_PREBUILD"];
187
+ } catch (err) {
188
+ }
189
+ if (!prebuildsOnly) {
190
+ var release = getFirst(path.join(dir, "build/Release"), matchBuild);
191
+ if (release) return release;
192
+ var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
193
+ if (debug) return debug;
194
+ }
195
+ var prebuild = resolve(dir);
196
+ if (prebuild) return prebuild;
197
+ var nearby = resolve(path.dirname(process.execPath));
198
+ if (nearby) return nearby;
199
+ var target = [
200
+ "platform=" + platform,
201
+ "arch=" + arch,
202
+ "runtime=" + runtime,
203
+ "abi=" + abi,
204
+ "uv=" + uv,
205
+ armv ? "armv=" + armv : "",
206
+ "libc=" + libc,
207
+ "node=" + process.versions.node,
208
+ process.versions.electron ? "electron=" + process.versions.electron : "",
209
+ typeof __webpack_require__ === "function" ? "webpack=true" : ""
210
+ // eslint-disable-line
211
+ ].filter(Boolean).join(" ");
212
+ throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
213
+ function resolve(dir2) {
214
+ var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
215
+ var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
216
+ if (!tuple) return;
217
+ var prebuilds = path.join(dir2, "prebuilds", tuple.name);
218
+ var parsed = readdirSync(prebuilds).map(parseTags);
219
+ var candidates = parsed.filter(matchTags(runtime, abi));
220
+ var winner = candidates.sort(compareTags(runtime))[0];
221
+ if (winner) return path.join(prebuilds, winner.file);
222
+ }
223
+ };
224
+ function readdirSync(dir) {
225
+ try {
226
+ return fs.readdirSync(dir);
227
+ } catch (err) {
228
+ return [];
229
+ }
230
+ }
231
+ function getFirst(dir, filter) {
232
+ var files = readdirSync(dir).filter(filter);
233
+ return files[0] && path.join(dir, files[0]);
234
+ }
235
+ function matchBuild(name) {
236
+ return /\.node$/.test(name);
237
+ }
238
+ function parseTuple(name) {
239
+ var arr = name.split("-");
240
+ if (arr.length !== 2) return;
241
+ var platform2 = arr[0];
242
+ var architectures = arr[1].split("+");
243
+ if (!platform2) return;
244
+ if (!architectures.length) return;
245
+ if (!architectures.every(Boolean)) return;
246
+ return { name, platform: platform2, architectures };
247
+ }
248
+ function matchTuple(platform2, arch2) {
249
+ return function(tuple) {
250
+ if (tuple == null) return false;
251
+ if (tuple.platform !== platform2) return false;
252
+ return tuple.architectures.includes(arch2);
253
+ };
254
+ }
255
+ function compareTuples(a, b) {
256
+ return a.architectures.length - b.architectures.length;
257
+ }
258
+ function parseTags(file) {
259
+ var arr = file.split(".");
260
+ var extension = arr.pop();
261
+ var tags = { file, specificity: 0 };
262
+ if (extension !== "node") return;
263
+ for (var i = 0; i < arr.length; i++) {
264
+ var tag = arr[i];
265
+ if (tag === "node" || tag === "electron" || tag === "node-webkit") {
266
+ tags.runtime = tag;
267
+ } else if (tag === "napi") {
268
+ tags.napi = true;
269
+ } else if (tag.slice(0, 3) === "abi") {
270
+ tags.abi = tag.slice(3);
271
+ } else if (tag.slice(0, 2) === "uv") {
272
+ tags.uv = tag.slice(2);
273
+ } else if (tag.slice(0, 4) === "armv") {
274
+ tags.armv = tag.slice(4);
275
+ } else if (tag === "glibc" || tag === "musl") {
276
+ tags.libc = tag;
277
+ } else {
278
+ continue;
279
+ }
280
+ tags.specificity++;
281
+ }
282
+ return tags;
283
+ }
284
+ function matchTags(runtime2, abi2) {
285
+ return function(tags) {
286
+ if (tags == null) return false;
287
+ if (tags.runtime && tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false;
288
+ if (tags.abi && tags.abi !== abi2 && !tags.napi) return false;
289
+ if (tags.uv && tags.uv !== uv) return false;
290
+ if (tags.armv && tags.armv !== armv) return false;
291
+ if (tags.libc && tags.libc !== libc) return false;
292
+ return true;
293
+ };
294
+ }
295
+ function runtimeAgnostic(tags) {
296
+ return tags.runtime === "node" && tags.napi;
297
+ }
298
+ function compareTags(runtime2) {
299
+ return function(a, b) {
300
+ if (a.runtime !== b.runtime) {
301
+ return a.runtime === runtime2 ? -1 : 1;
302
+ } else if (a.abi !== b.abi) {
303
+ return a.abi ? -1 : 1;
304
+ } else if (a.specificity !== b.specificity) {
305
+ return a.specificity > b.specificity ? -1 : 1;
306
+ } else {
307
+ return 0;
308
+ }
309
+ };
310
+ }
311
+ function isNwjs() {
312
+ return !!(process.versions && process.versions.nw);
313
+ }
314
+ function isElectron() {
315
+ if (process.versions && process.versions.electron) return true;
316
+ if (process.env.ELECTRON_RUN_AS_NODE) return true;
317
+ return typeof window !== "undefined" && window.process && window.process.type === "renderer";
318
+ }
319
+ function isAlpine(platform2) {
320
+ return platform2 === "linux" && fs.existsSync("/etc/alpine-release");
321
+ }
322
+ load.parseTags = parseTags;
323
+ load.matchTags = matchTags;
324
+ load.compareTags = compareTags;
325
+ load.parseTuple = parseTuple;
326
+ load.matchTuple = matchTuple;
327
+ load.compareTuples = compareTuples;
328
+ }
329
+ });
330
+
331
+ // node_modules/node-gyp-build/index.js
332
+ var require_node_gyp_build2 = __commonJS({
333
+ "node_modules/node-gyp-build/index.js"(exports2, module2) {
334
+ var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
335
+ if (typeof runtimeRequire.addon === "function") {
336
+ module2.exports = runtimeRequire.addon.bind(runtimeRequire);
337
+ } else {
338
+ module2.exports = require_node_gyp_build();
339
+ }
340
+ }
341
+ });
342
+
343
+ // node_modules/argon2/argon2.cjs
344
+ var require_argon2 = __commonJS({
345
+ "node_modules/argon2/argon2.cjs"(exports2, module2) {
346
+ var { randomBytes, timingSafeEqual } = require("node:crypto");
347
+ var { promisify } = require("node:util");
348
+ var { deserialize, serialize } = require_format();
349
+ var gypBuild = require_node_gyp_build2();
350
+ var { hash: bindingsHash } = gypBuild(__dirname);
351
+ var generateSalt = promisify(randomBytes);
352
+ var argon2d = 0;
353
+ var argon2i = 1;
354
+ var argon2id = 2;
355
+ module2.exports.argon2d = argon2d;
356
+ module2.exports.argon2i = argon2i;
357
+ module2.exports.argon2id = argon2id;
358
+ var types = Object.freeze({ argon2d, argon2i, argon2id });
359
+ var names = Object.freeze({
360
+ [types.argon2d]: "argon2d",
361
+ [types.argon2i]: "argon2i",
362
+ [types.argon2id]: "argon2id"
363
+ });
364
+ var defaults = {
365
+ hashLength: 32,
366
+ timeCost: 3,
367
+ memoryCost: 1 << 16,
368
+ parallelism: 4,
369
+ type: argon2id,
370
+ version: 19
371
+ };
372
+ async function hash(password, options) {
373
+ let { raw, salt, ...rest } = { ...defaults, ...options };
374
+ if (rest.hashLength > 2 ** 32 - 1) {
375
+ throw new RangeError("Hash length is too large");
376
+ }
377
+ if (rest.memoryCost > 2 ** 32 - 1) {
378
+ throw new RangeError("Memory cost is too large");
379
+ }
380
+ if (rest.timeCost > 2 ** 32 - 1) {
381
+ throw new RangeError("Time cost is too large");
382
+ }
383
+ if (rest.parallelism > 2 ** 24 - 1) {
384
+ throw new RangeError("Parallelism is too large");
385
+ }
386
+ salt = salt ?? await generateSalt(16);
387
+ const {
388
+ hashLength,
389
+ secret = Buffer.alloc(0),
390
+ type,
391
+ version,
392
+ memoryCost: m,
393
+ timeCost: t,
394
+ parallelism: p,
395
+ associatedData: data = Buffer.alloc(0)
396
+ } = rest;
397
+ const hash2 = await bindingsHash({
398
+ password: Buffer.from(password),
399
+ salt,
400
+ secret,
401
+ data,
402
+ hashLength,
403
+ m,
404
+ t,
405
+ p,
406
+ version,
407
+ type
408
+ });
409
+ if (raw) {
410
+ return hash2;
411
+ }
412
+ return serialize({
413
+ id: names[type],
414
+ version,
415
+ params: { m, t, p, ...data.byteLength > 0 ? { data } : {} },
416
+ salt,
417
+ hash: hash2
418
+ });
419
+ }
420
+ module2.exports.hash = hash;
421
+ function needsRehash(digest, options = {}) {
422
+ const { memoryCost, timeCost, parallelism, version } = {
423
+ ...defaults,
424
+ ...options
425
+ };
426
+ const {
427
+ version: v,
428
+ params: { m, t, p }
429
+ } = deserialize(digest);
430
+ return +v !== +version || +m !== +memoryCost || +t !== +timeCost || +p !== +parallelism;
431
+ }
432
+ module2.exports.needsRehash = needsRehash;
433
+ async function verify(digest, password, options = {}) {
434
+ const { id, ...rest } = deserialize(digest);
435
+ if (!(id in types)) {
436
+ return false;
437
+ }
438
+ const {
439
+ version = 16,
440
+ params: { m, t, p, data = "" },
441
+ salt,
442
+ hash: hash2
443
+ } = rest;
444
+ const { secret = Buffer.alloc(0) } = options;
445
+ return timingSafeEqual(
446
+ await bindingsHash({
447
+ password: Buffer.from(password),
448
+ salt,
449
+ secret,
450
+ data: Buffer.from(data, "base64"),
451
+ hashLength: hash2.byteLength,
452
+ m: +m,
453
+ t: +t,
454
+ p: +p,
455
+ version: +version,
456
+ type: types[id]
457
+ }),
458
+ hash2
459
+ );
460
+ }
461
+ module2.exports.verify = verify;
462
+ }
463
+ });
464
+
465
+ // _bundle-argon2.cjs
466
+ module.exports = require_argon2();
@@ -0,0 +1,62 @@
1
+ export type Options = {
2
+ hashLength?: number | undefined;
3
+ timeCost?: number | undefined;
4
+ memoryCost?: number | undefined;
5
+ parallelism?: number | undefined;
6
+ type?: 0 | 1 | 2 | undefined;
7
+ version?: number | undefined;
8
+ salt?: Buffer | undefined;
9
+ associatedData?: Buffer | undefined;
10
+ secret?: Buffer | undefined;
11
+ };
12
+ export const argon2d: 0;
13
+ export const argon2i: 1;
14
+ export const argon2id: 2;
15
+ /**
16
+ * Hashes a password with Argon2, producing a raw hash
17
+ *
18
+ * @overload
19
+ * @param {Buffer | string} password The plaintext password to be hashed
20
+ * @param {Options & { raw: true }} options The parameters for Argon2
21
+ * @returns {Promise<Buffer>} The raw hash generated from `password`
22
+ */
23
+ export function hash(password: Buffer | string, options: Options & {
24
+ raw: true;
25
+ }): Promise<Buffer>;
26
+ /**
27
+ * Hashes a password with Argon2, producing an encoded hash
28
+ *
29
+ * @overload
30
+ * @param {Buffer | string} password The plaintext password to be hashed
31
+ * @param {Options & { raw?: boolean }} [options] The parameters for Argon2
32
+ * @returns {Promise<string>} The encoded hash generated from `password`
33
+ */
34
+ export function hash(password: Buffer | string, options?: (Options & {
35
+ raw?: boolean;
36
+ }) | undefined): Promise<string>;
37
+ /**
38
+ * @param {string} digest The digest to be checked
39
+ * @param {Object} [options] The current parameters for Argon2
40
+ * @param {number} [options.timeCost=3]
41
+ * @param {number} [options.memoryCost=65536]
42
+ * @param {number} [options.parallelism=4]
43
+ * @param {number} [options.version=0x13]
44
+ * @returns {boolean} `true` if the digest parameters do not match the parameters in `options`, otherwise `false`
45
+ */
46
+ export function needsRehash(digest: string, options?: {
47
+ timeCost?: number | undefined;
48
+ memoryCost?: number | undefined;
49
+ parallelism?: number | undefined;
50
+ version?: number | undefined;
51
+ } | undefined): boolean;
52
+ /**
53
+ * @param {string} digest The digest to be checked
54
+ * @param {Buffer | string} password The plaintext password to be verified
55
+ * @param {Object} [options] The current parameters for Argon2
56
+ * @param {Buffer} [options.secret]
57
+ * @returns {Promise<boolean>} `true` if the digest parameters matches the hash generated from `password`, otherwise `false`
58
+ */
59
+ export function verify(digest: string, password: Buffer | string, options?: {
60
+ secret?: Buffer | undefined;
61
+ } | undefined): Promise<boolean>;
62
+ //# sourceMappingURL=argon2.d.cts.map
@@ -0,0 +1 @@
1
+ {"name":"argon2","version":"0.44.0","main":"argon2.cjs"}
@@ -0,0 +1,9 @@
1
+ // XChaCha20-Poly1305 — vendored from @noble/ciphers v2.2.0 by Paul Miller
2
+ // License: MIT — https://github.com/paulmillr/noble-ciphers
3
+ // Bundled with esbuild. Exports: xchacha20poly1305
4
+ var st=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Tt=Object.prototype.hasOwnProperty;var _t=(e,t)=>{for(var i in t)st(e,i,{get:t[i],enumerable:!0})},Ot=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of At(t))!Tt.call(e,s)&&s!==i&&st(e,s,{get:()=>t[s],enumerable:!(n=Ut(t,s))||n.enumerable});return e};var Rt=e=>Ot(st({},"__esModule",{value:!0}),e);var Vt={};_t(Vt,{xchacha20poly1305:()=>Bt});module.exports=Rt(Vt);function Ct(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function ft(e){if(typeof e!="boolean")throw new TypeError(`boolean expected, not ${e}`)}function tt(e){if(typeof e!="number")throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError("positive integer expected, got "+e)}function j(e,t,i=""){let n=Ct(e),s=e?.length,o=t!==void 0;if(!n||o&&s!==t){let f=i&&`"${i}" `,r=o?` of length ${t}`:"",c=n?`length=${s}`:`type=${typeof e}`,u=f+"expected Uint8Array"+r+", got "+c;throw n?new RangeError(u):new TypeError(u)}return e}function it(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function at(e,t,i=!1){j(e,void 0,"output");let n=t.outputLen;if(e.length<n)throw new RangeError("digestInto() expects output buffer of length at least "+n);if(i&&!et(e))throw new Error("invalid output, must be aligned")}function q(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function V(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function It(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var W=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,lt=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,k=W?e=>e:e=>lt(e)>>>0,St=e=>{for(let t=0;t<e.length;t++)e[t]=lt(e[t]);return e},F=W?e=>e:St;function ut(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function pt(e,t){if(e.length!==t.length)return!1;let i=0;for(let n=0;n<e.length;n++)i|=e[n]^t[n];return i===0}function yt(e,t,i){let n=t,s=i||(()=>[]),o=(r,c)=>n(c,...s(r)).update(r).digest(),f=n(new Uint8Array(e),...s(new Uint8Array(0)));return o.outputLen=f.outputLen,o.blockLen=f.blockLen,o.create=(r,...c)=>n(r,...c),o}var gt=(e,t)=>{function i(n,...s){if(j(n,void 0,"key"),e.nonceLength!==void 0){let l=s[0];j(l,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let o=e.tagLength;o&&s[1]!==void 0&&j(s[1],void 0,"AAD");let f=t(n,...s),r=(l,y)=>{if(y!==void 0){if(l!==2)throw new Error("cipher output not supported");j(y,void 0,"output")}},c=!1;return{encrypt(l,y){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,j(l),r(f.encrypt.length,y),f.encrypt(l,y)},decrypt(l,y){if(j(l),o&&l.length<o)throw new Error('"ciphertext" expected length bigger than tagLength='+o);return r(f.decrypt.length,y),f.decrypt(l,y)}}}return Object.assign(i,e),i};function rt(e,t,i=!0){if(t===void 0)return new Uint8Array(e);if(j(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(i&&!et(t))throw new Error("invalid output, must be aligned");return t}function xt(e,t,i){tt(e),tt(t),ft(i);let n=new Uint8Array(16),s=It(n);return s.setBigUint64(0,BigInt(t),i),s.setBigUint64(8,BigInt(e),i),n}function et(e){return e.byteOffset%4===0}function nt(e){return Uint8Array.from(j(e))}var wt=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),vt=F(q(wt("expand 16-byte k"))),Nt=F(q(wt("expand 32-byte k")));function h(e,t){return e<<t|e>>>32-t}var ot=64,Mt=16,ct=2**32-1,dt=Uint32Array.of();function jt(e,t,i,n,s,o,f,r){let c=s.length,u=new Uint8Array(ot),l=q(u),y=W&&et(s)&&et(o),b=y?q(s):dt,w=y?q(o):dt;if(!W){for(let g=0;g<c;f++){if(e(t,i,n,l,f,r),F(l),f>=ct)throw new Error("arx: counter overflow");let x=Math.min(ot,c-g);for(let p=0,d;p<x;p++)d=g+p,o[d]=s[d]^u[p];g+=x}return}for(let g=0;g<c;f++){if(e(t,i,n,l,f,r),f>=ct)throw new Error("arx: counter overflow");let x=Math.min(ot,c-g);if(y&&x===ot){let p=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let d=0,L;d<Mt;d++)L=p+d,w[L]=b[L]^l[d];g+=ot;continue}for(let p=0,d;p<x;p++)d=g+p,o[d]=s[d]^u[p];g+=x}}function bt(e,t){let{allowShortKeys:i,extendNonceFn:n,counterLength:s,counterRight:o,rounds:f}=ut({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return tt(s),tt(f),ft(o),ft(i),(r,c,u,l,y=0)=>{j(r,void 0,"key"),j(c,void 0,"nonce"),j(u,void 0,"data");let b=u.length;if(l=rt(b,l,!1),tt(y),y<0||y>=ct)throw new Error("arx: counter overflow");let w=[],g=r.length,x,p;if(g===32)w.push(x=nt(r)),p=Nt;else if(g===16&&i)x=new Uint8Array(32),x.set(r),x.set(r,16),p=vt,w.push(x);else throw j(r,32,"arx key"),new Error("invalid key size");(!W||!et(c))&&w.push(c=nt(c));let d=q(x);if(n){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let M=c.subarray(0,16);if(W)n(p,d,q(M),d);else{let $=F(Uint32Array.from(p));n($,d,q(M),d),V($),F(d)}c=c.subarray(16)}else W||F(d);let L=16-s;if(L!==c.length)throw new Error(`arx: nonce must be ${L} or 16 bytes`);if(L!==12){let M=new Uint8Array(12);M.set(c,o?0:12-c.length),c=M,w.push(c)}let v=F(q(c));try{return jt(e,p,d,v,u,l,y,f),l}finally{V(...w)}}}function P(e,t){return e[t++]&255|(e[t++]&255)<<8}var ht=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=nt(j(t,32,"key"));let i=P(t,0),n=P(t,2),s=P(t,4),o=P(t,6),f=P(t,8),r=P(t,10),c=P(t,12),u=P(t,14);this.r[0]=i&8191,this.r[1]=(i>>>13|n<<3)&8191,this.r[2]=(n>>>10|s<<6)&7939,this.r[3]=(s>>>7|o<<9)&8191,this.r[4]=(o>>>4|f<<12)&255,this.r[5]=f>>>1&8190,this.r[6]=(f>>>14|r<<2)&8191,this.r[7]=(r>>>11|c<<5)&8065,this.r[8]=(c>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let l=0;l<8;l++)this.pad[l]=P(t,16+2*l)}process(t,i,n=!1){let s=n?0:2048,{h:o,r:f}=this,r=f[0],c=f[1],u=f[2],l=f[3],y=f[4],b=f[5],w=f[6],g=f[7],x=f[8],p=f[9],d=P(t,i+0),L=P(t,i+2),v=P(t,i+4),M=P(t,i+6),$=P(t,i+8),z=P(t,i+10),H=P(t,i+12),K=P(t,i+14),m=o[0]+(d&8191),E=o[1]+((d>>>13|L<<3)&8191),B=o[2]+((L>>>10|v<<6)&8191),U=o[3]+((v>>>7|M<<9)&8191),A=o[4]+((M>>>4|$<<12)&8191),T=o[5]+($>>>1&8191),_=o[6]+(($>>>14|z<<2)&8191),O=o[7]+((z>>>11|H<<5)&8191),R=o[8]+((H>>>8|K<<8)&8191),C=o[9]+(K>>>5|s),a=0,S=a+m*r+E*(5*p)+B*(5*x)+U*(5*g)+A*(5*w);a=S>>>13,S&=8191,S+=T*(5*b)+_*(5*y)+O*(5*l)+R*(5*u)+C*(5*c),a+=S>>>13,S&=8191;let N=a+m*c+E*r+B*(5*p)+U*(5*x)+A*(5*g);a=N>>>13,N&=8191,N+=T*(5*w)+_*(5*b)+O*(5*y)+R*(5*l)+C*(5*u),a+=N>>>13,N&=8191;let I=a+m*u+E*c+B*r+U*(5*p)+A*(5*x);a=I>>>13,I&=8191,I+=T*(5*g)+_*(5*w)+O*(5*b)+R*(5*y)+C*(5*l),a+=I>>>13,I&=8191;let Y=a+m*l+E*u+B*c+U*r+A*(5*p);a=Y>>>13,Y&=8191,Y+=T*(5*x)+_*(5*g)+O*(5*w)+R*(5*b)+C*(5*y),a+=Y>>>13,Y&=8191;let Z=a+m*y+E*l+B*u+U*c+A*r;a=Z>>>13,Z&=8191,Z+=T*(5*p)+_*(5*x)+O*(5*g)+R*(5*w)+C*(5*b),a+=Z>>>13,Z&=8191;let G=a+m*b+E*y+B*l+U*u+A*c;a=G>>>13,G&=8191,G+=T*r+_*(5*p)+O*(5*x)+R*(5*g)+C*(5*w),a+=G>>>13,G&=8191;let Q=a+m*w+E*b+B*y+U*l+A*u;a=Q>>>13,Q&=8191,Q+=T*c+_*r+O*(5*p)+R*(5*x)+C*(5*g),a+=Q>>>13,Q&=8191;let J=a+m*g+E*w+B*b+U*y+A*l;a=J>>>13,J&=8191,J+=T*u+_*c+O*r+R*(5*p)+C*(5*x),a+=J>>>13,J&=8191;let X=a+m*x+E*g+B*w+U*b+A*y;a=X>>>13,X&=8191,X+=T*l+_*u+O*c+R*r+C*(5*p),a+=X>>>13,X&=8191;let D=a+m*p+E*x+B*g+U*w+A*b;a=D>>>13,D&=8191,D+=T*y+_*l+O*u+R*c+C*r,a+=D>>>13,D&=8191,a=(a<<2)+a|0,a=a+S|0,S=a&8191,a=a>>>13,N+=a,o[0]=S,o[1]=N,o[2]=I,o[3]=Y,o[4]=Z,o[5]=G,o[6]=Q,o[7]=J,o[8]=X,o[9]=D}finalize(){let{h:t,pad:i}=this,n=new Uint16Array(10),s=t[1]>>>13;t[1]&=8191;for(let r=2;r<10;r++)t[r]+=s,s=t[r]>>>13,t[r]&=8191;t[0]+=s*5,s=t[0]>>>13,t[0]&=8191,t[1]+=s,s=t[1]>>>13,t[1]&=8191,t[2]+=s,n[0]=t[0]+5,s=n[0]>>>13,n[0]&=8191;for(let r=1;r<10;r++)n[r]=t[r]+s,s=n[r]>>>13,n[r]&=8191;n[9]-=8192;let o=(s^1)-1;for(let r=0;r<10;r++)n[r]&=o;o=~o;for(let r=0;r<10;r++)t[r]=t[r]&o|n[r];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let f=t[0]+i[0];t[0]=f&65535;for(let r=1;r<8;r++)f=(t[r]+i[r]|0)+(f>>>16)|0,t[r]=f&65535;V(n)}update(t){it(this),j(t),t=nt(t);let{buffer:i,blockLen:n}=this,s=t.length;for(let o=0;o<s;){let f=Math.min(n-this.pos,s-o);if(f===n){for(;n<=s-o;o+=n)this.process(t,o);continue}i.set(t.subarray(o,o+f),this.pos),this.pos+=f,o+=f,this.pos===n&&(this.process(i,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,V(this.h,this.r,this.buffer,this.pad)}digestInto(t){it(this),at(t,this),this.finished=!0;let{buffer:i,h:n}=this,{pos:s}=this;if(s){for(i[s++]=1;s<16;s++)i[s]=0;this.process(i,0,!0)}this.finalize();let o=0;for(let f=0;f<8;f++)t[o++]=n[f]>>>0,t[o++]=n[f]>>>8}digest(){let{buffer:t,outputLen:i}=this;this.digestInto(t);let n=t.slice(0,i);return this.destroy(),n}},Lt=yt(32,e=>new ht(e));function kt(e,t,i,n,s,o=20){let f=e[0],r=e[1],c=e[2],u=e[3],l=t[0],y=t[1],b=t[2],w=t[3],g=t[4],x=t[5],p=t[6],d=t[7],L=s,v=i[0],M=i[1],$=i[2],z=f,H=r,K=c,m=u,E=l,B=y,U=b,A=w,T=g,_=x,O=p,R=d,C=L,a=v,S=M,N=$;for(let Y=0;Y<o;Y+=2)z=z+E|0,C=h(C^z,16),T=T+C|0,E=h(E^T,12),z=z+E|0,C=h(C^z,8),T=T+C|0,E=h(E^T,7),H=H+B|0,a=h(a^H,16),_=_+a|0,B=h(B^_,12),H=H+B|0,a=h(a^H,8),_=_+a|0,B=h(B^_,7),K=K+U|0,S=h(S^K,16),O=O+S|0,U=h(U^O,12),K=K+U|0,S=h(S^K,8),O=O+S|0,U=h(U^O,7),m=m+A|0,N=h(N^m,16),R=R+N|0,A=h(A^R,12),m=m+A|0,N=h(N^m,8),R=R+N|0,A=h(A^R,7),z=z+B|0,N=h(N^z,16),O=O+N|0,B=h(B^O,12),z=z+B|0,N=h(N^z,8),O=O+N|0,B=h(B^O,7),H=H+U|0,C=h(C^H,16),R=R+C|0,U=h(U^R,12),H=H+U|0,C=h(C^H,8),R=R+C|0,U=h(U^R,7),K=K+A|0,a=h(a^K,16),T=T+a|0,A=h(A^T,12),K=K+A|0,a=h(a^K,8),T=T+a|0,A=h(A^T,7),m=m+E|0,S=h(S^m,16),_=_+S|0,E=h(E^_,12),m=m+E|0,S=h(S^m,8),_=_+S|0,E=h(E^_,7);let I=0;n[I++]=f+z|0,n[I++]=r+H|0,n[I++]=c+K|0,n[I++]=u+m|0,n[I++]=l+E|0,n[I++]=y+B|0,n[I++]=b+U|0,n[I++]=w+A|0,n[I++]=g+T|0,n[I++]=x+_|0,n[I++]=p+O|0,n[I++]=d+R|0,n[I++]=L+C|0,n[I++]=v+a|0,n[I++]=M+S|0,n[I++]=$+N|0}function Pt(e,t,i,n){let s=k(e[0]),o=k(e[1]),f=k(e[2]),r=k(e[3]),c=k(t[0]),u=k(t[1]),l=k(t[2]),y=k(t[3]),b=k(t[4]),w=k(t[5]),g=k(t[6]),x=k(t[7]),p=k(i[0]),d=k(i[1]),L=k(i[2]),v=k(i[3]);for(let $=0;$<20;$+=2)s=s+c|0,p=h(p^s,16),b=b+p|0,c=h(c^b,12),s=s+c|0,p=h(p^s,8),b=b+p|0,c=h(c^b,7),o=o+u|0,d=h(d^o,16),w=w+d|0,u=h(u^w,12),o=o+u|0,d=h(d^o,8),w=w+d|0,u=h(u^w,7),f=f+l|0,L=h(L^f,16),g=g+L|0,l=h(l^g,12),f=f+l|0,L=h(L^f,8),g=g+L|0,l=h(l^g,7),r=r+y|0,v=h(v^r,16),x=x+v|0,y=h(y^x,12),r=r+y|0,v=h(v^r,8),x=x+v|0,y=h(y^x,7),s=s+u|0,v=h(v^s,16),g=g+v|0,u=h(u^g,12),s=s+u|0,v=h(v^s,8),g=g+v|0,u=h(u^g,7),o=o+l|0,p=h(p^o,16),x=x+p|0,l=h(l^x,12),o=o+l|0,p=h(p^o,8),x=x+p|0,l=h(l^x,7),f=f+y|0,d=h(d^f,16),b=b+d|0,y=h(y^b,12),f=f+y|0,d=h(d^f,8),b=b+d|0,y=h(y^b,7),r=r+c|0,L=h(L^r,16),w=w+L|0,c=h(c^w,12),r=r+c|0,L=h(L^r,8),w=w+L|0,c=h(c^w,7);let M=0;n[M++]=s,n[M++]=o,n[M++]=f,n[M++]=r,n[M++]=p,n[M++]=d,n[M++]=L,n[M++]=v,F(n)}var zt=bt(kt,{counterRight:!1,counterLength:8,extendNonceFn:Pt,allowShortKeys:!1});var Ht=new Uint8Array(16),mt=(e,t)=>{e.update(t);let i=t.length%16;i&&e.update(Ht.subarray(i))},Kt=new Uint8Array(32);function Et(e,t,i,n,s){s!==void 0&&j(s,void 0,"AAD");let o=e(t,i,Kt),f=xt(n.length,s?s.length:0,!0),r=Lt.create(o);s&&mt(r,s),mt(r,n),r.update(f);let c=r.digest();return V(o,f),c}var $t=e=>(t,i,n)=>({encrypt(o,f){let r=o.length;f=rt(r+16,f,!1),f.set(o);let c=f.subarray(0,-16);e(t,i,c,c,1);let u=Et(e,t,i,c,n);return f.set(u,r),V(u),f},decrypt(o,f){f=rt(o.length-16,f,!1);let r=o.subarray(0,-16),c=o.subarray(-16),u=Et(e,t,i,r,n);if(!pt(c,u))throw V(u),new Error("invalid tag");return f.set(o.subarray(0,-16)),e(t,i,f,f,1),V(u),f}});var Bt=gt({blockSize:64,nonceLength:24,tagLength:16},$t(zt));0&&(module.exports={xchacha20poly1305});
5
+ /*! Bundled license information:
6
+
7
+ @noble/ciphers/utils.js:
8
+ (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
9
+ */