@introspection-ai/recipes 0.36.2 → 0.38.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 (141) hide show
  1. package/dist/ask-user-question.d.ts +82 -0
  2. package/dist/ask-user-question.d.ts.map +1 -0
  3. package/dist/ask-user-question.js +314 -0
  4. package/dist/ask-user-question.js.map +1 -0
  5. package/dist/connector-tools.d.ts.map +1 -1
  6. package/dist/connector-tools.js +10 -2
  7. package/dist/connector-tools.js.map +1 -1
  8. package/dist/documents/index.d.ts +7 -0
  9. package/dist/documents/index.d.ts.map +1 -0
  10. package/dist/documents/index.js +4 -0
  11. package/dist/documents/index.js.map +1 -0
  12. package/dist/documents/module.d.ts +61 -0
  13. package/dist/documents/module.d.ts.map +1 -0
  14. package/dist/documents/module.js +133 -0
  15. package/dist/documents/module.js.map +1 -0
  16. package/dist/documents/profile.d.ts +34 -0
  17. package/dist/documents/profile.d.ts.map +1 -0
  18. package/dist/documents/profile.js +94 -0
  19. package/dist/documents/profile.js.map +1 -0
  20. package/dist/documents/tools.d.ts +40 -0
  21. package/dist/documents/tools.d.ts.map +1 -0
  22. package/dist/documents/tools.js +327 -0
  23. package/dist/documents/tools.js.map +1 -0
  24. package/dist/documents/types.d.ts +144 -0
  25. package/dist/documents/types.d.ts.map +1 -0
  26. package/dist/documents/types.js +10 -0
  27. package/dist/documents/types.js.map +1 -0
  28. package/dist/extensions.d.ts +2 -0
  29. package/dist/extensions.d.ts.map +1 -1
  30. package/dist/extensions.js +3 -0
  31. package/dist/extensions.js.map +1 -1
  32. package/dist/interaction-tui.d.ts +1 -1
  33. package/dist/interaction-tui.d.ts.map +1 -1
  34. package/dist/interaction-tui.js +2 -2
  35. package/dist/interaction-tui.js.map +1 -1
  36. package/dist/mcp-chunks/{auth-command-GMMLBU24.js → auth-command-M7TQE3AL.js} +26 -23
  37. package/dist/mcp-chunks/call-arguments-GCXZA4HC.js +16 -0
  38. package/dist/mcp-chunks/{call-command-2VF6IKAZ.js → call-command-7LD7UEFK.js} +33 -33
  39. package/dist/mcp-chunks/{chunk-TYL2NVXI.js → chunk-2AKSS7WR.js} +2 -2
  40. package/dist/mcp-chunks/{chunk-LZUKBEQZ.js → chunk-2YV72LUA.js} +12 -12
  41. package/dist/mcp-chunks/{chunk-2JTXIMGE.js → chunk-3ETUDW7N.js} +1 -1
  42. package/dist/mcp-chunks/{chunk-5UK2JLTN.js → chunk-3FRLDHVD.js} +5 -5
  43. package/dist/mcp-chunks/{chunk-ENBJFQ6H.js → chunk-3HSC6NHZ.js} +1 -1
  44. package/dist/mcp-chunks/{chunk-IHOU2BEL.js → chunk-3LENTPGE.js} +2 -2
  45. package/dist/mcp-chunks/{chunk-ZJWZY54X.js → chunk-3P3KGT4H.js} +2 -2
  46. package/dist/mcp-chunks/{chunk-IMXPLUKE.js → chunk-3SXP4S2A.js} +2 -2
  47. package/dist/mcp-chunks/{chunk-22WCLO4D.js → chunk-5Z6WSV5D.js} +5 -5
  48. package/dist/mcp-chunks/{chunk-QNZGFUKC.js → chunk-63L6SHK3.js} +2 -2
  49. package/dist/mcp-chunks/{chunk-OI3RTQXY.js → chunk-66VSGFXA.js} +1 -1
  50. package/dist/mcp-chunks/{chunk-DUBQHYW4.js → chunk-6O42UGLI.js} +9 -9
  51. package/dist/mcp-chunks/{chunk-R4OYHQ4V.js → chunk-6P3KAQ5N.js} +1 -1
  52. package/dist/mcp-chunks/{chunk-5OO6WVPL.js → chunk-7U5NSQ5T.js} +1 -1
  53. package/dist/mcp-chunks/{chunk-O2C3HXGS.js → chunk-B6S43WID.js} +1 -1
  54. package/dist/mcp-chunks/{chunk-VWPKJFK4.js → chunk-BHXCAVFP.js} +1 -1
  55. package/dist/mcp-chunks/{chunk-WXNGATQ7.js → chunk-BUOGKTKK.js} +2 -1
  56. package/dist/mcp-chunks/{chunk-4U4BUXQD.js → chunk-CXST5CVH.js} +33 -17
  57. package/dist/mcp-chunks/{chunk-YWFQPA4D.js → chunk-DU4SDPEV.js} +2 -2
  58. package/dist/mcp-chunks/{chunk-ZI5XYM4C.js → chunk-E76ZUBOJ.js} +4 -4
  59. package/dist/mcp-chunks/{chunk-D2SZ7KRY.js → chunk-ELHS763C.js} +1 -1
  60. package/dist/mcp-chunks/chunk-EQCSXVQ7.js +10650 -0
  61. package/dist/mcp-chunks/{chunk-RHXZKYM7.js → chunk-F2X4Y2TQ.js} +1 -1
  62. package/dist/mcp-chunks/{chunk-6XC5JJWD.js → chunk-GTETFUPQ.js} +28 -25
  63. package/dist/mcp-chunks/{chunk-UQUM7ICD.js → chunk-GZ53GNFP.js} +10 -10
  64. package/dist/mcp-chunks/{chunk-LUVLTUKR.js → chunk-H5PBSJP3.js} +1 -1
  65. package/dist/mcp-chunks/{chunk-FLUF2FRN.js → chunk-HNQSUT44.js} +3 -3
  66. package/dist/mcp-chunks/{chunk-CN5KSNWG.js → chunk-I6UFV7RW.js} +1 -1
  67. package/dist/mcp-chunks/{chunk-OSTHIELS.js → chunk-IRARVOUM.js} +1 -1
  68. package/dist/mcp-chunks/{webapi-NNCZGUMZ.js → chunk-IRSL7JRH.js} +255 -249
  69. package/dist/mcp-chunks/{chunk-ZXIF7MKN.js → chunk-IWCVZ46B.js} +2 -2
  70. package/dist/mcp-chunks/{chunk-RZZO3ZD4.js → chunk-JEHI2YU4.js} +3 -3
  71. package/dist/mcp-chunks/{chunk-ANNJGB6F.js → chunk-JTPTAO4M.js} +13 -13
  72. package/dist/mcp-chunks/{chunk-U5QZHPCC.js → chunk-KJ5FPQF6.js} +1 -1
  73. package/dist/mcp-chunks/{chunk-7IVXKYTI.js → chunk-L2MSWQDL.js} +1 -1
  74. package/dist/mcp-chunks/{chunk-DBNBEWRX.js → chunk-MEQXX43K.js} +1 -1
  75. package/dist/mcp-chunks/{chunk-3AAF3FSI.js → chunk-MHUMLEBO.js} +1 -1
  76. package/dist/mcp-chunks/{chunk-HFHIY5TO.js → chunk-N2U2FODH.js} +4 -4
  77. package/dist/mcp-chunks/{chunk-YFCNRWLV.js → chunk-N6YUOYDS.js} +2 -2
  78. package/dist/mcp-chunks/{chunk-C4TJGC4F.js → chunk-O3RTM5HD.js} +1 -1
  79. package/dist/mcp-chunks/{chunk-35LLRCRA.js → chunk-O7SIXJM6.js} +1308 -912
  80. package/dist/mcp-chunks/{chunk-QDFL757K.js → chunk-PSE442BC.js} +91 -77
  81. package/dist/mcp-chunks/{chunk-YPSODIQX.js → chunk-QNXOIF5U.js} +15 -14
  82. package/dist/mcp-chunks/{chunk-RKQC2EE6.js → chunk-RUF27IUF.js} +2 -2
  83. package/dist/mcp-chunks/{chunk-SS7V7GVT.js → chunk-S2F7DDP5.js} +4 -4
  84. package/dist/mcp-chunks/{chunk-D65GOMYV.js → chunk-TC2JPBFB.js} +2 -2
  85. package/dist/mcp-chunks/{chunk-7BVYBZ4J.js → chunk-THRMUZZD.js} +39 -14
  86. package/dist/mcp-chunks/{chunk-P5YLK5G2.js → chunk-UFV6SVQG.js} +11 -11
  87. package/dist/mcp-chunks/{chunk-LISNXOIQ.js → chunk-US63Y6XE.js} +1 -1
  88. package/dist/mcp-chunks/{chunk-HI6VG5LR.js → chunk-UVRJ3AAD.js} +2 -2
  89. package/dist/mcp-chunks/{chunk-6TIU2CDB.js → chunk-V42T3QNK.js} +456 -64
  90. package/dist/mcp-chunks/{chunk-347GOMV4.js → chunk-WDWSA7RL.js} +4 -4
  91. package/dist/mcp-chunks/{chunk-4PN2J74H.js → chunk-WQL7FJQ3.js} +4 -4
  92. package/dist/mcp-chunks/{chunk-LRGMFF5S.js → chunk-ZEA3Y5ZD.js} +7 -7
  93. package/dist/mcp-chunks/{cli-4OQD3H4N.js → cli-IYD7Y7MO.js} +67 -67
  94. package/dist/mcp-chunks/client-5MNBV3Z7.js +32 -0
  95. package/dist/mcp-chunks/{config-command-72TCIWPV.js → config-command-6DXILFNO.js} +129 -34
  96. package/dist/mcp-chunks/daemon-command-V3B3EMXD.js +32 -0
  97. package/dist/mcp-chunks/{dist-74UCKZK5.js → dist-Q7WSCBBK.js} +74 -55
  98. package/dist/mcp-chunks/{emit-ts-command-KD4ON2SE.js → emit-ts-command-NDCDFDRM.js} +17 -17
  99. package/dist/mcp-chunks/{generate-cli-runner-HWGI6HPL.js → generate-cli-runner-PW5WJ7KI.js} +136 -92
  100. package/dist/mcp-chunks/generated-daemon-runtime-3C4NWGAU.js +32 -0
  101. package/dist/mcp-chunks/{inspect-cli-command-FT5JSB7V.js → inspect-cli-command-4MGF5CPP.js} +9 -9
  102. package/dist/mcp-chunks/{launch-AHLKP2VM.js → launch-UG7IH27P.js} +1 -1
  103. package/dist/mcp-chunks/{lifecycle-BJDITFWN.js → lifecycle-QBYGUHQ3.js} +1 -1
  104. package/dist/mcp-chunks/{list-command-YKF7RN6Y.js → list-command-SDITI3ZM.js} +36 -35
  105. package/dist/mcp-chunks/{output-utils-LYB5IJRD.js → output-utils-YTMZTA7J.js} +3 -3
  106. package/dist/mcp-chunks/{prompt-CH6TK0bC-B3USYOND.js → prompt-DkftHXS7-N7UENQ4C.js} +1 -1
  107. package/dist/mcp-chunks/{record-command-MJW3Z5E5.js → record-command-JGTMATYI.js} +5 -5
  108. package/dist/mcp-chunks/{replay-command-5ZHBUOLE.js → replay-command-S2VAC4RW.js} +6 -6
  109. package/dist/mcp-chunks/{resource-command-L4I24AX5.js → resource-command-SRFQQROJ.js} +9 -9
  110. package/dist/mcp-chunks/{result-utils-5WRI66KV.js → result-utils-JASGNHXK.js} +3 -3
  111. package/dist/mcp-chunks/runtime-RMI3XCYJ.js +39 -0
  112. package/dist/mcp-chunks/{runtime-wrapper-WFMNIHD5.js → runtime-wrapper-7HYO3NM5.js} +3 -3
  113. package/dist/mcp-chunks/{serve-command-KNCSJUXS.js → serve-command-UF5SVREV.js} +1111 -697
  114. package/dist/mcp-chunks/{timeouts-2ZHGSB3R.js → timeouts-BJWDJEMH.js} +3 -3
  115. package/dist/mcp-chunks/{vault-command-7EDL45AA.js → vault-command-EYOIFWEY.js} +5 -4
  116. package/dist/mcp-chunks/webapi-WMMA3OEC.js +82 -0
  117. package/dist/mcp-daemon.js +28 -27
  118. package/dist/mcp-run-worker.js +28 -27
  119. package/dist/pi-extension.d.ts.map +1 -1
  120. package/dist/pi-extension.js +6 -0
  121. package/dist/pi-extension.js.map +1 -1
  122. package/dist/recipe/package.d.ts +15 -0
  123. package/dist/recipe/package.d.ts.map +1 -1
  124. package/dist/recipe/package.js +96 -2
  125. package/dist/recipe/package.js.map +1 -1
  126. package/dist/session.d.ts.map +1 -1
  127. package/dist/session.js +6 -0
  128. package/dist/session.js.map +1 -1
  129. package/docs/documents.md +344 -0
  130. package/docs/index.md +1 -0
  131. package/docs/interactions.md +76 -8
  132. package/docs/mcp-configuration.md +10 -5
  133. package/docs/recipe-format.md +69 -1
  134. package/documents/SKILL.md +63 -0
  135. package/package.json +16 -11
  136. package/dist/mcp-chunks/call-arguments-WSURHOLV.js +0 -16
  137. package/dist/mcp-chunks/chunk-BIVX2WFX.js +0 -3349
  138. package/dist/mcp-chunks/client-LXKCCVMT.js +0 -31
  139. package/dist/mcp-chunks/daemon-command-QHS3ACBM.js +0 -31
  140. package/dist/mcp-chunks/generated-daemon-runtime-7ORS5KBR.js +0 -31
  141. package/dist/mcp-chunks/runtime-IKWDQLZF.js +0 -38
