@eventuras/fides-auth 0.3.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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +311 -0
  3. package/dist/build-CNL3v39v.js +977 -0
  4. package/dist/decode_jwt-1J26fl4I.js +25 -0
  5. package/dist/decrypt-Cahlu_6Y.js +92 -0
  6. package/dist/deflate-koSuX7FB.js +1015 -0
  7. package/dist/index.d.ts +11 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +6 -0
  10. package/dist/logger.d.ts +83 -0
  11. package/dist/logger.d.ts.map +1 -0
  12. package/dist/logger.js +46 -0
  13. package/dist/oauth-browser.d.ts +62 -0
  14. package/dist/oauth-browser.d.ts.map +1 -0
  15. package/dist/oauth-browser.js +49 -0
  16. package/dist/oauth.d.ts +145 -0
  17. package/dist/oauth.d.ts.map +1 -0
  18. package/dist/oauth.js +165 -0
  19. package/dist/providers/vipps/client.d.ts +62 -0
  20. package/dist/providers/vipps/client.d.ts.map +1 -0
  21. package/dist/providers/vipps/index.d.ts +11 -0
  22. package/dist/providers/vipps/index.d.ts.map +1 -0
  23. package/dist/providers/vipps/index.js +120 -0
  24. package/dist/providers/vipps/types.d.ts +107 -0
  25. package/dist/providers/vipps/types.d.ts.map +1 -0
  26. package/dist/rate-limit.d.ts +28 -0
  27. package/dist/rate-limit.d.ts.map +1 -0
  28. package/dist/rate-limit.js +26 -0
  29. package/dist/session-refresh.d.ts +13 -0
  30. package/dist/session-refresh.d.ts.map +1 -0
  31. package/dist/session-refresh.js +27 -0
  32. package/dist/session-validation-BxObT3wC.js +66 -0
  33. package/dist/session-validation.d.ts +24 -0
  34. package/dist/session-validation.d.ts.map +1 -0
  35. package/dist/session-validation.js +2 -0
  36. package/dist/silent-login.d.ts +103 -0
  37. package/dist/silent-login.d.ts.map +1 -0
  38. package/dist/silent-login.js +50 -0
  39. package/dist/types.d.ts +24 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +0 -0
  42. package/dist/utils-ByMRF7b2.js +379 -0
  43. package/dist/utils.d.ts +83 -0
  44. package/dist/utils.d.ts.map +1 -0
  45. package/dist/utils.js +2 -0
  46. package/package.json +101 -0