@@ -3,11 +3,11 @@ import {
3
3
  __export
4
4
  } from "./chunk-LRKZP7DJ.js";
5
5
 
6
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/buffer_utils.js
6
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/buffer_utils.js
7
7
  var encoder = new TextEncoder();
8
8
  var decoder = new TextDecoder();
9
9
  var strictDecoder = new TextDecoder("utf-8", { fatal: true });
10
- var MAX_INT32 = 2 ** 32;
10
+ var UINT32_RANGE = 2 ** 32;
11
11
  function concat(...buffers) {
12
12
  const size = buffers.reduce((acc, { length }) => acc + length, 0), buf = new Uint8Array(size);
13
13
  let i = 0;
@@ -16,12 +16,12 @@ function concat(...buffers) {
16
16
  return buf;
17
17
  }
18
18
  function writeUInt32BE(buf, value, offset) {
19
- if (value < 0 || value >= MAX_INT32)
20
- throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);
19
+ if (value < 0 || value >= UINT32_RANGE)
20
+ throw new RangeError(`value must be >= 0 and <= ${UINT32_RANGE - 1}. Received ${value}`);
21
21
  buf.set([value >>> 24, value >>> 16, value >>> 8, value & 255], offset);
22
22
  }
23
23
  function uint64be(value) {
24
- const high = Math.floor(value / MAX_INT32), low = value % MAX_INT32, buf = new Uint8Array(8);
24
+ const high = Math.floor(value / UINT32_RANGE), low = value % UINT32_RANGE, buf = new Uint8Array(8);
25
25
  return writeUInt32BE(buf, high, 0), writeUInt32BE(buf, low, 4), buf;
26
26
  }