@@ -0,0 +1,1015 @@
1
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/buffer_utils.js
2
+ var e = new TextEncoder(), t = new TextDecoder(), n = 2 ** 32;
3
+ function r(...e) {
4
+ let t = e.reduce((e, { length: t }) => e + t, 0), n = new Uint8Array(t), r = 0;
5
+ for (let t of e) n.set(t, r), r += t.length;
6
+ return n;
7
+ }
8
+ function i(e, t, r) {
9
+ if (t < 0 || t >= n) throw RangeError(`value must be >= 0 and <= ${n - 1}. Received ${t}`);
10
+ e.set([
11
+ t >>> 24,
12
+ t >>> 16,
13
+ t >>> 8,
14
+ t & 255
15
+ ], r);
16
+ }
17
+ function a(e) {
18
+ let t = Math.floor(e / n), r = e % n, a = new Uint8Array(8);
19
+ return i(a, t, 0), i(a, r, 4), a;
20
+ }
21
+ function o(e) {
22
+ let t = new Uint8Array(4);
23
+ return i(t, e), t;
24
+ }
25
+ function s(e) {
26
+ let t = new Uint8Array(e.length);
27
+ for (let n = 0; n < e.length; n++) {
28
+ let r = e.charCodeAt(n);
29
+ if (r > 127) throw TypeError("non-ASCII string encountered in encode()");
30
+ t[n] = r;
31
+ }
32
+ return t;
33
+ }
34
+ //#endregion
35
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/base64.js
36
+ function c(e) {
37
+ if (Uint8Array.prototype.toBase64) return e.toBase64();
38
+ let t = 32768, n = [];
39
+ for (let r = 0; r < e.length; r += t) n.push(String.fromCharCode.apply(null, e.subarray(r, r + t)));
40
+ return btoa(n.join(""));
41
+ }
42
+ function l(e) {
43
+ if (Uint8Array.fromBase64) return Uint8Array.fromBase64(e);
44
+ let t = atob(e), n = new Uint8Array(t.length);
45
+ for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
46
+ return n;
47
+ }
48
+ //#endregion
49
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/util/base64url.js
50
+ function u(e) {
51
+ if (Uint8Array.fromBase64) return Uint8Array.fromBase64(typeof e == "string" ? e : t.decode(e), { alphabet: "base64url" });
52
+ let n = e;
53
+ n instanceof Uint8Array && (n = t.decode(n)), n = n.replace(/-/g, "+").replace(/_/g, "/");
54
+ try {
55
+ return l(n);
56
+ } catch {
57
+ throw TypeError("The input to be decoded is not correctly encoded.");
58
+ }
59
+ }
60
+ function d(t) {
61
+ let n = t;
62
+ return typeof n == "string" && (n = e.encode(n)), Uint8Array.prototype.toBase64 ? n.toBase64({
63
+ alphabet: "base64url",
64
+ omitPadding: !0
65
+ }) : c(n).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
66
+ }
67
+ //#endregion
68
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/crypto_key.js
69
+ var f = (e, t = "algorithm.name") => /* @__PURE__ */ TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`), p = (e, t) => e.name === t;
70
+ function ee(e) {
71
+ return parseInt(e.name.slice(4), 10);
72
+ }
73
+ function m(e, t) {
74
+ if (ee(e.hash) !== t) throw f(`SHA-${t}`, "algorithm.hash");
75
+ }
76
+ function h(e, t) {
77
+ if (t && !e.usages.includes(t)) throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`);
78
+ }
79
+ function g(e, t, n) {
80
+ switch (t) {
81
+ case "A128GCM":
82
+ case "A192GCM":
83
+ case "A256GCM": {
84
+ if (!p(e.algorithm, "AES-GCM")) throw f("AES-GCM");
85
+ let n = parseInt(t.slice(1, 4), 10);
86
+ if (e.algorithm.length !== n) throw f(n, "algorithm.length");
87
+ break;
88
+ }
89
+ case "A128KW":
90
+ case "A192KW":
91
+ case "A256KW": {
92
+ if (!p(e.algorithm, "AES-KW")) throw f("AES-KW");
93
+ let n = parseInt(t.slice(1, 4), 10);
94
+ if (e.algorithm.length !== n) throw f(n, "algorithm.length");
95
+ break;
96
+ }
97
+ case "ECDH":
98
+ switch (e.algorithm.name) {
99
+ case "ECDH":
100
+ case "X25519": break;
101
+ default: throw f("ECDH or X25519");
102
+ }
103
+ break;
104
+ case "PBES2-HS256+A128KW":
105
+ case "PBES2-HS384+A192KW":
106
+ case "PBES2-HS512+A256KW":
107
+ if (!p(e.algorithm, "PBKDF2")) throw f("PBKDF2");
108
+ break;
109
+ case "RSA-OAEP":
110
+ case "RSA-OAEP-256":
111
+ case "RSA-OAEP-384":
112
+ case "RSA-OAEP-512":
113
+ if (!p(e.algorithm, "RSA-OAEP")) throw f("RSA-OAEP");
114
+ m(e.algorithm, parseInt(t.slice(9), 10) || 1);
115
+ break;
116
+ default: throw TypeError("CryptoKey does not support this operation");
117
+ }
118
+ h(e, n);
119
+ }
120
+ //#endregion
121
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/invalid_key_input.js
122
+ function _(e, t, ...n) {
123
+ if (n = n.filter(Boolean), n.length > 2) {
124
+ let t = n.pop();
125
+ e += `one of type ${n.join(", ")}, or ${t}.`;
126
+ } else n.length === 2 ? e += `one of type ${n[0]} or ${n[1]}.` : e += `of type ${n[0]}.`;
127
+ return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t && t.constructor?.name && (e += ` Received an instance of ${t.constructor.name}`), e;
128
+ }
129
+ var v = (e, ...t) => _("Key must be ", e, ...t), te = (e, t, ...n) => _(`Key for the ${e} algorithm must be `, t, ...n), y = class extends Error {
130
+ static code = "ERR_JOSE_GENERIC";
131
+ code = "ERR_JOSE_GENERIC";
132
+ constructor(e, t) {
133
+ super(e, t), this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);
134
+ }
135
+ }, ne = class extends y {
136
+ static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
137
+ code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
138
+ claim;
139
+ reason;
140
+ payload;
141
+ constructor(e, t, n = "unspecified", r = "unspecified") {
142
+ super(e, { cause: {
143
+ claim: n,
144
+ reason: r,
145
+ payload: t
146
+ } }), this.claim = n, this.reason = r, this.payload = t;
147
+ }
148
+ }, re = class extends y {
149
+ static code = "ERR_JWT_EXPIRED";
150
+ code = "ERR_JWT_EXPIRED";
151
+ claim;
152
+ reason;
153
+ payload;
154
+ constructor(e, t, n = "unspecified", r = "unspecified") {
155
+ super(e, { cause: {
156
+ claim: n,
157
+ reason: r,
158
+ payload: t
159
+ } }), this.claim = n, this.reason = r, this.payload = t;
160
+ }
161
+ }, ie = class extends y {
162
+ static code = "ERR_JOSE_ALG_NOT_ALLOWED";
163
+ code = "ERR_JOSE_ALG_NOT_ALLOWED";
164
+ }, b = class extends y {
165
+ static code = "ERR_JOSE_NOT_SUPPORTED";
166
+ code = "ERR_JOSE_NOT_SUPPORTED";
167
+ }, x = class extends y {
168
+ static code = "ERR_JWE_DECRYPTION_FAILED";
169
+ code = "ERR_JWE_DECRYPTION_FAILED";
170
+ constructor(e = "decryption operation failed", t) {
171
+ super(e, t);
172
+ }
173
+ }, S = class extends y {
174
+ static code = "ERR_JWE_INVALID";
175
+ code = "ERR_JWE_INVALID";
176
+ }, ae = class extends y {
177
+ static code = "ERR_JWT_INVALID";
178
+ code = "ERR_JWT_INVALID";
179
+ };
180
+ //#endregion
181
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/is_key_like.js
182
+ function C(e) {
183
+ if (!w(e)) throw Error("CryptoKey instance expected");
184
+ }
185
+ var w = (e) => {
186
+ if (e?.[Symbol.toStringTag] === "CryptoKey") return !0;
187
+ try {
188
+ return e instanceof CryptoKey;
189
+ } catch {
190
+ return !1;
191
+ }
192
+ }, T = (e) => e?.[Symbol.toStringTag] === "KeyObject", oe = (e) => w(e) || T(e);
193
+ //#endregion
194
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/content_encryption.js
195
+ function E(e) {
196
+ switch (e) {
197
+ case "A128GCM": return 128;
198
+ case "A192GCM": return 192;
199
+ case "A256GCM":
200
+ case "A128CBC-HS256": return 256;
201
+ case "A192CBC-HS384": return 384;
202
+ case "A256CBC-HS512": return 512;
203
+ default: throw new b(`Unsupported JWE Algorithm: ${e}`);
204
+ }
205
+ }
206
+ var D = (e) => crypto.getRandomValues(new Uint8Array(E(e) >> 3));
207
+ function O(e, t) {
208
+ let n = e.byteLength << 3;
209
+ if (n !== t) throw new S(`Invalid Content Encryption Key length. Expected ${t} bits, got ${n} bits`);
210
+ }
211
+ function se(e) {
212
+ switch (e) {
213
+ case "A128GCM":
214
+ case "A128GCMKW":
215
+ case "A192GCM":
216
+ case "A192GCMKW":
217
+ case "A256GCM":
218
+ case "A256GCMKW": return 96;
219
+ case "A128CBC-HS256":
220
+ case "A192CBC-HS384":
221
+ case "A256CBC-HS512": return 128;
222
+ default: throw new b(`Unsupported JWE Algorithm: ${e}`);
223
+ }
224
+ }
225
+ var ce = (e) => crypto.getRandomValues(new Uint8Array(se(e) >> 3));
226
+ function k(e, t) {
227
+ if (t.length << 3 !== se(e)) throw new S("Invalid Initialization Vector length");
228
+ }
229
+ async function A(e, t, n) {
230
+ if (!(t instanceof Uint8Array)) throw TypeError(v(t, "Uint8Array"));
231
+ let r = parseInt(e.slice(1, 4), 10);
232
+ return {
233
+ encKey: await crypto.subtle.importKey("raw", t.subarray(r >> 3), "AES-CBC", !1, [n]),
234
+ macKey: await crypto.subtle.importKey("raw", t.subarray(0, r >> 3), {
235
+ hash: `SHA-${r << 1}`,
236
+ name: "HMAC"
237
+ }, !1, ["sign"]),
238
+ keySize: r
239
+ };
240
+ }
241
+ async function j(e, t, n) {
242
+ return new Uint8Array((await crypto.subtle.sign("HMAC", e, t)).slice(0, n >> 3));
243
+ }
244
+ async function le(e, t, n, i, o) {
245
+ let { encKey: s, macKey: c, keySize: l } = await A(e, n, "encrypt"), u = new Uint8Array(await crypto.subtle.encrypt({
246
+ iv: i,
247
+ name: "AES-CBC"
248
+ }, s, t));
249
+ return {
250
+ ciphertext: u,
251
+ tag: await j(c, r(o, i, u, a(o.length << 3)), l),
252
+ iv: i
253
+ };
254
+ }
255
+ async function ue(e, t) {
256
+ if (!(e instanceof Uint8Array)) throw TypeError("First argument must be a buffer");
257
+ if (!(t instanceof Uint8Array)) throw TypeError("Second argument must be a buffer");
258
+ let n = {
259
+ name: "HMAC",
260
+ hash: "SHA-256"
261
+ }, r = await crypto.subtle.generateKey(n, !1, ["sign"]), i = new Uint8Array(await crypto.subtle.sign(n, r, e)), a = new Uint8Array(await crypto.subtle.sign(n, r, t)), o = 0, s = -1;
262
+ for (; ++s < 32;) o |= i[s] ^ a[s];
263
+ return o === 0;
264
+ }
265
+ async function de(e, t, n, i, o, s) {
266
+ let { encKey: c, macKey: l, keySize: u } = await A(e, t, "decrypt"), d = await j(l, r(s, i, n, a(s.length << 3)), u), f;
267
+ try {
268
+ f = await ue(o, d);
269
+ } catch {}
270
+ if (!f) throw new x();
271
+ let p;
272
+ try {
273
+ p = new Uint8Array(await crypto.subtle.decrypt({
274
+ iv: i,
275
+ name: "AES-CBC"
276
+ }, c, n));
277
+ } catch {}
278
+ if (!p) throw new x();
279
+ return p;
280
+ }
281
+ async function fe(e, t, n, r, i) {
282
+ let a;
283
+ n instanceof Uint8Array ? a = await crypto.subtle.importKey("raw", n, "AES-GCM", !1, ["encrypt"]) : (g(n, e, "encrypt"), a = n);
284
+ let o = new Uint8Array(await crypto.subtle.encrypt({
285
+ additionalData: i,
286
+ iv: r,
287
+ name: "AES-GCM",
288
+ tagLength: 128
289
+ }, a, t)), s = o.slice(-16);
290
+ return {
291
+ ciphertext: o.slice(0, -16),
292
+ tag: s,
293
+ iv: r
294
+ };
295
+ }
296
+ async function pe(e, t, n, i, a, o) {
297
+ let s;
298
+ t instanceof Uint8Array ? s = await crypto.subtle.importKey("raw", t, "AES-GCM", !1, ["decrypt"]) : (g(t, e, "decrypt"), s = t);
299
+ try {
300
+ return new Uint8Array(await crypto.subtle.decrypt({
301
+ additionalData: o,
302
+ iv: i,
303
+ name: "AES-GCM",
304
+ tagLength: 128
305
+ }, s, r(n, a)));
306
+ } catch {
307
+ throw new x();
308
+ }
309
+ }
310
+ var M = "Unsupported JWE Content Encryption Algorithm";
311
+ async function N(e, t, n, r, i) {
312
+ if (!w(n) && !(n instanceof Uint8Array)) throw TypeError(v(n, "CryptoKey", "KeyObject", "Uint8Array", "JSON Web Key"));
313
+ switch (r ? k(e, r) : r = ce(e), e) {
314
+ case "A128CBC-HS256":
315
+ case "A192CBC-HS384":
316
+ case "A256CBC-HS512": return n instanceof Uint8Array && O(n, parseInt(e.slice(-3), 10)), le(e, t, n, r, i);
317
+ case "A128GCM":
318
+ case "A192GCM":
319
+ case "A256GCM": return n instanceof Uint8Array && O(n, parseInt(e.slice(1, 4), 10)), fe(e, t, n, r, i);
320
+ default: throw new b(M);
321
+ }
322
+ }
323
+ async function P(e, t, n, r, i, a) {
324
+ if (!w(t) && !(t instanceof Uint8Array)) throw TypeError(v(t, "CryptoKey", "KeyObject", "Uint8Array", "JSON Web Key"));
325
+ if (!r) throw new S("JWE Initialization Vector missing");
326
+ if (!i) throw new S("JWE Authentication Tag missing");
327
+ switch (k(e, r), e) {
328
+ case "A128CBC-HS256":
329
+ case "A192CBC-HS384":
330
+ case "A256CBC-HS512": return t instanceof Uint8Array && O(t, parseInt(e.slice(-3), 10)), de(e, t, n, r, i, a);
331
+ case "A128GCM":
332
+ case "A192GCM":
333
+ case "A256GCM": return t instanceof Uint8Array && O(t, parseInt(e.slice(1, 4), 10)), pe(e, t, n, r, i, a);
334
+ default: throw new b(M);
335
+ }
336
+ }
337
+ //#endregion
338
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/helpers.js
339
+ var me = Symbol();
340
+ function he(e, t) {
341
+ if (e) throw TypeError(`${t} can only be called once`);
342
+ }
343
+ function F(e, t, n) {
344
+ try {
345
+ return u(e);
346
+ } catch {
347
+ throw new n(`Failed to base64url decode the ${t}`);
348
+ }
349
+ }
350
+ async function ge(e, t) {
351
+ let n = `SHA-${e.slice(-3)}`;
352
+ return new Uint8Array(await crypto.subtle.digest(n, t));
353
+ }
354
+ //#endregion
355
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/type_checks.js
356
+ var _e = (e) => typeof e == "object" && !!e;
357
+ function I(e) {
358
+ if (!_e(e) || Object.prototype.toString.call(e) !== "[object Object]") return !1;
359
+ if (Object.getPrototypeOf(e) === null) return !0;
360
+ let t = e;
361
+ for (; Object.getPrototypeOf(t) !== null;) t = Object.getPrototypeOf(t);
362
+ return Object.getPrototypeOf(e) === t;
363
+ }
364
+ function ve(...e) {
365
+ let t = e.filter(Boolean);
366
+ if (t.length === 0 || t.length === 1) return !0;
367
+ let n;
368
+ for (let e of t) {
369
+ let t = Object.keys(e);
370
+ if (!n || n.size === 0) {
371
+ n = new Set(t);
372
+ continue;
373
+ }
374
+ for (let e of t) {
375
+ if (n.has(e)) return !1;
376
+ n.add(e);
377
+ }
378
+ }
379
+ return !0;
380
+ }
381
+ var L = (e) => I(e) && typeof e.kty == "string", ye = (e) => e.kty !== "oct" && (e.kty === "AKP" && typeof e.priv == "string" || typeof e.d == "string"), be = (e) => e.kty !== "oct" && e.d === void 0 && e.priv === void 0, xe = (e) => e.kty === "oct" && typeof e.k == "string";
382
+ //#endregion
383
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/aeskw.js
384
+ function R(e, t) {
385
+ if (e.algorithm.length !== parseInt(t.slice(1, 4), 10)) throw TypeError(`Invalid key size for alg: ${t}`);
386
+ }
387
+ function z(e, t, n) {
388
+ return e instanceof Uint8Array ? crypto.subtle.importKey("raw", e, "AES-KW", !0, [n]) : (g(e, t, n), e);
389
+ }
390
+ async function B(e, t, n) {
391
+ let r = await z(t, e, "wrapKey");
392
+ R(r, e);
393
+ let i = await crypto.subtle.importKey("raw", n, {
394
+ hash: "SHA-256",
395
+ name: "HMAC"
396
+ }, !0, ["sign"]);
397
+ return new Uint8Array(await crypto.subtle.wrapKey("raw", i, r, "AES-KW"));
398
+ }
399
+ async function V(e, t, n) {
400
+ let r = await z(t, e, "unwrapKey");
401
+ R(r, e);
402
+ let i = await crypto.subtle.unwrapKey("raw", n, r, "AES-KW", {
403
+ hash: "SHA-256",
404
+ name: "HMAC"
405
+ }, !0, ["sign"]);
406
+ return new Uint8Array(await crypto.subtle.exportKey("raw", i));
407
+ }
408
+ //#endregion
409
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/ecdhes.js
410
+ function H(e) {
411
+ return r(o(e.length), e);
412
+ }
413
+ async function Se(e, t, n) {
414
+ let r = t >> 3, i = Math.ceil(r / 32), a = new Uint8Array(i * 32);
415
+ for (let t = 1; t <= i; t++) {
416
+ let r = new Uint8Array(4 + e.length + n.length);
417
+ r.set(o(t), 0), r.set(e, 4), r.set(n, 4 + e.length);
418
+ let i = await ge("sha256", r);
419
+ a.set(i, (t - 1) * 32);
420
+ }
421
+ return a.slice(0, r);
422
+ }
423
+ async function U(e, t, n, i, a = new Uint8Array(), c = new Uint8Array()) {
424
+ g(e, "ECDH"), g(t, "ECDH", "deriveBits");
425
+ let l = r(H(s(n)), H(a), H(c), o(i), new Uint8Array());
426
+ return Se(new Uint8Array(await crypto.subtle.deriveBits({
427
+ name: e.algorithm.name,
428
+ public: e
429
+ }, t, Ce(e))), i, l);
430
+ }
431
+ function Ce(e) {
432
+ return e.algorithm.name === "X25519" ? 256 : Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3), 10) / 8) << 3;
433
+ }
434
+ function W(e) {
435
+ switch (e.algorithm.namedCurve) {
436
+ case "P-256":
437
+ case "P-384":
438
+ case "P-521": return !0;
439
+ default: return e.algorithm.name === "X25519";
440
+ }
441
+ }
442
+ //#endregion
443
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/pbes2kw.js
444
+ function we(e, t) {
445
+ return e instanceof Uint8Array ? crypto.subtle.importKey("raw", e, "PBKDF2", !1, ["deriveBits"]) : (g(e, t, "deriveBits"), e);
446
+ }
447
+ var Te = (e, t) => r(s(e), Uint8Array.of(0), t);
448
+ async function G(e, t, n, r) {
449
+ if (!(e instanceof Uint8Array) || e.length < 8) throw new S("PBES2 Salt Input must be 8 or more octets");
450
+ let i = Te(t, e), a = parseInt(t.slice(13, 16), 10), o = {
451
+ hash: `SHA-${t.slice(8, 11)}`,
452
+ iterations: n,
453
+ name: "PBKDF2",
454
+ salt: i
455
+ }, s = await we(r, t);
456
+ return new Uint8Array(await crypto.subtle.deriveBits(o, s, a));
457
+ }
458
+ async function Ee(e, t, n, r = 2048, i = crypto.getRandomValues(new Uint8Array(16))) {
459
+ let a = await G(i, e, r, t);
460
+ return {
461
+ encryptedKey: await B(e.slice(-6), a, n),
462
+ p2c: r,
463
+ p2s: d(i)
464
+ };
465
+ }
466
+ async function De(e, t, n, r, i) {
467
+ let a = await G(i, e, r, t);
468
+ return V(e.slice(-6), a, n);
469
+ }
470
+ //#endregion
471
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/signing.js
472
+ function K(e, t) {
473
+ if (e.startsWith("RS") || e.startsWith("PS")) {
474
+ let { modulusLength: n } = t.algorithm;
475
+ if (typeof n != "number" || n < 2048) throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
476
+ }
477
+ }
478
+ //#endregion
479
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/rsaes.js
480
+ var Oe = (e) => {
481
+ switch (e) {
482
+ case "RSA-OAEP":
483
+ case "RSA-OAEP-256":
484
+ case "RSA-OAEP-384":
485
+ case "RSA-OAEP-512": return "RSA-OAEP";
486
+ default: throw new b(`alg ${e} is not supported either by JOSE or your javascript runtime`);
487
+ }
488
+ };
489
+ async function ke(e, t, n) {
490
+ return g(t, e, "encrypt"), K(e, t), new Uint8Array(await crypto.subtle.encrypt(Oe(e), t, n));
491
+ }
492
+ async function Ae(e, t, n) {
493
+ return g(t, e, "decrypt"), K(e, t), new Uint8Array(await crypto.subtle.decrypt(Oe(e), t, n));
494
+ }
495
+ //#endregion
496
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/jwk_to_key.js
497
+ var q = "Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value";
498
+ function je(e) {
499
+ let t, n;
500
+ switch (e.kty) {
501
+ case "AKP":
502
+ switch (e.alg) {
503
+ case "ML-DSA-44":
504
+ case "ML-DSA-65":
505
+ case "ML-DSA-87":
506
+ t = { name: e.alg }, n = e.priv ? ["sign"] : ["verify"];
507
+ break;
508
+ default: throw new b(q);
509
+ }
510
+ break;
511
+ case "RSA":
512
+ switch (e.alg) {
513
+ case "PS256":
514
+ case "PS384":
515
+ case "PS512":
516
+ t = {
517
+ name: "RSA-PSS",
518
+ hash: `SHA-${e.alg.slice(-3)}`
519
+ }, n = e.d ? ["sign"] : ["verify"];
520
+ break;
521
+ case "RS256":
522
+ case "RS384":
523
+ case "RS512":
524
+ t = {
525
+ name: "RSASSA-PKCS1-v1_5",
526
+ hash: `SHA-${e.alg.slice(-3)}`
527
+ }, n = e.d ? ["sign"] : ["verify"];
528
+ break;
529
+ case "RSA-OAEP":
530
+ case "RSA-OAEP-256":
531
+ case "RSA-OAEP-384":
532
+ case "RSA-OAEP-512":
533
+ t = {
534
+ name: "RSA-OAEP",
535
+ hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
536
+ }, n = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
537
+ break;
538
+ default: throw new b(q);
539
+ }
540
+ break;
541
+ case "EC":
542
+ switch (e.alg) {
543
+ case "ES256":
544
+ case "ES384":
545
+ case "ES512":
546
+ t = {
547
+ name: "ECDSA",
548
+ namedCurve: {
549
+ ES256: "P-256",
550
+ ES384: "P-384",
551
+ ES512: "P-521"
552
+ }[e.alg]
553
+ }, n = e.d ? ["sign"] : ["verify"];
554
+ break;
555
+ case "ECDH-ES":
556
+ case "ECDH-ES+A128KW":
557
+ case "ECDH-ES+A192KW":
558
+ case "ECDH-ES+A256KW":
559
+ t = {
560
+ name: "ECDH",
561
+ namedCurve: e.crv
562
+ }, n = e.d ? ["deriveBits"] : [];
563
+ break;
564
+ default: throw new b(q);
565
+ }
566
+ break;
567
+ case "OKP":
568
+ switch (e.alg) {
569
+ case "Ed25519":
570
+ case "EdDSA":
571
+ t = { name: "Ed25519" }, n = e.d ? ["sign"] : ["verify"];
572
+ break;
573
+ case "ECDH-ES":
574
+ case "ECDH-ES+A128KW":
575
+ case "ECDH-ES+A192KW":
576
+ case "ECDH-ES+A256KW":
577
+ t = { name: e.crv }, n = e.d ? ["deriveBits"] : [];
578
+ break;
579
+ default: throw new b(q);
580
+ }
581
+ break;
582
+ default: throw new b("Invalid or unsupported JWK \"kty\" (Key Type) Parameter value");
583
+ }
584
+ return {
585
+ algorithm: t,
586
+ keyUsages: n
587
+ };
588
+ }
589
+ async function J(e) {
590
+ if (!e.alg) throw TypeError("\"alg\" argument is required when \"jwk.alg\" is not present");
591
+ let { algorithm: t, keyUsages: n } = je(e), r = { ...e };
592
+ return r.kty !== "AKP" && delete r.alg, delete r.use, crypto.subtle.importKey("jwk", r, t, e.ext ?? !(e.d || e.priv), e.key_ops ?? n);
593
+ }
594
+ //#endregion
595
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/normalize_key.js
596
+ var Y = "given KeyObject instance cannot be used for this algorithm", X, Me = async (e, t, n, r = !1) => {
597
+ X ||= /* @__PURE__ */ new WeakMap();
598
+ let i = X.get(e);
599
+ if (i?.[n]) return i[n];
600
+ let a = await J({
601
+ ...t,
602
+ alg: n
603
+ });
604
+ return r && Object.freeze(e), i ? i[n] = a : X.set(e, { [n]: a }), a;
605
+ }, Ne = (e, t) => {
606
+ X ||= /* @__PURE__ */ new WeakMap();
607
+ let n = X.get(e);
608
+ if (n?.[t]) return n[t];
609
+ let r = e.type === "public", i = !!r, a;
610
+ if (e.asymmetricKeyType === "x25519") {
611
+ switch (t) {
612
+ case "ECDH-ES":
613
+ case "ECDH-ES+A128KW":
614
+ case "ECDH-ES+A192KW":
615
+ case "ECDH-ES+A256KW": break;
616
+ default: throw TypeError(Y);
617
+ }
618
+ a = e.toCryptoKey(e.asymmetricKeyType, i, r ? [] : ["deriveBits"]);
619
+ }
620
+ if (e.asymmetricKeyType === "ed25519") {
621
+ if (t !== "EdDSA" && t !== "Ed25519") throw TypeError(Y);
622
+ a = e.toCryptoKey(e.asymmetricKeyType, i, [r ? "verify" : "sign"]);
623
+ }
624
+ switch (e.asymmetricKeyType) {
625
+ case "ml-dsa-44":
626
+ case "ml-dsa-65":
627
+ case "ml-dsa-87":
628
+ if (t !== e.asymmetricKeyType.toUpperCase()) throw TypeError(Y);
629
+ a = e.toCryptoKey(e.asymmetricKeyType, i, [r ? "verify" : "sign"]);
630
+ }
631
+ if (e.asymmetricKeyType === "rsa") {
632
+ let n;
633
+ switch (t) {
634
+ case "RSA-OAEP":
635
+ n = "SHA-1";
636
+ break;
637
+ case "RS256":
638
+ case "PS256":
639
+ case "RSA-OAEP-256":
640
+ n = "SHA-256";
641
+ break;
642
+ case "RS384":
643
+ case "PS384":
644
+ case "RSA-OAEP-384":
645
+ n = "SHA-384";
646
+ break;
647
+ case "RS512":
648
+ case "PS512":
649
+ case "RSA-OAEP-512":
650
+ n = "SHA-512";
651
+ break;
652
+ default: throw TypeError(Y);
653
+ }
654
+ if (t.startsWith("RSA-OAEP")) return e.toCryptoKey({
655
+ name: "RSA-OAEP",
656
+ hash: n
657
+ }, i, r ? ["encrypt"] : ["decrypt"]);
658
+ a = e.toCryptoKey({
659
+ name: t.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
660
+ hash: n
661
+ }, i, [r ? "verify" : "sign"]);
662
+ }
663
+ if (e.asymmetricKeyType === "ec") {
664
+ let n = new Map([
665
+ ["prime256v1", "P-256"],
666
+ ["secp384r1", "P-384"],
667
+ ["secp521r1", "P-521"]
668
+ ]).get(e.asymmetricKeyDetails?.namedCurve);
669
+ if (!n) throw TypeError(Y);
670
+ let o = {
671
+ ES256: "P-256",
672
+ ES384: "P-384",
673
+ ES512: "P-521"
674
+ };
675
+ o[t] && n === o[t] && (a = e.toCryptoKey({
676
+ name: "ECDSA",
677
+ namedCurve: n
678
+ }, i, [r ? "verify" : "sign"])), t.startsWith("ECDH-ES") && (a = e.toCryptoKey({
679
+ name: "ECDH",
680
+ namedCurve: n
681
+ }, i, r ? [] : ["deriveBits"]));
682
+ }
683
+ if (!a) throw TypeError(Y);
684
+ return n ? n[t] = a : X.set(e, { [t]: a }), a;
685
+ };
686
+ async function Pe(e, t) {
687
+ if (e instanceof Uint8Array || w(e)) return e;
688
+ if (T(e)) {
689
+ if (e.type === "secret") return e.export();
690
+ if ("toCryptoKey" in e && typeof e.toCryptoKey == "function") try {
691
+ return Ne(e, t);
692
+ } catch (e) {
693
+ if (e instanceof TypeError) throw e;
694
+ }
695
+ return Me(e, e.export({ format: "jwk" }), t);
696
+ }
697
+ if (L(e)) return e.k ? u(e.k) : Me(e, e, t, !0);
698
+ throw Error("unreachable");
699
+ }
700
+ //#endregion
701
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/key/import.js
702
+ async function Fe(e, t, n) {
703
+ if (!I(e)) throw TypeError("JWK must be an object");
704
+ let r;
705
+ switch (t ??= e.alg, r ??= n?.extractable ?? e.ext, e.kty) {
706
+ case "oct":
707
+ if (typeof e.k != "string" || !e.k) throw TypeError("missing \"k\" (Key Value) Parameter value");
708
+ return u(e.k);
709
+ case "RSA":
710
+ if ("oth" in e && e.oth !== void 0) throw new b("RSA JWK \"oth\" (Other Primes Info) Parameter value is not supported");
711
+ return J({
712
+ ...e,
713
+ alg: t,
714
+ ext: r
715
+ });
716
+ case "AKP":
717
+ if (typeof e.alg != "string" || !e.alg) throw TypeError("missing \"alg\" (Algorithm) Parameter value");
718
+ if (t !== void 0 && t !== e.alg) throw TypeError("JWK alg and alg option value mismatch");
719
+ return J({
720
+ ...e,
721
+ ext: r
722
+ });
723
+ case "EC":
724
+ case "OKP": return J({
725
+ ...e,
726
+ alg: t,
727
+ ext: r
728
+ });
729
+ default: throw new b("Unsupported \"kty\" (Key Type) Parameter value");
730
+ }
731
+ }
732
+ //#endregion
733
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/key_to_jwk.js
734
+ async function Ie(e) {
735
+ if (T(e)) if (e.type === "secret") e = e.export();
736
+ else return e.export({ format: "jwk" });
737
+ if (e instanceof Uint8Array) return {
738
+ kty: "oct",
739
+ k: d(e)
740
+ };
741
+ if (!w(e)) throw TypeError(v(e, "CryptoKey", "KeyObject", "Uint8Array"));
742
+ if (!e.extractable) throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");
743
+ let { ext: t, key_ops: n, alg: r, use: i, ...a } = await crypto.subtle.exportKey("jwk", e);
744
+ return a.kty === "AKP" && (a.alg = r), a;
745
+ }
746
+ //#endregion
747
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/key/export.js
748
+ async function Le(e) {
749
+ return Ie(e);
750
+ }
751
+ //#endregion
752
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/aesgcmkw.js
753
+ async function Re(e, t, n, r) {
754
+ let i = await N(e.slice(0, 7), n, t, r, new Uint8Array());
755
+ return {
756
+ encryptedKey: i.ciphertext,
757
+ iv: d(i.iv),
758
+ tag: d(i.tag)
759
+ };
760
+ }
761
+ async function ze(e, t, n, r, i) {
762
+ return P(e.slice(0, 7), t, n, r, i, new Uint8Array());
763
+ }
764
+ //#endregion
765
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/key_management.js
766
+ var Be = "Invalid or unsupported \"alg\" (JWE Algorithm) header value";
767
+ function Z(e) {
768
+ if (e === void 0) throw new S("JWE Encrypted Key missing");
769
+ }
770
+ async function Ve(e, t, n, r, i) {
771
+ switch (e) {
772
+ case "dir":
773
+ if (n !== void 0) throw new S("Encountered unexpected JWE Encrypted Key");
774
+ return t;
775
+ case "ECDH-ES": if (n !== void 0) throw new S("Encountered unexpected JWE Encrypted Key");
776
+ case "ECDH-ES+A128KW":
777
+ case "ECDH-ES+A192KW":
778
+ case "ECDH-ES+A256KW": {
779
+ if (!I(r.epk)) throw new S("JOSE Header \"epk\" (Ephemeral Public Key) missing or invalid");
780
+ if (C(t), !W(t)) throw new b("ECDH with the provided key is not allowed or not supported by your javascript runtime");
781
+ let i = await Fe(r.epk, e);
782
+ C(i);
783
+ let a, o;
784
+ if (r.apu !== void 0) {
785
+ if (typeof r.apu != "string") throw new S("JOSE Header \"apu\" (Agreement PartyUInfo) invalid");
786
+ a = F(r.apu, "apu", S);
787
+ }
788
+ if (r.apv !== void 0) {
789
+ if (typeof r.apv != "string") throw new S("JOSE Header \"apv\" (Agreement PartyVInfo) invalid");
790
+ o = F(r.apv, "apv", S);
791
+ }
792
+ let s = await U(i, t, e === "ECDH-ES" ? r.enc : e, e === "ECDH-ES" ? E(r.enc) : parseInt(e.slice(-5, -2), 10), a, o);
793
+ return e === "ECDH-ES" ? s : (Z(n), V(e.slice(-6), s, n));
794
+ }
795
+ case "RSA-OAEP":
796
+ case "RSA-OAEP-256":
797
+ case "RSA-OAEP-384":
798
+ case "RSA-OAEP-512": return Z(n), C(t), Ae(e, t, n);
799
+ case "PBES2-HS256+A128KW":
800
+ case "PBES2-HS384+A192KW":
801
+ case "PBES2-HS512+A256KW": {
802
+ if (Z(n), typeof r.p2c != "number") throw new S("JOSE Header \"p2c\" (PBES2 Count) missing or invalid");
803
+ let a = i?.maxPBES2Count || 1e4;
804
+ if (r.p2c > a) throw new S("JOSE Header \"p2c\" (PBES2 Count) out is of acceptable bounds");
805
+ if (typeof r.p2s != "string") throw new S("JOSE Header \"p2s\" (PBES2 Salt) missing or invalid");
806
+ let o;
807
+ return o = F(r.p2s, "p2s", S), De(e, t, n, r.p2c, o);
808
+ }
809
+ case "A128KW":
810
+ case "A192KW":
811
+ case "A256KW": return Z(n), V(e, t, n);
812
+ case "A128GCMKW":
813
+ case "A192GCMKW":
814
+ case "A256GCMKW": {
815
+ if (Z(n), typeof r.iv != "string") throw new S("JOSE Header \"iv\" (Initialization Vector) missing or invalid");
816
+ if (typeof r.tag != "string") throw new S("JOSE Header \"tag\" (Authentication Tag) missing or invalid");
817
+ let i;
818
+ i = F(r.iv, "iv", S);
819
+ let a;
820
+ return a = F(r.tag, "tag", S), ze(e, t, n, i, a);
821
+ }
822
+ default: throw new b(Be);
823
+ }
824
+ }
825
+ async function He(e, t, n, r, i = {}) {
826
+ let a, o, s;
827
+ switch (e) {
828
+ case "dir":
829
+ s = n;
830
+ break;
831
+ case "ECDH-ES":
832
+ case "ECDH-ES+A128KW":
833
+ case "ECDH-ES+A192KW":
834
+ case "ECDH-ES+A256KW": {
835
+ if (C(n), !W(n)) throw new b("ECDH with the provided key is not allowed or not supported by your javascript runtime");
836
+ let { apu: c, apv: l } = i, u;
837
+ u = i.epk ? await Pe(i.epk, e) : (await crypto.subtle.generateKey(n.algorithm, !0, ["deriveBits"])).privateKey;
838
+ let { x: f, y: p, crv: ee, kty: m } = await Le(u), h = await U(n, u, e === "ECDH-ES" ? t : e, e === "ECDH-ES" ? E(t) : parseInt(e.slice(-5, -2), 10), c, l);
839
+ if (o = { epk: {
840
+ x: f,
841
+ crv: ee,
842
+ kty: m
843
+ } }, m === "EC" && (o.epk.y = p), c && (o.apu = d(c)), l && (o.apv = d(l)), e === "ECDH-ES") {
844
+ s = h;
845
+ break;
846
+ }
847
+ s = r || D(t), a = await B(e.slice(-6), h, s);
848
+ break;
849
+ }
850
+ case "RSA-OAEP":
851
+ case "RSA-OAEP-256":
852
+ case "RSA-OAEP-384":
853
+ case "RSA-OAEP-512":
854
+ s = r || D(t), C(n), a = await ke(e, n, s);
855
+ break;
856
+ case "PBES2-HS256+A128KW":
857
+ case "PBES2-HS384+A192KW":
858
+ case "PBES2-HS512+A256KW": {
859
+ s = r || D(t);
860
+ let { p2c: c, p2s: l } = i;
861
+ ({encryptedKey: a, ...o} = await Ee(e, n, s, c, l));
862
+ break;
863
+ }
864
+ case "A128KW":
865
+ case "A192KW":
866
+ case "A256KW":
867
+ s = r || D(t), a = await B(e, n, s);
868
+ break;
869
+ case "A128GCMKW":
870
+ case "A192GCMKW":
871
+ case "A256GCMKW": {
872
+ s = r || D(t);
873
+ let { iv: c } = i;
874
+ ({encryptedKey: a, ...o} = await Re(e, n, s, c));
875
+ break;
876
+ }
877
+ default: throw new b(Be);
878
+ }
879
+ return {
880
+ cek: s,
881
+ encryptedKey: a,
882
+ parameters: o
883
+ };
884
+ }
885
+ //#endregion
886
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/validate_crit.js
887
+ function Ue(e, t, n, r, i) {
888
+ if (i.crit !== void 0 && r?.crit === void 0) throw new e("\"crit\" (Critical) Header Parameter MUST be integrity protected");
889
+ if (!r || r.crit === void 0) return /* @__PURE__ */ new Set();
890
+ if (!Array.isArray(r.crit) || r.crit.length === 0 || r.crit.some((e) => typeof e != "string" || e.length === 0)) throw new e("\"crit\" (Critical) Header Parameter MUST be an array of non-empty strings when present");
891
+ let a;
892
+ a = n === void 0 ? t : new Map([...Object.entries(n), ...t.entries()]);
893
+ for (let t of r.crit) {
894
+ if (!a.has(t)) throw new b(`Extension Header Parameter "${t}" is not recognized`);
895
+ if (i[t] === void 0) throw new e(`Extension Header Parameter "${t}" is missing`);
896
+ if (a.get(t) && r[t] === void 0) throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`);
897
+ }
898
+ return new Set(r.crit);
899
+ }
900
+ //#endregion
901
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/check_key_type.js
902
+ var Q = (e) => e?.[Symbol.toStringTag], $ = (e, t, n) => {
903
+ if (t.use !== void 0) {
904
+ let e;
905
+ switch (n) {
906
+ case "sign":
907
+ case "verify":
908
+ e = "sig";
909
+ break;
910
+ case "encrypt":
911
+ case "decrypt":
912
+ e = "enc";
913
+ break;
914
+ }
915
+ if (t.use !== e) throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`);
916
+ }
917
+ if (t.alg !== void 0 && t.alg !== e) throw TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);
918
+ if (Array.isArray(t.key_ops)) {
919
+ let r;
920
+ switch (!0) {
921
+ case n === "sign" || n === "verify":
922
+ case e === "dir":
923
+ case e.includes("CBC-HS"):
924
+ r = n;
925
+ break;
926
+ case e.startsWith("PBES2"):
927
+ r = "deriveBits";
928
+ break;
929
+ case /^A\d{3}(?:GCM)?(?:KW)?$/.test(e):
930
+ r = !e.includes("GCM") && e.endsWith("KW") ? n === "encrypt" ? "wrapKey" : "unwrapKey" : n;
931
+ break;
932
+ case n === "encrypt" && e.startsWith("RSA"):
933
+ r = "wrapKey";
934
+ break;
935
+ case n === "decrypt":
936
+ r = e.startsWith("RSA") ? "unwrapKey" : "deriveBits";
937
+ break;
938
+ }
939
+ if (r && t.key_ops?.includes?.(r) === !1) throw TypeError(`Invalid key for this operation, its "key_ops" must include "${r}" when present`);
940
+ }
941
+ return !0;
942
+ }, We = (e, t, n) => {
943
+ if (!(t instanceof Uint8Array)) {
944
+ if (L(t)) {
945
+ if (xe(t) && $(e, t, n)) return;
946
+ throw TypeError("JSON Web Key for symmetric algorithms must have JWK \"kty\" (Key Type) equal to \"oct\" and the JWK \"k\" (Key Value) present");
947
+ }
948
+ if (!oe(t)) throw TypeError(te(e, t, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
949
+ if (t.type !== "secret") throw TypeError(`${Q(t)} instances for symmetric algorithms must be of type "secret"`);
950
+ }
951
+ }, Ge = (e, t, n) => {
952
+ if (L(t)) switch (n) {
953
+ case "decrypt":
954
+ case "sign":
955
+ if (ye(t) && $(e, t, n)) return;
956
+ throw TypeError("JSON Web Key for this operation must be a private JWK");
957
+ case "encrypt":
958
+ case "verify":
959
+ if (be(t) && $(e, t, n)) return;
960
+ throw TypeError("JSON Web Key for this operation must be a public JWK");
961
+ }
962
+ if (!oe(t)) throw TypeError(te(e, t, "CryptoKey", "KeyObject", "JSON Web Key"));
963
+ if (t.type === "secret") throw TypeError(`${Q(t)} instances for asymmetric algorithms must not be of type "secret"`);
964
+ if (t.type === "public") switch (n) {
965
+ case "sign": throw TypeError(`${Q(t)} instances for asymmetric algorithm signing must be of type "private"`);
966
+ case "decrypt": throw TypeError(`${Q(t)} instances for asymmetric algorithm decryption must be of type "private"`);
967
+ }
968
+ if (t.type === "private") switch (n) {
969
+ case "verify": throw TypeError(`${Q(t)} instances for asymmetric algorithm verifying must be of type "public"`);
970
+ case "encrypt": throw TypeError(`${Q(t)} instances for asymmetric algorithm encryption must be of type "public"`);
971
+ }
972
+ };
973
+ function Ke(e, t, n) {
974
+ switch (e.substring(0, 2)) {
975
+ case "A1":
976
+ case "A2":
977
+ case "di":
978
+ case "HS":
979
+ case "PB":
980
+ We(e, t, n);
981
+ break;
982
+ default: Ge(e, t, n);
983
+ }
984
+ }
985
+ //#endregion
986
+ //#region ../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/webapi/lib/deflate.js
987
+ function qe(e) {
988
+ if (globalThis[e] === void 0) throw new b(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`);
989
+ }
990
+ async function Je(e) {
991
+ qe("CompressionStream");
992
+ let t = new CompressionStream("deflate-raw"), n = t.writable.getWriter();
993
+ n.write(e).catch(() => {}), n.close().catch(() => {});
994
+ let i = [], a = t.readable.getReader();
995
+ for (;;) {
996
+ let { value: e, done: t } = await a.read();
997
+ if (t) break;
998
+ i.push(e);
999
+ }
1000
+ return r(...i);
1001
+ }
1002
+ async function Ye(e, t) {
1003
+ qe("DecompressionStream");
1004
+ let n = new DecompressionStream("deflate-raw"), i = n.writable.getWriter();
1005
+ i.write(e).catch(() => {}), i.close().catch(() => {});
1006
+ let a = [], o = 0, s = n.readable.getReader();
1007
+ for (;;) {
1008
+ let { value: e, done: n } = await s.read();
1009
+ if (n) break;
1010
+ if (a.push(e), o += e.byteLength, t !== Infinity && o > t) throw new S("Decompressed plaintext exceeded the configured limit");
1011
+ }
1012
+ return r(...a);
1013
+ }
1014
+ //#endregion
1015
+ export { d as C, e as D, s as E, u as S, t as T, b as _, Ve as a, re as b, ve as c, F as d, me as f, ie as g, D as h, Ue as i, I as l, N as m, Ye as n, He as o, P as p, Ke as r, Pe as s, Je as t, he as u, S as v, r as w, ae as x, ne as y };