27
27
  function uint32be(value) {
@@ -71,7 +71,7 @@ async function digest(algorithm, data) {
71
71
  return new Uint8Array(await crypto.subtle.digest(subtleDigest, data));
72
72
  }
73
73
 
74
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/util/errors.js
74
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/util/errors.js
75
75
  var errors_exports = {};
76
76
  __export(errors_exports, {
77
77
  JOSEAlgNotAllowed: () => JOSEAlgNotAllowed,
@@ -183,7 +183,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
183
183
  }
184
184
  };
185
185
 
186
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/util/base64url.js
186
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/util/base64url.js
187
187
  var base64url_exports = {};
188
188
  __export(base64url_exports, {
189
189
  decode: () => decode,
@@ -201,7 +201,7 @@ function encode2(input) {
201
201
  return encodeBase64(typeof input == "string" ? encoder.encode(input) : input, true);
202
202
  }
203
203
 
204
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/validate.js
204
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/validate.js
205
205
  function assertUint8Array(input, label) {
206
206
  if (!(input instanceof Uint8Array))
207
207
  throw new TypeError(`${label} must be an instance of Uint8Array`);
@@ -233,23 +233,23 @@ function assertNotSet(value, name) {
233
233
  function decodeBase64url(value, label, ErrorClass) {
234
234
  try {
235
235
  return decode(value);
236
- } catch {
237
- throw new ErrorClass(`Failed to base64url decode the ${label}`);
236
+ } catch (cause) {
237
+ throw new ErrorClass(`Failed to base64url decode the ${label}`, { cause });
238
238
  }
239
239
  }
240
- function encodeBase64url(value, label, ErrorClass) {
240
+ function encodeAsciiMember(value, label, ErrorClass) {
241
241
  try {
242
242
  return encode(value);
243
- } catch {
244
- throw new ErrorClass(`The ${label} is not a valid base64url string`);
243
+ } catch (cause) {
244
+ throw new ErrorClass(`The ${label} is not a valid base64url string`, { cause });
245
245
  }
246
246
  }
247
- function parseJoseHeader(b64, ErrorClass, message2) {
247
+ function parseJoseHeader(encodedProtectedHeader, ErrorClass, message2) {
248
248
  let parsed;
249
249
  try {
250
- parsed = JSON.parse(strictDecoder.decode(decode(b64)));
251
- } catch {
252
- throw new ErrorClass(message2);
250
+ parsed = JSON.parse(strictDecoder.decode(decode(encodedProtectedHeader)));
251
+ } catch (cause) {
252
+ throw new ErrorClass(message2, { cause });
253
253
  }
254
254
  if (!isObject(parsed))
255
255
  throw new ErrorClass(message2);
@@ -306,7 +306,7 @@ function serializeJoseHeader(Err, header) {
306
306
  return [parsed, serialized];
307
307
  }
308
308
 
309
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key.js
309
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key.js
310
310
  var tag = (key) => key[Symbol.toStringTag];
311
311
  var jwkMatchesOp = (entry, key, usage) => {
312
312
  const { alg } = entry;
@@ -324,15 +324,15 @@ var jwkMatchesOp = (entry, key, usage) => {
324
324
  }
325
325
  };
326
326
  async function prepareKey(entry, key, usage) {
327
- const { alg, secret } = entry, privateKey = usage === "decrypt" || usage === "sign";
327
+ const { alg, secret } = entry, requiresPrivateKey = usage === "decrypt" || usage === "sign";
328
328
  if (secret && key instanceof Uint8Array)
329
329
  return key;
330
330
  let normalized, keyObject;
331
331
  if (isObject(key)) {
332
332
  if (normalized = normalizeJwk(key), typeof normalized.kty != "string")
333
333
  throw invalidKeyType(alg, key, secret);
334
- if (!(secret ? normalized.kty === "oct" && typeof normalized.k == "string" : normalized.kty !== "oct" && (privateKey ? normalized.kty === "AKP" && typeof normalized.priv == "string" || typeof normalized.d == "string" : normalized.d === void 0 && normalized.priv === void 0)))
335
- throw new TypeError(secret ? 'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present' : `JSON Web Key for this operation must be a ${privateKey ? "private" : "public"} JWK`);
334
+ if (!(secret ? normalized.kty === "oct" && typeof normalized.k == "string" : normalized.kty !== "oct" && (requiresPrivateKey ? normalized.kty === "AKP" && typeof normalized.priv == "string" || typeof normalized.d == "string" : normalized.d === void 0 && normalized.priv === void 0)))
335
+ throw new TypeError(secret ? 'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present' : `JSON Web Key for this operation must be a ${requiresPrivateKey ? "private" : "public"} JWK`);
336
336
  if (jwkMatchesOp(entry, normalized, usage), normalized.kty === "oct")
337
337
  return decode(normalized.k);
338
338
  if (!Object.isFrozen(key)) {
@@ -342,7 +342,7 @@ async function prepareKey(entry, key, usage) {
342
342
  } else {
343
343
  if (!isKeyLike(key))
344
344
  throw invalidKeyType(alg, key, secret);
345
- const expectedType = secret ? "secret" : privateKey ? "private" : "public";
345
+ const expectedType = secret ? "secret" : requiresPrivateKey ? "private" : "public";
346
346
  if (key.type !== expectedType && (secret || ["secret", "public", "private"].includes(key.type)))
347
347
  throw new TypeError(`${tag(key)} instances must be of type "${expectedType}" for the ${alg} algorithm`);
348
348
  if (isCryptoKey(key))
@@ -447,7 +447,7 @@ async function rawKey(key, expected, usage, extractable = false) {
447
447
  return key instanceof Uint8Array && (key = await crypto.subtle.importKey("raw", key, expected, extractable, [usage])), checkCryptoKey(key, expected, usage), key;
448
448
  }
449
449
 
450
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/content_encryption.js
450
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/content_encryption.js
451
451
  var generateCek = (enc) => crypto.getRandomValues(new Uint8Array(enc.cekBits >> 3));
452
452
  function checkCekLength(cek, expected) {
453
453
  const actual = cek.byteLength << 3;
@@ -462,20 +462,20 @@ function checkIvLength(enc, iv) {
462
462
  async function cbcKeySetup(enc, cek, usage) {
463
463
  if (!(cek instanceof Uint8Array))
464
464
  throw new TypeError(invalidKeyInput(cek, "Uint8Array"));
465
- const keySize = enc.cekBits >> 1, encKey = await crypto.subtle.importKey("raw", cek.subarray(keySize >> 3), "AES-CBC", false, [usage]), macKey = await crypto.subtle.importKey("raw", cek.subarray(0, keySize >> 3), {
466
- hash: `SHA-${keySize << 1}`,
465
+ const keyLengthBits = enc.cekBits >> 1, encKey = await crypto.subtle.importKey("raw", cek.subarray(keyLengthBits >> 3), "AES-CBC", false, [usage]), macKey = await crypto.subtle.importKey("raw", cek.subarray(0, keyLengthBits >> 3), {
466
+ hash: `SHA-${keyLengthBits << 1}`,
467
467
  name: "HMAC"
468
468
  }, false, ["sign"]);
469
- return [encKey, macKey, keySize];
469
+ return [encKey, macKey, keyLengthBits];
470
470
  }
471
- async function cbcHmacTag(macKey, macData, keySize) {
472
- return new Uint8Array((await crypto.subtle.sign("HMAC", macKey, macData)).slice(0, keySize >> 3));
471
+ async function cbcHmacTag(macKey, macData, keyLengthBits) {
472
+ return new Uint8Array((await crypto.subtle.sign("HMAC", macKey, macData)).slice(0, keyLengthBits >> 3));
473
473
  }
474
474
  async function cbcEncrypt(enc, plaintext, cek, iv, aad) {
475
- const [encKey, macKey, keySize] = await cbcKeySetup(enc, cek, "encrypt"), ciphertext = new Uint8Array(await crypto.subtle.encrypt({
475
+ const [encKey, macKey, keyLengthBits] = await cbcKeySetup(enc, cek, "encrypt"), ciphertext = new Uint8Array(await crypto.subtle.encrypt({
476
476
  iv,
477
477
  name: "AES-CBC"
478
- }, encKey, plaintext)), macData = concat(aad, iv, ciphertext, uint64be(aad.length * 8)), tag2 = await cbcHmacTag(macKey, macData, keySize);
478
+ }, encKey, plaintext)), al = uint64be(aad.length * 8), macData = concat(aad, iv, ciphertext, al), tag2 = await cbcHmacTag(macKey, macData, keyLengthBits);
479
479
  return { ciphertext, tag: tag2, iv };
480
480
  }
481
481
  async function timingSafeEqual(a, b) {
@@ -483,7 +483,7 @@ async function timingSafeEqual(a, b) {
483
483
  return crypto.subtle.verify(algorithm, key, aHmac, b);
484
484
  }
485
485
  async function cbcDecrypt(enc, cek, ciphertext, iv, tag2, aad) {
486
- const [encKey, macKey, keySize] = await cbcKeySetup(enc, cek, "decrypt"), macData = concat(aad, iv, ciphertext, uint64be(aad.length * 8)), expectedTag = await cbcHmacTag(macKey, macData, keySize);
486
+ const [encKey, macKey, keyLengthBits] = await cbcKeySetup(enc, cek, "decrypt"), al = uint64be(aad.length * 8), macData = concat(aad, iv, ciphertext, al), expectedTag = await cbcHmacTag(macKey, macData, keyLengthBits);
487
487
  try {
488
488
  if (await timingSafeEqual(tag2, expectedTag))
489
489
  return new Uint8Array(await crypto.subtle.decrypt({ iv, name: "AES-CBC" }, encKey, ciphertext));
@@ -528,7 +528,7 @@ async function decrypt(enc, cek, ciphertext, iv, tag2, aad) {
528
528
  }
529
529
  }
530
530
 
531
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key_descriptor.js
531
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key_descriptor.js
532
532
  function table(entries) {
533
533
  const out = { __proto__: null };
534
534
  for (const alg in entries)
@@ -536,7 +536,7 @@ function table(entries) {
536
536
  return out;
537
537
  }
538
538
 
539
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwe_algorithms.js
539
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwe_algorithms.js
540
540
  var wrap = [
541
541
  ["encrypt", "wrapKey"],
542
542
  ["decrypt", "unwrapKey"]
@@ -649,7 +649,7 @@ function jweEncryption(enc) {
649
649
  return (typeof enc == "string" ? ENC[enc] : void 0) ?? unsupported("enc", "Encryption Algorithm");
650
650
  }
651
651
 
652
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key_management.js
652
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key_management.js
653
653
  function checkEcdhCryptoKey(key, usage) {
654
654
  if (key.algorithm.name !== "ECDH" && key.algorithm.name !== "X25519")
655
655
  throw new TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");
@@ -671,32 +671,32 @@ async function deriveKey(p2s, alg, p2c, key) {
671
671
  throw new JWEInvalid("PBES2 Salt Input must be 8 or more octets");
672
672
  if (!Number.isSafeInteger(p2c) || Math.sign(p2c) !== 1)
673
673
  throw new JWEInvalid("PBES2 Count Input must be a positive integer");
674
- const salt = concat(encode(alg), Uint8Array.of(0), p2s), keylen = parseInt(alg.slice(13, 16), 10), subtleAlg = {
674
+ const salt = concat(encode(alg), Uint8Array.of(0), p2s), keyLengthBits = parseInt(alg.slice(13, 16), 10), subtleAlg = {
675
675
  hash: `SHA-${alg.slice(8, 11)}`,
676
676
  iterations: p2c,
677
677
  name: "PBKDF2",
678
678
  salt
679
679
  }, cryptoKey = await rawKey(key, jweAlgorithm(alg).subtle, "deriveBits");
680
- return new Uint8Array(await crypto.subtle.deriveBits(subtleAlg, cryptoKey, keylen));
680
+ return new Uint8Array(await crypto.subtle.deriveBits(subtleAlg, cryptoKey, keyLengthBits));
681
681
  }
682
682
  function lengthAndInput(input) {
683
683
  return concat(uint32be(input.length), input);
684
684
  }
685
- async function concatKdf(Z, L, OtherInfo) {
686
- const dkLen = L >> 3, hashLen = 32, reps = Math.ceil(dkLen / hashLen), dk = new Uint8Array(reps * hashLen);
685
+ async function concatKdf(Z, keyDataLength, OtherInfo) {
686
+ const dkLen = keyDataLength >> 3, hashLen = 32, reps = Math.ceil(dkLen / hashLen), dk = new Uint8Array(reps * hashLen);
687
687
  for (let i = 1; i <= reps; i++) {
688
688
  const hashResult = await digest("sha256", concat(uint32be(i), Z, OtherInfo));
689
689
  dk.set(hashResult, (i - 1) * hashLen);
690
690
  }
691
691
  return dk.slice(0, dkLen);
692
692
  }
693
- async function ecdhesDeriveKey(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(), apv = new Uint8Array()) {
693
+ async function ecdhesDeriveKey(publicKey, privateKey, algorithmId, keyDataLength, apu = new Uint8Array(), apv = new Uint8Array()) {
694
694
  checkEcdhCryptoKey(publicKey), checkEcdhCryptoKey(privateKey, "deriveBits");
695
- const otherInfo = concat(lengthAndInput(encode(algorithm)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyLength)), Z = new Uint8Array(await crypto.subtle.deriveBits({
695
+ const otherInfo = concat(lengthAndInput(encode(algorithmId)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyDataLength)), Z = new Uint8Array(await crypto.subtle.deriveBits({
696
696
  name: publicKey.algorithm.name,
697
697
  public: publicKey
698
698
  }, privateKey, publicKey.algorithm.name === "X25519" ? 256 : Math.ceil(parseInt(publicKey.algorithm.namedCurve.slice(-3), 10) / 8) << 3));
699
- return concatKdf(Z, keyLength, otherInfo);
699
+ return concatKdf(Z, keyDataLength, otherInfo);
700
700
  }
701
701
  function assertEcdhKey(key) {
702
702
  assertCryptoKey(key);
@@ -745,10 +745,10 @@ async function decryptKeyManagement(entry, enc, key, encryptedKey, joseHeader, m
745
745
  assertEcdhKey(key);
746
746
  const ephemeralPublicKey = await jwkToKey(entry, epk), partyUInfo = partyInfo(joseHeader, "apu"), partyVInfo = partyInfo(joseHeader, "apv");
747
747
  checkPartyInfo(partyUInfo, partyVInfo);
748
- const sharedSecret = await ecdhesDeriveKey(ephemeralPublicKey, key, direct ? enc.alg : alg, direct ? enc.cekBits : parseInt(alg.slice(-5, -2), 10), partyUInfo, partyVInfo);
748
+ const derivedKey = await ecdhesDeriveKey(ephemeralPublicKey, key, direct ? enc.alg : alg, direct ? enc.cekBits : parseInt(alg.slice(-5, -2), 10), partyUInfo, partyVInfo);
749
749
  if (direct)
750
- return sharedSecret;
751
- key = sharedSecret;
750
+ return derivedKey;
751
+ key = derivedKey;
752
752
  break;
753
753
  }
754
754
  case "RSA-OAEP":
@@ -798,19 +798,19 @@ async function encryptKeyManagement(entry, enc, inputKey, joseHeader, providedCe
798
798
  providedApu !== void 0 && assertUint8Array(providedApu, '"apu"'), providedApv !== void 0 && assertUint8Array(providedApv, '"apv"');
799
799
  const apu = providedApu ?? partyInfo(joseHeader, "apu"), apv = providedApv ?? partyInfo(joseHeader, "apv");
800
800
  checkPartyInfo(apu, apv);
801
- let ephemeralKey;
802
- providedParameters.epk !== void 0 ? ephemeralKey = await prepareKey(entry, providedParameters.epk, "decrypt") : ephemeralKey = (await crypto.subtle.generateKey(key.algorithm, true, ["deriveBits"])).privateKey;
801
+ let ephemeralPrivateKey;
802
+ providedParameters.epk !== void 0 ? ephemeralPrivateKey = await prepareKey(entry, providedParameters.epk, "decrypt") : ephemeralPrivateKey = (await crypto.subtle.generateKey(key.algorithm, true, ["deriveBits"])).privateKey;
803
803
  const subtle = crypto.subtle;
804
- let exportableEpk = ephemeralKey;
804
+ let exportableEpk = ephemeralPrivateKey;
805
805
  if (!exportableEpk.extractable) {
806
806
  if (typeof subtle.getPublicKey != "function")
807
807
  throw new TypeError('CryptoKey for "epk" must be extractable');
808
- exportableEpk = await subtle.getPublicKey(ephemeralKey, []);
808
+ exportableEpk = await subtle.getPublicKey(ephemeralPrivateKey, []);
809
809
  }
810
- const { x, y, crv, kty } = await subtle.exportKey("jwk", exportableEpk), direct = mode === "direct-key-agreement", sharedSecret = await ecdhesDeriveKey(key, ephemeralKey, direct ? enc.alg : alg, direct ? enc.cekBits : parseInt(alg.slice(-5, -2), 10), apu, apv), epk = { x, crv, kty };
810
+ const { x, y, crv, kty } = await subtle.exportKey("jwk", exportableEpk), direct = mode === "direct-key-agreement", derivedKey = await ecdhesDeriveKey(key, ephemeralPrivateKey, direct ? enc.alg : alg, direct ? enc.cekBits : parseInt(alg.slice(-5, -2), 10), apu, apv), epk = { x, crv, kty };
811
811
  if (kty === "EC" && (epk.y = y), parameters = { epk }, providedApu !== void 0 && (parameters.apu = encode2(providedApu)), providedApv !== void 0 && (parameters.apv = encode2(providedApv)), direct)
812
- return [sharedSecret, void 0, parameters];
813
- key = sharedSecret;
812
+ return [derivedKey, void 0, parameters];
813
+ key = derivedKey;
814
814
  break;
815
815
  }
816
816
  case "RSA-OAEP": {
@@ -835,7 +835,7 @@ async function encryptKeyManagement(entry, enc, inputKey, joseHeader, providedCe
835
835
  return [cek, encryptedKey, parameters];
836
836
  }
837
837
 
838
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/deflate.js
838
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/deflate.js
839
839
  function validateZip(joseHeader, protectedHeader) {
840
840
  if (joseHeader.zip !== void 0 && joseHeader.zip !== "DEF")
841
841
  throw new JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');
@@ -870,7 +870,7 @@ async function decompress(input, maxLength) {
870
870
  return supported("DecompressionStream"), transform(new DecompressionStream("deflate-raw"), input, maxLength);
871
871
  }
872
872
 
873
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwe_decrypt.js
873
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwe_decrypt.js
874
874
  function snapshotSharedJWE(jwe) {
875
875
  const { aad, ciphertext, iv, protected: encodedProtected, tag: tag2, unprotected } = jwe;
876
876
  if (iv !== void 0 && (typeof iv != "string" || !iv))
@@ -924,13 +924,13 @@ function checkRecipient(jwe) {
924
924
  }
925
925
  function shareJWE(jwe) {
926
926
  const { protected: encodedProtected, ciphertext, iv, tag: tag2, aad } = jwe;
927
- let parsedProt;
928
- return encodedProtected !== void 0 && (parsedProt = parseJoseHeader(encodedProtected, JWEInvalid, "JWE Protected Header is invalid")), [
929
- parsedProt,
927
+ let protectedHeader;
928
+ return encodedProtected !== void 0 && (protectedHeader = parseJoseHeader(encodedProtected, JWEInvalid, "JWE Protected Header is invalid")), [
929
+ protectedHeader,
930
930
  decodeBase64url(ciphertext, "ciphertext", JWEInvalid),
931
931
  iv !== void 0 ? decodeBase64url(iv, "iv", JWEInvalid) : void 0,
932
932
  tag2 !== void 0 ? decodeBase64url(tag2, "tag", JWEInvalid) : void 0,
933
- encodeBase64url((encodedProtected ?? "") + (aad !== void 0 ? `.${aad}` : ""), "aad", JWEInvalid)
933
+ encodeAsciiMember((encodedProtected ?? "") + (aad !== void 0 ? `.${aad}` : ""), "aad", JWEInvalid)
934
934
  ];
935
935
  }
936
936
  function prepareDecrypt(options) {
@@ -943,16 +943,16 @@ function prepareDecrypt(options) {
943
943
  ];
944
944
  }
945
945
  async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
946
- const [parsedProt, ciphertext, iv, tag2, additionalData] = token, { header, unprotected, aad } = jwe;
946
+ const [protectedHeader, ciphertext, iv, tag2, additionalAuthenticatedData] = token, { header, unprotected, aad } = jwe;
947
947
  let joseHeader;
948
948
  if (header !== void 0 || unprotected !== void 0) {
949
- if (!isDisjoint(parsedProt, header, unprotected))
949
+ if (!isDisjoint(protectedHeader, header, unprotected))
950
950
  throw new JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");
951
- joseHeader = { ...parsedProt, ...header, ...unprotected };
951
+ joseHeader = { ...protectedHeader, ...header, ...unprotected };
952
952
  } else
953
- joseHeader = parsedProt ?? {};
953
+ joseHeader = protectedHeader ?? {};
954
954
  const [keyManagementAlgorithms, contentEncryptionAlgorithms, crit, maxPBES2Count, maxDecompressedLength] = shared, { encrypted_key: encodedKey } = jwe;
955
- validateCrit(JWEInvalid, JWE_RECOGNIZED, crit, parsedProt, joseHeader), validateZip(joseHeader, parsedProt);
955
+ validateCrit(JWEInvalid, JWE_RECOGNIZED, crit, protectedHeader, joseHeader), validateZip(joseHeader, protectedHeader);
956
956
  const { alg, enc } = joseHeader;
957
957
  if (typeof alg != "string" || !alg)
958
958
  throw new JWEInvalid("missing JWE Algorithm (alg) in JWE Header");
@@ -987,13 +987,13 @@ async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
987
987
  encryptedKey = new Uint8Array();
988
988
  }
989
989
  let resolvedKey = false;
990
- typeof key == "function" && (key = await key(parsedProt, jwe), resolvedKey = true);
990
+ typeof key == "function" && (key = await key(protectedHeader, jwe), resolvedKey = true);
991
991
  const algEntry = selected ?? jweAlgorithm(alg);
992
992
  isJWECEKTransport(algEntry) && encryptedKey === void 0 && (encryptedKey = new Uint8Array());
993
993
  const k = await prepareKey(algEntry.mode === "direct-encryption" ? encEntry : algEntry, key, "decrypt");
994
994
  let plaintext;
995
995
  if (algEntry.mode === "integrated-encryption")
996
- plaintext = await algEntry.decrypt(k, encryptedKey, ciphertext, additionalData, parsedProt, joseHeader);
996
+ plaintext = await algEntry.decrypt(k, encryptedKey, ciphertext, additionalAuthenticatedData, protectedHeader, joseHeader);
997
997
  else {
998
998
  const encryption = encEntry;
999
999
  let cek;
@@ -1004,7 +1004,7 @@ async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
1004
1004
  throw err;
1005
1005
  cek = generateCek(encryption);
1006
1006
  }
1007
- plaintext = await decrypt(encryption, cek, ciphertext, iv, tag2, additionalData);
1007
+ plaintext = await decrypt(encryption, cek, ciphertext, iv, tag2, additionalAuthenticatedData);
1008
1008
  }
1009
1009
  if (joseHeader.zip === "DEF") {
1010
1010
  const decompressionLimit = maxDecompressedLength ?? 25e4;
@@ -1018,7 +1018,7 @@ async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
1018
1018
  }
1019
1019
  return {
1020
1020
  plaintext,
1021
- ...parsedProt && { protectedHeader: parsedProt },
1021
+ ...protectedHeader && { protectedHeader },
1022
1022
  ...aad !== void 0 && {
1023
1023
  additionalAuthenticatedData: decodeBase64url(aad, "aad", JWEInvalid)
1024
1024
  },
@@ -1042,12 +1042,12 @@ async function decryptCompact(jwe, shared, key) {
1042
1042
  }, shared, key);
1043
1043
  }
1044
1044
 
1045
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/compact/decrypt.js
1045
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/compact/decrypt.js
1046
1046
  async function compactDecrypt(jwe, key, options) {
1047
1047
  return decryptCompact(jwe, prepareDecrypt(options), key);
1048
1048
  }
1049
1049
 
1050
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js
1050
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js
1051
1051
  async function flattenedDecrypt(jwe, key, options) {
1052
1052
  if (!isObject(jwe))
1053
1053
  throw new JWEInvalid("Flattened JWE must be an object");
@@ -1058,7 +1058,7 @@ async function flattenedDecrypt(jwe, key, options) {
1058
1058
  return checkRecipient(snapshot), decryptJWE(snapshot, prepareDecrypt(options), key);
1059
1059
  }
1060
1060
 
1061
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/general/decrypt.js
1061
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/general/decrypt.js
1062
1062
  async function generalDecrypt(jwe, key, options) {
1063
1063
  if (!isObject(jwe))
1064
1064
  throw new JWEInvalid("General JWE must be an object");
@@ -1093,7 +1093,7 @@ async function generalDecrypt(jwe, key, options) {
1093
1093
  throw new JWEDecryptionFailed();
1094
1094
  }
1095
1095
 
1096
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwe_encrypt.js
1096
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwe_encrypt.js
1097
1097
  function checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader) {
1098
1098
  if (!isDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader))
1099
1099
  throw new JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");
@@ -1135,17 +1135,17 @@ async function encryptJWE(input, checked, key) {
1135
1135
  const algEntry = selected ?? jweAlgorithm(joseHeader.alg);
1136
1136
  let encryptedKey, parameters, cek;
1137
1137
  algEntry.mode === "integrated-encryption" ? cek = await prepareKey(algEntry, key, "encrypt") : [cek, encryptedKey, parameters] = await encryptKeyManagement(algEntry, encEntry, key, joseHeader, providedCek, keyManagementParameters), parameters && (unprotectedParameters ? unprotectedHeader = unprotectedHeader ? { ...unprotectedHeader, ...parameters } : parameters : protectedHeader = protectedHeader ? { ...protectedHeader, ...parameters } : parameters, checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader));
1138
- const protectedHeaderS = protectedHeader ? encode2(JSON.stringify(protectedHeader)) : "", aadMember = aad?.byteLength ? encode2(aad) : void 0, additionalData = encode(aadMember ? `${protectedHeaderS}.${aadMember}` : protectedHeaderS);
1138
+ const encodedProtectedHeader = protectedHeader ? encode2(JSON.stringify(protectedHeader)) : "", encodedAad = aad?.byteLength ? encode2(aad) : void 0, additionalAuthenticatedData = encode(encodedAad ? `${encodedProtectedHeader}.${encodedAad}` : encodedProtectedHeader);
1139
1139
  let plaintext = inputPlaintext;
1140
1140
  joseHeader.zip === "DEF" && (plaintext = await compress(plaintext).catch((cause) => {
1141
1141
  throw new JWEInvalid("Failed to compress plaintext", { cause });
1142
1142
  }));
1143
1143
  let ciphertext, tag2, iv;
1144
- algEntry.mode === "integrated-encryption" ? [encryptedKey, ciphertext] = await algEntry.encrypt(cek, plaintext, additionalData, protectedHeader, joseHeader, keyManagementParameters) : { ciphertext, tag: tag2, iv } = await encrypt(encEntry, plaintext, cek, inputIv, additionalData);
1144
+ algEntry.mode === "integrated-encryption" ? [encryptedKey, ciphertext] = await algEntry.encrypt(cek, plaintext, additionalAuthenticatedData, protectedHeader, joseHeader, keyManagementParameters) : { ciphertext, tag: tag2, iv } = await encrypt(encEntry, plaintext, cek, inputIv, additionalAuthenticatedData);
1145
1145
  const jwe = {
1146
1146
  ciphertext: encode2(ciphertext)
1147
1147
  };
1148
- return iv && (jwe.iv = encode2(iv)), tag2 && (jwe.tag = encode2(tag2)), encryptedKey?.byteLength && (jwe.encrypted_key = encode2(encryptedKey)), aadMember && (jwe.aad = aadMember), protectedHeader && (jwe.protected = protectedHeaderS), sharedUnprotectedHeader && (jwe.unprotected = sharedUnprotectedHeader), unprotectedHeader && (jwe.header = unprotectedHeader), jwe;
1148
+ return iv && (jwe.iv = encode2(iv)), tag2 && (jwe.tag = encode2(tag2)), encryptedKey?.byteLength && (jwe.encrypted_key = encode2(encryptedKey)), encodedAad && (jwe.aad = encodedAad), protectedHeader && (jwe.protected = encodedProtectedHeader), sharedUnprotectedHeader && (jwe.unprotected = sharedUnprotectedHeader), unprotectedHeader && (jwe.header = unprotectedHeader), jwe;
1149
1149
  }
1150
1150
  async function createJWE(input, key, options) {
1151
1151
  return encryptJWE(input, checkEncryptHeaders(input, options), key);
@@ -1154,7 +1154,7 @@ function compactJWE(jwe) {
1154
1154
  return [jwe.protected, jwe.encrypted_key, jwe.iv, jwe.ciphertext, jwe.tag].join(".");
1155
1155
  }
1156
1156
 
1157
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/general/encrypt.js
1157
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/general/encrypt.js
1158
1158
  var IndividualRecipient = class {
1159
1159
  #parent;
1160
1160
  state;
@@ -1181,7 +1181,7 @@ var GeneralEncrypt = class {
1181
1181
  #plaintext;
1182
1182
  #recipients = [];
1183
1183
  #protectedHeader;
1184
- #unprotectedHeader;
1184
+ #sharedUnprotectedHeader;
1185
1185
  #aad;
1186
1186
  constructor(plaintext) {
1187
1187
  this.#plaintext = plaintext;
@@ -1194,7 +1194,7 @@ var GeneralEncrypt = class {
1194
1194
  return assertNotSet(this.#protectedHeader, "setProtectedHeader"), this.#protectedHeader = protectedHeader, this;
1195
1195
  }
1196
1196
  setSharedUnprotectedHeader(sharedUnprotectedHeader) {
1197
- return assertNotSet(this.#unprotectedHeader, "setSharedUnprotectedHeader"), this.#unprotectedHeader = sharedUnprotectedHeader, this;
1197
+ return assertNotSet(this.#sharedUnprotectedHeader, "setSharedUnprotectedHeader"), this.#sharedUnprotectedHeader = sharedUnprotectedHeader, this;
1198
1198
  }
1199
1199
  setAdditionalAuthenticatedData(aad) {
1200
1200
  return this.#aad = aad, this;
@@ -1204,7 +1204,7 @@ var GeneralEncrypt = class {
1204
1204
  throw new JWEInvalid("at least one recipient must be added");
1205
1205
  assertUint8Array(this.#plaintext, "plaintext");
1206
1206
  const multiple = this.#recipients.length > 1;
1207
- let enc, protectedHeader = this.#protectedHeader, sharedUnprotectedHeader = this.#unprotectedHeader;
1207
+ let enc, protectedHeader = this.#protectedHeader, sharedUnprotectedHeader = this.#sharedUnprotectedHeader;
1208
1208
  const recipients = [];
1209
1209
  for (const recipient of this.#recipients) {
1210
1210
  const [unprotectedHeader, keyManagementParameters, key, crit] = recipient.state, input = [
@@ -1251,7 +1251,7 @@ var GeneralEncrypt = class {
1251
1251
  }
1252
1252
  };
1253
1253
 
1254
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jws_algorithms.js
1254
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jws_algorithms.js
1255
1255
  var sig = [["verify"], ["sign"]];
1256
1256
  function hmac(bits) {
1257
1257
  const subtle = { name: "HMAC", hash: `SHA-${bits}` };
@@ -1286,8 +1286,8 @@ function eddsa() {
1286
1286
  usages: sig
1287
1287
  };
1288
1288
  }
1289
- function mldsa(bits) {
1290
- const subtle = { name: `ML-DSA-${bits}` };
1289
+ function mldsa(parameterSet) {
1290
+ const subtle = { name: `ML-DSA-${parameterSet}` };
1291
1291
  return {
1292
1292
  kty: ["AKP"],
1293
1293
  subtle,
@@ -1321,15 +1321,15 @@ function jwsAlgorithm(alg) {
1321
1321
  return entry;
1322
1322
  }
1323
1323
 
1324
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jws_verify.js
1324
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jws_verify.js
1325
1325
  function snapshotJws(jws, sharedPayload) {
1326
- const encodedProtected = jws.protected, inputHeader = jws.header, header = isObject(inputHeader) ? { ...inputHeader } : inputHeader;
1326
+ const encodedProtectedHeader = jws.protected, inputHeader = jws.header, header = isObject(inputHeader) ? { ...inputHeader } : inputHeader;
1327
1327
  let payload = sharedPayload ? sharedPayload[0] : jws.payload;
1328
1328
  !sharedPayload && payload instanceof Uint8Array && (payload = new Uint8Array(payload));
1329
1329
  const signature = jws.signature, snapshot = { payload, signature };
1330
- if (encodedProtected !== void 0 && (snapshot.protected = encodedProtected), inputHeader !== void 0 && (snapshot.header = header), encodedProtected === void 0 && header === void 0)
1330
+ if (encodedProtectedHeader !== void 0 && (snapshot.protected = encodedProtectedHeader), inputHeader !== void 0 && (snapshot.header = header), encodedProtectedHeader === void 0 && header === void 0)
1331
1331
  throw new JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');
1332
- if (encodedProtected !== void 0 && typeof encodedProtected != "string")
1332
+ if (encodedProtectedHeader !== void 0 && typeof encodedProtectedHeader != "string")
1333
1333
  throw new JWSInvalid("JWS Protected Header incorrect type");
1334
1334
  if (payload === void 0)
1335
1335
  throw new JWSInvalid("JWS Payload missing");
@@ -1342,8 +1342,8 @@ function snapshotJws(jws, sharedPayload) {
1342
1342
  function prepareVerify(options) {
1343
1343
  return [options && validateAlgorithms("algorithms", options.algorithms), options?.crit];
1344
1344
  }
1345
- function parseProtectedHeader(encodedProtected) {
1346
- return encodedProtected === void 0 ? {} : parseJoseHeader(encodedProtected, JWSInvalid, "JWS Protected Header is invalid");
1345
+ function parseProtectedHeader(encodedProtectedHeader) {
1346
+ return encodedProtectedHeader === void 0 ? {} : parseJoseHeader(encodedProtectedHeader, JWSInvalid, "JWS Protected Header is invalid");
1347
1347
  }
1348
1348
  function encodeJsonUnencodedPayload(payload) {
1349
1349
  const invalid2 = /[\p{Cs}\p{Cn}]/u.exec(payload)?.[0];
@@ -1354,15 +1354,17 @@ function encodeJsonUnencodedPayload(payload) {
1354
1354
  function encodeCompactUnencodedPayload(payload) {
1355
1355
  try {
1356
1356
  return encode(payload);
1357
- } catch {
1358
- throw new JWSInvalid("JWS Compact Serialization payload must use only ASCII characters");
1357
+ } catch (cause) {
1358
+ throw new JWSInvalid("JWS Compact Serialization payload must use only ASCII characters", {
1359
+ cause
1360
+ });
1359
1361
  }
1360
1362
  }
1361
1363
  async function verifySignature(jws, shared, key, encodeUnencodedPayload, parsedProtected) {
1362
- const { protected: encodedProtected, header, payload: inputPayload } = jws, parsedProt = parsedProtected ?? parseProtectedHeader(encodedProtected);
1363
- if (!isDisjoint(parsedProt, header))
1364
+ const { protected: encodedProtectedHeader, header, payload: inputPayload } = jws, protectedHeader = parsedProtected ?? parseProtectedHeader(encodedProtectedHeader);
1365
+ if (!isDisjoint(protectedHeader, header))
1364
1366
  throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
1365
- const joseHeader = { ...parsedProt, ...header }, b64 = validateB64(parsedProt, validateCrit(JWSInvalid, JWS_RECOGNIZED, shared[1], parsedProt, joseHeader)), { alg } = joseHeader;
1367
+ const joseHeader = { ...protectedHeader, ...header }, b64 = validateB64(protectedHeader, validateCrit(JWSInvalid, JWS_RECOGNIZED, shared[1], protectedHeader, joseHeader)), { alg } = joseHeader;
1366
1368
  if (typeof alg != "string" || !alg)
1367
1369
  throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
1368
1370
  if (shared[0] && !shared[0].has(alg))
@@ -1374,18 +1376,19 @@ async function verifySignature(jws, shared, key, encodeUnencodedPayload, parsedP
1374
1376
  throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");
1375
1377
  const signingPayload = b64 || typeof inputPayload != "string" ? inputPayload : encodeUnencodedPayload(inputPayload);
1376
1378
  let resolvedKey = false;
1377
- typeof key == "function" && (key = await key(parsedProt, jws), resolvedKey = true);
1378
- const entry = jwsAlgorithm(alg), data = concat(encodedProtected !== void 0 ? encode(encodedProtected) : new Uint8Array(), encode("."), typeof signingPayload == "string" ? shared[2] ??= encodeBase64url(signingPayload, "payload", JWSInvalid) : signingPayload), signature = decodeBase64url(jws.signature, "signature", JWSInvalid), k = await prepareKey(entry, key, "verify"), cryptoKey = await rawKey(k, entry.subtle, "verify");
1379
+ typeof key == "function" && (key = await key(protectedHeader, jws), resolvedKey = true);
1380
+ const entry = jwsAlgorithm(alg), signingInput = concat(encodedProtectedHeader !== void 0 ? encode(encodedProtectedHeader) : new Uint8Array(), encode("."), typeof signingPayload == "string" ? shared[2] ??= encodeAsciiMember(signingPayload, "payload", JWSInvalid) : signingPayload), signature = decodeBase64url(jws.signature, "signature", JWSInvalid), verificationKey = await prepareKey(entry, key, "verify"), cryptoKey = await rawKey(verificationKey, entry.subtle, "verify");
1379
1381
  entry.minRsaBits && checkModulusLength(entry.alg, cryptoKey);
1380
1382
  let verified = false;
1381
1383
  try {
1382
- verified = await crypto.subtle.verify(entry.signing, cryptoKey, signature, data);
1383
- } catch {
1384
+ verified = await crypto.subtle.verify(entry.signing, cryptoKey, signature, signingInput);
1385
+ } catch (cause) {
1386
+ throw new JWSSignatureVerificationFailed(void 0, { cause });
1384
1387
  }
1385
1388
  if (!verified)
1386
1389
  throw new JWSSignatureVerificationFailed();
1387
1390
  const result = { payload: typeof signingPayload == "string" ? decodeBase64url(signingPayload, "payload", JWSInvalid) : signingPayload };
1388
- return encodedProtected !== void 0 && (result.protectedHeader = parsedProt), header !== void 0 && (result.unprotectedHeader = header), resolvedKey ? [{ ...result, key: k }, b64] : [result, b64];
1391
+ return encodedProtectedHeader !== void 0 && (result.protectedHeader = protectedHeader), header !== void 0 && (result.unprotectedHeader = header), resolvedKey ? [{ ...result, key: verificationKey }, b64] : [result, b64];
1389
1392
  }
1390
1393
  async function verifyCompact(jws, shared, key) {
1391
1394
  if (jws instanceof Uint8Array && (jws = decoder.decode(jws)), typeof jws != "string")
@@ -1396,13 +1399,13 @@ async function verifyCompact(jws, shared, key) {
1396
1399
  return verifySignature({ payload, protected: protectedHeader, signature }, shared, key, encodeCompactUnencodedPayload);
1397
1400
  }
1398
1401
 
1399
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jws/compact/verify.js
1402
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jws/compact/verify.js
1400
1403
  async function compactVerify(jws, key, options) {
1401
1404
  const [result] = await verifyCompact(jws, prepareVerify(options), key);
1402
1405
  return result;
1403
1406
  }
1404
1407
 
1405
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jws/flattened/verify.js
1408
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jws/flattened/verify.js
1406
1409
  async function flattenedVerify(jws, key, options) {
1407
1410
  if (!isObject(jws))
1408
1411
  throw new JWSInvalid("Flattened JWS must be an object");
@@ -1410,7 +1413,7 @@ async function flattenedVerify(jws, key, options) {
1410
1413
  return result;
1411
1414
  }
1412
1415
 
1413
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jws/general/verify.js
1416
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jws/general/verify.js
1414
1417
  function snapshotSignature(signature, payload) {
1415
1418
  try {
1416
1419
  const jws = snapshotJws(signature, [payload]), protectedHeader = parseProtectedHeader(jws.protected), { b64, crit } = protectedHeader;
@@ -1441,9 +1444,9 @@ async function generalVerify(jws, key, options) {
1441
1444
  throw new JWSSignatureVerificationFailed();
1442
1445
  }
1443
1446
  const payload = inputPayload instanceof Uint8Array ? new Uint8Array(inputPayload) : inputPayload, candidates = signatureEntries.map((signature) => snapshotSignature(signature, payload)).filter((candidate) => candidate !== void 0);
1444
- let modes = 0;
1445
- for (const [, , mode] of candidates)
1446
- if (modes |= mode, modes === 3)
1447
+ let payloadEncodings = 0;
1448
+ for (const [, , payloadEncoding] of candidates)
1449
+ if (payloadEncodings |= payloadEncoding, payloadEncodings === 3)
1447
1450
  throw new JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");
1448
1451
  for (const candidate of candidates)
1449
1452
  try {
@@ -1454,7 +1457,7 @@ async function generalVerify(jws, key, options) {
1454
1457
  throw new JWSSignatureVerificationFailed();
1455
1458
  }
1456
1459
 
1457
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
1460
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
1458
1461
  var epoch = (date) => Math.floor(date.getTime() / 1e3);
1459
1462
  var multipliers = {
1460
1463
  s: 1,
@@ -1473,8 +1476,8 @@ function secs(str) {
1473
1476
  typeof str != "string" && invalidDuration();
1474
1477
  const matched = REGEX.exec(str);
1475
1478
  (!matched || matched[4] && matched[1]) && invalidDuration();
1476
- const value = parseFloat(matched[2]), numericDate2 = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
1477
- return Number.isFinite(numericDate2) || invalidDuration(), matched[1] === "-" || matched[4] === "ago" ? -numericDate2 : numericDate2;
1479
+ const value = parseFloat(matched[2]), durationSeconds = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
1480
+ return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4] === "ago" ? -durationSeconds : durationSeconds;
1478
1481
  }
1479
1482
  function validateInput(label, input) {
1480
1483
  if (!Number.isFinite(input))
@@ -1497,34 +1500,35 @@ var normalizeTyp = (value) => {
1497
1500
  return value.includes("/") ? normalized : `application/${normalized}`;
1498
1501
  };
1499
1502
  var checkAudiencePresence = (audPayload, audOption) => typeof audPayload == "string" ? audOption.includes(audPayload) : Array.isArray(audPayload) ? audOption.some((aud) => audPayload.includes(aud)) : false;
1500
- function validateNumericDate(payload, claim, required = false) {
1501
- const value = payload[claim];
1503
+ function validateNumericDate(claimsSet, claim, required = false) {
1504
+ const value = claimsSet[claim];
1502
1505
  if (!(value === void 0 && !required)) {
1503
1506
  if (typeof value != "number")
1504
- throw new JWTClaimValidationFailed(`"${claim}" claim must be a number`, payload, claim, "invalid");
1507
+ throw new JWTClaimValidationFailed(`"${claim}" claim must be a number`, claimsSet, claim, "invalid");
1505
1508
  return value;
1506
1509
  }
1507
1510
  }
1508
- function unexpectedClaim(payload, claim) {
1509
- throw new JWTClaimValidationFailed(`unexpected "${claim}" claim value`, payload, claim, checkFailed);
1511
+ function unexpectedClaim(claimsSet, claim) {
1512
+ throw new JWTClaimValidationFailed(`unexpected "${claim}" claim value`, claimsSet, claim, checkFailed);
1510
1513
  }
1511
- function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
1512
- let payload;
1514
+ function validateClaimsSet(protectedHeader, claimsSetBytes, options = {}) {
1515
+ let claimsSet;
1513
1516
  try {
1514
- payload = JSON.parse(strictDecoder.decode(encodedPayload));
1515
- } catch {
1517
+ claimsSet = JSON.parse(strictDecoder.decode(claimsSetBytes));
1518
+ } catch (cause) {
1519
+ throw new JWTInvalid("JWT Claims Set must be a top-level JSON object", { cause });
1516
1520
  }
1517
- if (!isObject(payload))
1521
+ if (!isObject(claimsSet))
1518
1522
  throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
1519
1523
  const { typ } = options;
1520
1524
  if (typ !== void 0 && (typeof protectedHeader.typ != "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ)))
1521
- throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ", checkFailed);
1525
+ throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', claimsSet, "typ", checkFailed);
1522
1526
  const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options, presenceCheck = [...requiredClaims];
1523
1527
  maxTokenAge !== void 0 && presenceCheck.push("iat"), audience !== void 0 && presenceCheck.push("aud"), subject !== void 0 && presenceCheck.push("sub"), issuer !== void 0 && presenceCheck.push("iss");
1524
1528
  for (const claim of new Set(presenceCheck.reverse()))
1525
- if (!Object.hasOwn(payload, claim))
1526
- throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, "missing");
1527
- issuer !== void 0 && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss) && unexpectedClaim(payload, "iss"), subject !== void 0 && payload.sub !== subject && unexpectedClaim(payload, "sub"), audience !== void 0 && !checkAudiencePresence(payload.aud, typeof audience == "string" ? [audience] : audience) && unexpectedClaim(payload, "aud");
1529
+ if (!Object.hasOwn(claimsSet, claim))
1530
+ throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, claimsSet, claim, "missing");
1531
+ issuer !== void 0 && !(Array.isArray(issuer) ? issuer : [issuer]).includes(claimsSet.iss) && unexpectedClaim(claimsSet, "iss"), subject !== void 0 && claimsSet.sub !== subject && unexpectedClaim(claimsSet, "sub"), audience !== void 0 && !checkAudiencePresence(claimsSet.aud, typeof audience == "string" ? [audience] : audience) && unexpectedClaim(claimsSet, "aud");
1528
1532
  const { clockTolerance } = options;
1529
1533
  let tolerance = 0;
1530
1534
  if (typeof clockTolerance == "string")
@@ -1535,68 +1539,68 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
1535
1539
  tolerance = clockTolerance;
1536
1540
  }
1537
1541
  validateInput("clockTolerance option", tolerance);
1538
- const { currentDate } = options, now = validateInput("currentDate option", epoch(currentDate === void 0 ? /* @__PURE__ */ new Date() : currentDate)), iat = validateNumericDate(payload, "iat", maxTokenAge !== void 0), nbf = validateNumericDate(payload, "nbf");
1542
+ const { currentDate } = options, now = validateInput("currentDate option", epoch(currentDate === void 0 ? /* @__PURE__ */ new Date() : currentDate)), iat = validateNumericDate(claimsSet, "iat", maxTokenAge !== void 0), nbf = validateNumericDate(claimsSet, "nbf");
1539
1543
  if (nbf !== void 0 && nbf > now + tolerance)
1540
- throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", checkFailed);
1541
- const exp = validateNumericDate(payload, "exp");
1544
+ throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', claimsSet, "nbf", checkFailed);
1545
+ const exp = validateNumericDate(claimsSet, "exp");
1542
1546
  if (exp !== void 0 && exp <= now - tolerance)
1543
- throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", checkFailed);
1547
+ throw new JWTExpired('"exp" claim timestamp check failed', claimsSet, "exp", checkFailed);
1544
1548
  if (maxTokenAge !== void 0) {
1545
1549
  const age = now - iat, max = validateInput("maxTokenAge option", typeof maxTokenAge == "number" ? maxTokenAge : secs(maxTokenAge));
1546
1550
  if (age - tolerance > max)
1547
- throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat", checkFailed);
1551
+ throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', claimsSet, "iat", checkFailed);
1548
1552
  if (age < -tolerance)
1549
- throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat", checkFailed);
1553
+ throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', claimsSet, "iat", checkFailed);
1550
1554
  }
1551
- return payload;
1555
+ return claimsSet;
1552
1556
  }
1553
- var producerPayloads;
1554
- function producerPayload(producer) {
1555
- return producerPayloads.get(producer);
1557
+ var producerClaimsSets;
1558
+ function producerClaimsSet(producer) {
1559
+ return producerClaimsSets.get(producer);
1556
1560
  }
1557
- function jwtData(producer) {
1558
- const payload = producerPayload(producer);
1561
+ function jwtClaimsSetBytes(producer) {
1562
+ const claimsSet = producerClaimsSet(producer);
1559
1563
  for (const claim of ["iat", "nbf", "exp"]) {
1560
- const value = payload[claim];
1564
+ const value = claimsSet[claim];
1561
1565
  if (typeof value == "number" && !Number.isFinite(value))
1562
1566
  throw new TypeError(`"${claim}" claim must be a finite number`);
1563
1567
  }
1564
- return encoder.encode(JSON.stringify(payload));
1568
+ return encoder.encode(JSON.stringify(claimsSet));
1565
1569
  }
1566
1570
  function jwtClaim(producer, claim) {
1567
- return producerPayload(producer)[claim];
1571
+ return producerClaimsSet(producer)[claim];
1568
1572
  }
1569
1573
  var JWTClaimsBuilder = class {
1570
- constructor(payload = {}) {
1571
- if (!isObject(payload))
1574
+ constructor(claimsSet = {}) {
1575
+ if (!isObject(claimsSet))
1572
1576
  throw new TypeError("JWT Claims Set MUST be an object");
1573
- (producerPayloads ||= /* @__PURE__ */ new WeakMap()).set(this, structuredClone(payload));
1577
+ (producerClaimsSets ||= /* @__PURE__ */ new WeakMap()).set(this, structuredClone(claimsSet));
1574
1578
  }
1575
1579
  setIssuer(value) {
1576
- return validateStringClaim("iss", value), producerPayload(this).iss = value, this;
1580
+ return validateStringClaim("iss", value), producerClaimsSet(this).iss = value, this;
1577
1581
  }
1578
1582
  setSubject(value) {
1579
- return validateStringClaim("sub", value), producerPayload(this).sub = value, this;
1583
+ return validateStringClaim("sub", value), producerClaimsSet(this).sub = value, this;
1580
1584
  }
1581
1585
  setAudience(value) {
1582
- return validateAudienceClaim(value), producerPayload(this).aud = value, this;
1586
+ return validateAudienceClaim(value), producerClaimsSet(this).aud = value, this;
1583
1587
  }
1584
1588
  setJti(value) {
1585
- return validateStringClaim("jti", value), producerPayload(this).jti = value, this;
1589
+ return validateStringClaim("jti", value), producerClaimsSet(this).jti = value, this;
1586
1590
  }
1587
1591
  setNotBefore(value) {
1588
- return producerPayload(this).nbf = numericDate(value, "setNotBefore"), this;
1592
+ return producerClaimsSet(this).nbf = numericDate(value, "setNotBefore"), this;
1589
1593
  }
1590
1594
  setExpirationTime(value) {
1591
- return producerPayload(this).exp = numericDate(value, "setExpirationTime"), this;
1595
+ return producerClaimsSet(this).exp = numericDate(value, "setExpirationTime"), this;
1592
1596
  }
1593
1597
  setIssuedAt(value) {
1594
- const payload = producerPayload(this);
1595
- return value === void 0 ? payload.iat = epoch(/* @__PURE__ */ new Date()) : typeof value == "string" ? payload.iat = validateInput("setIssuedAt", epoch(/* @__PURE__ */ new Date()) + secs(value)) : payload.iat = numericDate(value, "setIssuedAt"), this;
1598
+ const claimsSet = producerClaimsSet(this);
1599
+ return value === void 0 ? claimsSet.iat = epoch(/* @__PURE__ */ new Date()) : typeof value == "string" ? claimsSet.iat = validateInput("setIssuedAt", epoch(/* @__PURE__ */ new Date()) + secs(value)) : claimsSet.iat = numericDate(value, "setIssuedAt"), this;
1596
1600
  }
1597
1601
  };
1598
1602
 
1599
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/verify.js
1603
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/verify.js
1600
1604
  async function jwtVerify(jwt, key, options) {
1601
1605
  const [verified, b64] = await verifyCompact(jwt, prepareVerify(options), key);
1602
1606
  if (!b64)
@@ -1605,7 +1609,7 @@ async function jwtVerify(jwt, key, options) {
1605
1609
  return { ...verified, payload };
1606
1610
  }
1607
1611
 
1608
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/decrypt.js
1612
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/decrypt.js
1609
1613
  async function jwtDecrypt(jwt, key, options) {
1610
1614
  const { plaintext, ...result } = await decryptCompact(jwt, prepareDecrypt(options), key), { protectedHeader } = result, payload = validateClaimsSet(protectedHeader, plaintext, options);
1611
1615
  for (const claim of ["iss", "sub", "aud"])
@@ -1614,7 +1618,7 @@ async function jwtDecrypt(jwt, key, options) {
1614
1618
  return { payload, ...result };
1615
1619
  }
1616
1620
 
1617
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/compact/encrypt.js
1621
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/compact/encrypt.js
1618
1622
  var CompactEncrypt = class {
1619
1623
  #input;
1620
1624
  constructor(plaintext) {
@@ -1637,7 +1641,7 @@ var CompactEncrypt = class {
1637
1641
  }
1638
1642
  };
1639
1643
 
1640
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js
1644
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js
1641
1645
  var FlattenedEncrypt = class {
1642
1646
  #input;
1643
1647
  constructor(plaintext) {
@@ -1669,12 +1673,12 @@ var FlattenedEncrypt = class {
1669
1673
  }
1670
1674
  };
1671
1675
 
1672
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jws_sign.js
1676
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/jws_sign.js
1673
1677
  async function createSignature(input, key, rejectUnencoded) {
1674
- let [payload, protectedHeader, unprotectedHeader, crit] = input, protectedHeaderString = "";
1678
+ let [payload, protectedHeader, unprotectedHeader, crit] = input, encodedProtectedHeader = "";
1675
1679
  if (protectedHeader !== void 0) {
1676
1680
  const normalized = serializeJoseHeader(JWSInvalid, protectedHeader);
1677
- protectedHeader = normalized[0], protectedHeaderString = encode2(normalized[1]);
1681
+ protectedHeader = normalized[0], encodedProtectedHeader = encode2(normalized[1]);
1678
1682
  }
1679
1683
  if (unprotectedHeader !== void 0 && (unprotectedHeader = serializeJoseHeader(JWSInvalid, unprotectedHeader)[0]), !protectedHeader && !unprotectedHeader)
1680
1684
  throw new JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
@@ -1688,26 +1692,26 @@ async function createSignature(input, key, rejectUnencoded) {
1688
1692
  if (typeof alg != "string" || !alg)
1689
1693
  throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
1690
1694
  const entry = jwsAlgorithm(alg);
1691
- let payloadS = "", payloadB = payload, data;
1695
+ let encodedPayload = "", signingPayload = payload, signingInput;
1692
1696
  if (b64) {
1693
- const encoded = input[4];
1694
- encoded ? (payloadS = encoded[0] ??= encode2(payload), payloadB = encoded[1] ??= encode(payloadS)) : (payloadS = encode2(payload), data = encoder.encode(`${protectedHeaderString}.${payloadS}`));
1697
+ const encodedPayloadCache = input[4];
1698
+ encodedPayloadCache ? (encodedPayload = encodedPayloadCache[0] ??= encode2(payload), signingPayload = encodedPayloadCache[1] ??= encode(encodedPayload)) : (encodedPayload = encode2(payload), signingInput = encoder.encode(`${encodedProtectedHeader}.${encodedPayload}`));
1695
1699
  }
1696
- data ??= concat(encode(protectedHeaderString), encode("."), payloadB);
1697
- const k = await rawKey(await prepareKey(entry, key, "sign"), entry.subtle, "sign");
1698
- entry.minRsaBits && checkModulusLength(entry.alg, k);
1700
+ signingInput ??= concat(encode(encodedProtectedHeader), encode("."), signingPayload);
1701
+ const signingKey = await rawKey(await prepareKey(entry, key, "sign"), entry.subtle, "sign");
1702
+ entry.minRsaBits && checkModulusLength(entry.alg, signingKey);
1699
1703
  const jws = {
1700
- signature: encode2(new Uint8Array(await crypto.subtle.sign(entry.signing, k, data))),
1701
- payload: payloadS
1704
+ signature: encode2(new Uint8Array(await crypto.subtle.sign(entry.signing, signingKey, signingInput))),
1705
+ payload: encodedPayload
1702
1706
  };
1703
- return protectedHeader && (jws.protected = protectedHeaderString), unprotectedHeader && (jws.header = unprotectedHeader), [jws, b64];
1707
+ return protectedHeader && (jws.protected = encodedProtectedHeader), unprotectedHeader && (jws.header = unprotectedHeader), [jws, b64];
1704
1708
  }
1705
1709
  async function createCompactSignature(payload, protectedHeader, crit, key, rejectUnencoded) {
1706
1710
  const [jws] = await createSignature([payload, protectedHeader, void 0, crit], key, rejectUnencoded);
1707
1711
  return `${jws.protected}.${jws.payload}.${jws.signature}`;
1708
1712
  }
1709
1713
 
1710
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jws/compact/sign.js
1714
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jws/compact/sign.js
1711
1715
  var CompactSign = class {
1712
1716
  #payload;
1713
1717
  #protectedHeader;
@@ -1724,7 +1728,7 @@ var CompactSign = class {
1724
1728
  }
1725
1729
  };
1726
1730
 
1727
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jws/flattened/sign.js
1731
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jws/flattened/sign.js
1728
1732
  var FlattenedSign = class {
1729
1733
  #input;
1730
1734
  constructor(payload) {
@@ -1744,7 +1748,7 @@ var FlattenedSign = class {
1744
1748
  }
1745
1749
  };
1746
1750
 
1747
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jws/general/sign.js
1751
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jws/general/sign.js
1748
1752
  var IndividualSignature = class {
1749
1753
  #parent;
1750
1754
  state;
@@ -1784,21 +1788,21 @@ var GeneralSign = class {
1784
1788
  const jws = {
1785
1789
  signatures: [],
1786
1790
  payload: ""
1787
- }, encoded = [];
1791
+ }, encodedPayloadCache = [];
1788
1792
  let b64;
1789
1793
  for (const signature of this.#signatures) {
1790
- const [protectedHeader, unprotectedHeader, key, crit] = signature.state, [{ payload, ...rest }, signatureB64] = await createSignature([this.#payload, protectedHeader, unprotectedHeader, crit, encoded], key);
1794
+ const [protectedHeader, unprotectedHeader, key, crit] = signature.state, [{ payload, ...signatureMembers }, signatureB64] = await createSignature([this.#payload, protectedHeader, unprotectedHeader, crit, encodedPayloadCache], key);
1791
1795
  if (b64 === void 0)
1792
1796
  b64 = signatureB64, jws.payload = payload;
1793
1797
  else if (b64 !== signatureB64)
1794
1798
  throw new JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");
1795
- jws.signatures.push(rest);
1799
+ jws.signatures.push(signatureMembers);
1796
1800
  }
1797
1801
  return jws;
1798
1802
  }
1799
1803
  };
1800
1804
 
1801
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/sign.js
1805
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/sign.js
1802
1806
  var SignJWT_base = JWTClaimsBuilder;
1803
1807
  var SignJWT = class extends SignJWT_base {
1804
1808
  #protectedHeader;
@@ -1806,13 +1810,13 @@ var SignJWT = class extends SignJWT_base {
1806
1810
  return assertNotSet(this.#protectedHeader, "setProtectedHeader"), this.#protectedHeader = protectedHeader, this;
1807
1811
  }
1808
1812
  async sign(key, options) {
1809
- return createCompactSignature(jwtData(this), this.#protectedHeader, options?.crit, key, () => {
1813
+ return createCompactSignature(jwtClaimsSetBytes(this), this.#protectedHeader, options?.crit, key, () => {
1810
1814
  throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
1811
1815
  });
1812
1816
  }
1813
1817
  };
1814
1818
 
1815
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/encrypt.js
1819
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/encrypt.js
1816
1820
  var EncryptJWT_base = JWTClaimsBuilder;
1817
1821
  var EncryptJWT = class extends EncryptJWT_base {
1818
1822
  #input = [void 0];
@@ -1841,7 +1845,7 @@ var EncryptJWT = class extends EncryptJWT_base {
1841
1845
  return this.#replicateAudienceAsHeader = true, this;
1842
1846
  }
1843
1847
  async encrypt(key, options) {
1844
- const plaintext = jwtData(this);
1848
+ const plaintext = jwtClaimsSetBytes(this);
1845
1849
  this.#input[1] && (this.#replicateIssuerAsHeader || this.#replicateSubjectAsHeader || this.#replicateAudienceAsHeader) && (this.#input[1] = {
1846
1850
  ...this.#input[1],
1847
1851
  iss: this.#replicateIssuerAsHeader ? jwtClaim(this, "iss") : void 0,
@@ -1853,7 +1857,7 @@ var EncryptJWT = class extends EncryptJWT_base {
1853
1857
  }
1854
1858
  };
1855
1859
 
1856
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key_algorithm.js
1860
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/key_algorithm.js
1857
1861
  var algArgument = '"alg" (Algorithm)';
1858
1862
  function unsupportedAlg(source = 'JWK "alg" (Algorithm) Parameter') {
1859
1863
  throw new JOSENotSupported(`Invalid or unsupported ${source} value`);
@@ -1862,7 +1866,7 @@ function keyAlgorithm(alg, source) {
1862
1866
  return (typeof alg == "string" ? JWS[alg] ?? JWE[alg] : void 0) ?? unsupportedAlg(source);
1863
1867
  }
1864
1868
 
1865
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/lib/asn1.js
1869
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/lib/asn1.js
1866
1870
  var formatPEM = (b64, descriptor) => {
1867
1871
  const newlined = (b64.match(/.{1,64}/g) || []).join(`
1868
1872
  `);
@@ -1967,8 +1971,8 @@ var genericImport = async (keyFormat, keyData, alg, options) => {
1967
1971
  try {
1968
1972
  const state = createASN1State(keyData);
1969
1973
  parseKeyHeader(state, keyFormat), algorithm = entry.resolve({ crv: parseECAlgorithmIdentifier(state) });
1970
- } catch {
1971
- throw new JOSENotSupported("Invalid or unsupported key format");
1974
+ } catch (cause) {
1975
+ throw new JOSENotSupported("Invalid or unsupported key format", { cause });
1972
1976
  }
1973
1977
  else
1974
1978
  algorithm = entry.subtle;
@@ -2006,7 +2010,7 @@ var fromX509 = (pem, alg, options) => {
2006
2010
  return genericImport("spki", spki, alg, options);
2007
2011
  };
2008
2012
 
2009
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/key/export.js
2013
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/key/export.js
2010
2014
  function exportSPKI(key) {
2011
2015
  return toSPKI(key);
2012
2016
  }
@@ -2035,7 +2039,7 @@ async function exportJWK(key) {
2035
2039
  return jwk;
2036
2040
  }
2037
2041
 
2038
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwk/thumbprint.js
2042
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwk/thumbprint.js
2039
2043
  var check = (value, description) => {
2040
2044
  if (typeof value != "string" || !value)
2041
2045
  throw new JWKInvalid(`${description} missing or invalid`);
@@ -2051,30 +2055,30 @@ async function calculateJwkThumbprint(key, digestAlgorithm) {
2051
2055
  throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
2052
2056
  if (digestAlgorithm ??= "sha256", digestAlgorithm !== "sha256" && digestAlgorithm !== "sha384" && digestAlgorithm !== "sha512")
2053
2057
  throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');
2054
- let components;
2058
+ let requiredMembers;
2055
2059
  switch (jwk.kty) {
2056
2060
  case "AKP":
2057
- check(jwk.alg, '"alg" (Algorithm) Parameter'), check(jwk.pub, '"pub" (Public key) Parameter'), components = { alg: jwk.alg, kty: jwk.kty, pub: jwk.pub };
2061
+ check(jwk.alg, '"alg" (Algorithm) Parameter'), check(jwk.pub, '"pub" (Public key) Parameter'), requiredMembers = { alg: jwk.alg, kty: jwk.kty, pub: jwk.pub };
2058
2062
  break;
2059
2063
  case "EC":
2060
- check(jwk.crv, '"crv" (Curve) Parameter'), check(jwk.x, '"x" (X Coordinate) Parameter'), check(jwk.y, '"y" (Y Coordinate) Parameter'), components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y };
2064
+ check(jwk.crv, '"crv" (Curve) Parameter'), check(jwk.x, '"x" (X Coordinate) Parameter'), check(jwk.y, '"y" (Y Coordinate) Parameter'), requiredMembers = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y };
2061
2065
  break;
2062
2066
  case "OKP":
2063
- check(jwk.crv, '"crv" (Subtype of Key Pair) Parameter'), check(jwk.x, '"x" (Public Key) Parameter'), components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x };
2067
+ check(jwk.crv, '"crv" (Subtype of Key Pair) Parameter'), check(jwk.x, '"x" (Public Key) Parameter'), requiredMembers = { crv: jwk.crv, kty: jwk.kty, x: jwk.x };
2064
2068
  break;
2065
2069
  case "RSA":
2066
- check(jwk.e, '"e" (Exponent) Parameter'), check(jwk.n, '"n" (Modulus) Parameter'), components = { e: jwk.e, kty: jwk.kty, n: jwk.n };
2070
+ check(jwk.e, '"e" (Exponent) Parameter'), check(jwk.n, '"n" (Modulus) Parameter'), requiredMembers = { e: jwk.e, kty: jwk.kty, n: jwk.n };
2067
2071
  break;
2068
2072
  case "oct":
2069
2073
  if (typeof jwk.k != "string")
2070
2074
  throw new JWKInvalid('"k" (Key Value) Parameter missing or invalid');
2071
- components = { k: jwk.k, kty: jwk.kty };
2075
+ requiredMembers = { k: jwk.k, kty: jwk.kty };
2072
2076
  break;
2073
2077
  default:
2074
2078
  throw new JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported');
2075
2079
  }
2076
- const data = encode(JSON.stringify(components));
2077
- return encode2(await digest(digestAlgorithm, data));
2080
+ const thumbprintInput = encode(JSON.stringify(requiredMembers));
2081
+ return encode2(await digest(digestAlgorithm, thumbprintInput));
2078
2082
  }
2079
2083
  async function calculateJwkThumbprintUri(key, digestAlgorithm) {
2080
2084
  digestAlgorithm ??= "sha256";
@@ -2082,7 +2086,7 @@ async function calculateJwkThumbprintUri(key, digestAlgorithm) {
2082
2086
  return `urn:ietf:params:oauth:jwk-thumbprint:sha-${digestAlgorithm.slice(-3)}:${thumbprint}`;
2083
2087
  }
2084
2088
 
2085
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwk/embedded.js
2089
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwk/embedded.js
2086
2090
  async function EmbeddedJWK(protectedHeader, token) {
2087
2091
  const joseHeader = {
2088
2092
  ...protectedHeader,
@@ -2107,7 +2111,7 @@ async function EmbeddedJWK(protectedHeader, token) {
2107
2111
  return key;
2108
2112
  }
2109
2113
 
2110
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwks/local.js
2114
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwks/local.js
2111
2115
  function isUsableJWK(jwk, entry, alg, kid) {
2112
2116
  const { kty, key_ops: keyOps, ext, kid: jwkKid, alg: jwkAlg, use, crv } = jwk;
2113
2117
  return (ext === void 0 || typeof ext == "boolean") && (keyOps === void 0 || Array.isArray(keyOps) && keyOps.every((operation, index) => typeof operation == "string" && keyOps.indexOf(operation) === index) && keyOps.includes("verify")) && entry.kty.includes(kty) && (kid === void 0 || typeof kid == "string" && kid === jwkKid) && (jwkAlg === void 0 ? kty !== "AKP" : alg === jwkAlg) && (use === void 0 || use === "sig") && (!entry.crv || crv === entry.crv);
@@ -2130,7 +2134,8 @@ function createLocalJWKSet(jwks) {
2130
2134
  let snapshot;
2131
2135
  try {
2132
2136
  snapshot = structuredClone(jwks);
2133
- } catch {
2137
+ } catch (cause) {
2138
+ throw new JWKSInvalid("JSON Web Key Set malformed", { cause });
2134
2139
  }
2135
2140
  if (!isJwkSet(snapshot))
2136
2141
  throw new JWKSInvalid("JSON Web Key Set malformed");
@@ -2161,12 +2166,12 @@ function createLocalJWKSet(jwks) {
2161
2166
  });
2162
2167
  }
2163
2168
 
2164
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwks/remote.js
2169
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwks/remote.js
2165
2170
  function isCloudflareWorkers() {
2166
2171
  return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
2167
2172
  }
2168
2173
  var USER_AGENT;
2169
- (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.12");
2174
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.13");
2170
2175
  var customFetch = /* @__PURE__ */ Symbol();
2171
2176
  async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
2172
2177
  const response = await fetchImpl(url, {
@@ -2175,14 +2180,14 @@ async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
2175
2180
  redirect: "manual",
2176
2181
  headers
2177
2182
  }).catch((err) => {
2178
- throw err.name === "TimeoutError" ? new JWKSTimeout() : err;
2183
+ throw err.name === "TimeoutError" ? new JWKSTimeout(void 0, { cause: err }) : err;
2179
2184
  });
2180
2185
  if (response.status !== 200)
2181
2186
  throw new JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");
2182
2187
  try {
2183
2188
  return await response.json();
2184
- } catch {
2185
- throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON");
2189
+ } catch (cause) {
2190
+ throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON", { cause });
2186
2191
  }
2187
2192
  }
2188
2193
  var jwksCache = /* @__PURE__ */ Symbol();
@@ -2256,12 +2261,12 @@ function createRemoteJWKSet(url, options) {
2256
2261
  });
2257
2262
  }
2258
2263
 
2259
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/unsecured.js
2264
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/jwt/unsecured.js
2260
2265
  var UnsecuredJWT_base = JWTClaimsBuilder;
2261
2266
  var UnsecuredJWT = class extends UnsecuredJWT_base {
2262
2267
  encode() {
2263
- const header = encode2(JSON.stringify({ alg: "none" })), payload = encode2(jwtData(this));
2264
- return `${header}.${payload}.`;
2268
+ const encodedProtectedHeader = encode2(JSON.stringify({ alg: "none" })), encodedPayload = encode2(jwtClaimsSetBytes(this));
2269
+ return `${encodedProtectedHeader}.${encodedPayload}.`;
2265
2270
  }
2266
2271
  static decode(jwt, options) {
2267
2272
  if (typeof jwt != "string")
@@ -2285,7 +2290,7 @@ var UnsecuredJWT = class extends UnsecuredJWT_base {
2285
2290
  }
2286
2291
  };
2287
2292
 
2288
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/key/import.js
2293
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/key/import.js
2289
2294
  async function importSPKI(spki, alg, options) {
2290
2295
  if (typeof spki != "string" || spki.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
2291
2296
  throw new TypeError('"spki" must be SPKI formatted string');
@@ -2328,52 +2333,52 @@ async function importJWK(jwk, alg, options) {
2328
2333
  }
2329
2334
  }
2330
2335
 
2331
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/util/decode_protected_header.js
2336
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/util/decode_protected_header.js
2332
2337
  function decodeProtectedHeader(token) {
2333
- let protectedB64u;
2338
+ let encodedProtectedHeader;
2334
2339
  if (typeof token == "string") {
2335
2340
  const parts = token.split(".");
2336
- (parts.length === 3 || parts.length === 5) && ([protectedB64u] = parts);
2341
+ (parts.length === 3 || parts.length === 5) && ([encodedProtectedHeader] = parts);
2337
2342
  } else if (typeof token == "object" && token)
2338
2343
  if ("protected" in token)
2339
- protectedB64u = token.protected;
2344
+ encodedProtectedHeader = token.protected;
2340
2345
  else
2341
2346
  throw new TypeError("Token does not contain a Protected Header");
2342
2347
  const invalid2 = "Invalid Token or Protected Header formatting";
2343
- if (typeof protectedB64u != "string" || !protectedB64u)
2348
+ if (typeof encodedProtectedHeader != "string" || !encodedProtectedHeader)
2344
2349
  throw new TypeError(invalid2);
2345
- return parseJoseHeader(protectedB64u, TypeError, invalid2);
2350
+ return parseJoseHeader(encodedProtectedHeader, TypeError, invalid2);
2346
2351
  }
2347
2352
 
2348
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/util/decode_jwt.js
2353
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/util/decode_jwt.js
2349
2354
  function decodeJwt(jwt) {
2350
2355
  if (typeof jwt != "string")
2351
2356
  throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");
2352
- const { 1: payload, length } = jwt.split(".");
2357
+ const { 1: encodedPayload, length } = jwt.split(".");
2353
2358
  if (length === 5)
2354
2359
  throw new JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");
2355
2360
  if (length !== 3)
2356
2361
  throw new JWTInvalid("Invalid JWT");
2357
- if (!payload)
2362
+ if (!encodedPayload)
2358
2363
  throw new JWTInvalid("JWTs must contain a payload");
2359
- let decoded;
2364
+ let claimsSetBytes;
2360
2365
  try {
2361
- decoded = decode(payload);
2362
- } catch {
2363
- throw new JWTInvalid("Failed to base64url decode the payload");
2366
+ claimsSetBytes = decode(encodedPayload);
2367
+ } catch (cause) {
2368
+ throw new JWTInvalid("Failed to base64url decode the payload", { cause });
2364
2369
  }
2365
- let result;
2370
+ let claimsSet;
2366
2371
  try {
2367
- result = JSON.parse(strictDecoder.decode(decoded));
2368
- } catch {
2369
- throw new JWTInvalid("Failed to parse the decoded payload as JSON");
2372
+ claimsSet = JSON.parse(strictDecoder.decode(claimsSetBytes));
2373
+ } catch (cause) {
2374
+ throw new JWTInvalid("Failed to parse the decoded payload as JSON", { cause });
2370
2375
  }
2371
- if (!isObject(result))
2376
+ if (!isObject(claimsSet))
2372
2377
  throw new JWTInvalid("Invalid JWT Claims Set");
2373
- return result;
2378
+ return claimsSet;
2374
2379
  }
2375
2380
 
2376
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/key/generate_key_pair.js
2381
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/key/generate_key_pair.js
2377
2382
  function getModulusLengthOption(options) {
2378
2383
  const modulusLength = options?.modulusLength ?? 2048;
2379
2384
  if (typeof modulusLength != "number" || !Number.isInteger(modulusLength) || modulusLength < 2048)
@@ -2404,15 +2409,15 @@ async function generateKeyPair(alg, options) {
2404
2409
  ]);
2405
2410
  }
2406
2411
 
2407
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/key/generate_secret.js
2412
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/key/generate_secret.js
2408
2413
  async function generateSecret(alg, options) {
2409
2414
  const extractable = validateExtractableOption(options?.extractable);
2410
- let length, algorithm, keyUsages;
2415
+ let keyLengthBits, algorithm, keyUsages;
2411
2416
  switch (alg) {
2412
2417
  case "HS256":
2413
2418
  case "HS384":
2414
2419
  case "HS512":
2415
- length = +alg.slice(-3), algorithm = { name: "HMAC", hash: `SHA-${length}`, length }, keyUsages = ["sign", "verify"];
2420
+ keyLengthBits = +alg.slice(-3), algorithm = { name: "HMAC", hash: `SHA-${keyLengthBits}`, length: keyLengthBits }, keyUsages = ["sign", "verify"];
2416
2421
  break;
2417
2422
  case "A128CBC-HS256":
2418
2423
  case "A192CBC-HS384":
@@ -2421,7 +2426,7 @@ async function generateSecret(alg, options) {
2421
2426
  case "A128KW":
2422
2427
  case "A192KW":
2423
2428
  case "A256KW":
2424
- length = +alg.slice(1, 4), algorithm = { name: "AES-KW", length }, keyUsages = ["wrapKey", "unwrapKey"];
2429
+ keyLengthBits = +alg.slice(1, 4), algorithm = { name: "AES-KW", length: keyLengthBits }, keyUsages = ["wrapKey", "unwrapKey"];
2425
2430
  break;
2426
2431
  case "A128GCMKW":
2427
2432
  case "A192GCMKW":
@@ -2429,7 +2434,7 @@ async function generateSecret(alg, options) {
2429
2434
  case "A128GCM":
2430
2435
  case "A192GCM":
2431
2436
  case "A256GCM":
2432
- length = +alg.slice(1, 4), algorithm = { name: "AES-GCM", length }, keyUsages = ["encrypt", "decrypt"];
2437
+ keyLengthBits = +alg.slice(1, 4), algorithm = { name: "AES-GCM", length: keyLengthBits }, keyUsages = ["encrypt", "decrypt"];
2433
2438
  break;
2434
2439
  default:
2435
2440
  unsupportedAlg(algArgument);
@@ -2437,45 +2442,46 @@ async function generateSecret(alg, options) {
2437
2442
  return crypto.subtle.generateKey(algorithm, extractable ?? false, keyUsages);
2438
2443
  }
2439
2444
 
2440
- // node_modules/.pnpm/mcporter@0.15.0/node_modules/mcporter/node_modules/jose/dist/webapi/index.js
2445
+ // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/node_modules/jose/dist/webapi/index.js
2441
2446
  var cryptoRuntime = "WebCryptoAPI";
2447
+
2442
2448
  export {
2449
+ errors_exports,
2450
+ base64url_exports,
2451
+ compactDecrypt,
2452
+ flattenedDecrypt,
2453
+ generalDecrypt,
2454
+ GeneralEncrypt,
2455
+ compactVerify,
2456
+ flattenedVerify,
2457
+ generalVerify,
2458
+ jwtVerify,
2459
+ jwtDecrypt,
2443
2460
  CompactEncrypt,
2444
- CompactSign,
2445
- EmbeddedJWK,
2446
- EncryptJWT,
2447
2461
  FlattenedEncrypt,
2462
+ CompactSign,
2448
2463
  FlattenedSign,
2449
- GeneralEncrypt,
2450
2464
  GeneralSign,
2451
2465
  SignJWT,
2452
- UnsecuredJWT,
2453
- base64url_exports as base64url,
2466
+ EncryptJWT,
2467
+ exportSPKI,
2468
+ exportPKCS8,
2469
+ exportJWK,
2454
2470
  calculateJwkThumbprint,
2455
2471
  calculateJwkThumbprintUri,
2456
- compactDecrypt,
2457
- compactVerify,
2472
+ EmbeddedJWK,
2458
2473
  createLocalJWKSet,
2459
- createRemoteJWKSet,
2460
- cryptoRuntime,
2461
2474
  customFetch,
2462
- decodeJwt,
2475
+ jwksCache,
2476
+ createRemoteJWKSet,
2477
+ UnsecuredJWT,
2478
+ importSPKI,
2479
+ importX509,
2480
+ importPKCS8,
2481
+ importJWK,
2463
2482
  decodeProtectedHeader,
2464
- errors_exports as errors,
2465
- exportJWK,
2466
- exportPKCS8,
2467
- exportSPKI,
2468
- flattenedDecrypt,
2469
- flattenedVerify,
2470
- generalDecrypt,
2471
- generalVerify,
2483
+ decodeJwt,
2472
2484
  generateKeyPair,
2473
2485
  generateSecret,
2474
- importJWK,
2475
- importPKCS8,
2476
- importSPKI,
2477
- importX509,
2478
- jwksCache,
2479
- jwtDecrypt,
2480
- jwtVerify
2486
+ cryptoRuntime
2481
2487
  };