@zuplo/cli 7.6.9 → 7.7.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 (220) hide show
  1. package/node_modules/@inquirer/checkbox/package.json +3 -3
  2. package/node_modules/@inquirer/confirm/dist/index.js +1 -1
  3. package/node_modules/@inquirer/confirm/package.json +3 -3
  4. package/node_modules/@inquirer/core/dist/lib/create-prompt.js +66 -47
  5. package/node_modules/@inquirer/core/package.json +2 -2
  6. package/node_modules/@inquirer/editor/package.json +3 -3
  7. package/node_modules/@inquirer/expand/package.json +3 -3
  8. package/node_modules/@inquirer/input/package.json +3 -3
  9. package/node_modules/@inquirer/number/package.json +3 -3
  10. package/node_modules/@inquirer/password/package.json +3 -3
  11. package/node_modules/@inquirer/rawlist/package.json +3 -3
  12. package/node_modules/@inquirer/search/package.json +3 -3
  13. package/node_modules/@inquirer/select/package.json +3 -3
  14. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/index.d.ts +1 -2
  15. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -11
  16. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +13 -16
  17. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -11
  18. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +16 -19
  19. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +10 -16
  20. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +18 -21
  21. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -1
  22. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwk/thumbprint.d.ts +4 -6
  23. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwks/local.d.ts +5 -4
  24. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwks/remote.d.ts +20 -21
  25. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/compact/sign.d.ts +4 -4
  26. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/compact/verify.d.ts +8 -11
  27. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/flattened/sign.d.ts +5 -5
  28. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/flattened/verify.d.ts +8 -11
  29. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/sign.d.ts +10 -14
  30. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/verify.d.ts +11 -17
  31. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/decrypt.d.ts +14 -11
  32. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +24 -22
  33. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/sign.d.ts +3 -7
  34. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -6
  35. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/verify.d.ts +13 -6
  36. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/export.d.ts +6 -6
  37. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/generate_key_pair.d.ts +9 -14
  38. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/generate_secret.d.ts +10 -10
  39. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/import.d.ts +19 -18
  40. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/types.d.ts +152 -247
  41. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/base64url.d.ts +7 -7
  42. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/decode_jwt.d.ts +6 -1
  43. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -3
  44. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/errors.d.ts +29 -40
  45. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +1 -2
  46. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +9 -26
  47. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +3 -3
  48. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +11 -30
  49. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/decrypt.js +6 -6
  50. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +33 -57
  51. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/embedded.js +3 -4
  52. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/thumbprint.js +3 -6
  53. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/local.js +16 -10
  54. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +2 -2
  55. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/compact/sign.js +2 -4
  56. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/compact/verify.js +2 -2
  57. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/sign.js +8 -15
  58. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/verify.js +4 -14
  59. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/sign.js +4 -11
  60. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/verify.js +5 -7
  61. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/decrypt.js +2 -3
  62. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/encrypt.js +11 -25
  63. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/sign.js +1 -1
  64. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/unsecured.js +1 -2
  65. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/verify.js +4 -4
  66. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/export.js +12 -16
  67. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_key_pair.js +4 -13
  68. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_secret.js +1 -1
  69. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/import.js +5 -9
  70. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/asn1.js +2 -4
  71. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/buffer_utils.js +35 -0
  72. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/content_encryption.js +21 -29
  73. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/deflate.js +9 -19
  74. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +0 -4
  75. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +21 -54
  76. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +26 -59
  77. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_sign.js +29 -43
  78. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_verify.js +37 -45
  79. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +1 -1
  80. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key.js +119 -59
  81. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_management.js +45 -80
  82. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/{options.js → validate.js} +64 -3
  83. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/base64url.js +5 -19
  84. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/decode_jwt.js +1 -1
  85. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/decode_protected_header.js +1 -1
  86. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
  87. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/index.d.ts +1 -2
  88. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -11
  89. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +13 -16
  90. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -11
  91. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +16 -19
  92. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +10 -16
  93. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +18 -21
  94. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -1
  95. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/thumbprint.d.ts +4 -6
  96. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/local.d.ts +5 -4
  97. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/remote.d.ts +20 -21
  98. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/sign.d.ts +4 -4
  99. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/verify.d.ts +8 -11
  100. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/sign.d.ts +5 -5
  101. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/verify.d.ts +8 -11
  102. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/sign.d.ts +10 -14
  103. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts +11 -17
  104. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/decrypt.d.ts +14 -11
  105. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +24 -22
  106. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/sign.d.ts +3 -7
  107. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -6
  108. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/verify.d.ts +13 -6
  109. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/export.d.ts +6 -6
  110. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_key_pair.d.ts +9 -14
  111. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_secret.d.ts +10 -10
  112. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/import.d.ts +19 -18
  113. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +152 -247
  114. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/base64url.d.ts +7 -7
  115. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_jwt.d.ts +6 -1
  116. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -3
  117. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/errors.d.ts +29 -40
  118. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +1 -2
  119. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +9 -26
  120. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +3 -3
  121. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +11 -30
  122. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +6 -6
  123. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +33 -57
  124. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/embedded.js +3 -4
  125. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/thumbprint.js +3 -6
  126. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/local.js +16 -10
  127. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +2 -2
  128. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/sign.js +2 -4
  129. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/verify.js +2 -2
  130. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/sign.js +8 -15
  131. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/verify.js +4 -14
  132. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/sign.js +4 -11
  133. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +5 -7
  134. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/decrypt.js +2 -3
  135. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/encrypt.js +11 -25
  136. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/sign.js +1 -1
  137. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/unsecured.js +1 -2
  138. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/verify.js +4 -4
  139. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/export.js +12 -16
  140. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_key_pair.js +4 -13
  141. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_secret.js +1 -1
  142. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/import.js +5 -9
  143. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/asn1.js +2 -4
  144. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/buffer_utils.js +35 -0
  145. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/content_encryption.js +21 -29
  146. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/deflate.js +9 -19
  147. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +0 -4
  148. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +21 -54
  149. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +26 -59
  150. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_sign.js +29 -43
  151. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_verify.js +37 -45
  152. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +1 -1
  153. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +119 -59
  154. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +45 -80
  155. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/{options.js → validate.js} +64 -3
  156. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/base64url.js +5 -19
  157. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_jwt.js +1 -1
  158. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_protected_header.js +1 -1
  159. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  160. package/node_modules/@posthog/core/dist/posthog-core.d.ts +14 -0
  161. package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
  162. package/node_modules/@posthog/core/dist/types.d.ts +1 -0
  163. package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
  164. package/node_modules/@posthog/core/dist/utils/index.d.ts +1 -0
  165. package/node_modules/@posthog/core/dist/utils/index.d.ts.map +1 -1
  166. package/node_modules/@posthog/core/dist/utils/index.js +26 -0
  167. package/node_modules/@posthog/core/dist/utils/index.mjs +1 -0
  168. package/node_modules/@posthog/core/dist/utils/webview-app-utils.d.ts +12 -0
  169. package/node_modules/@posthog/core/dist/utils/webview-app-utils.d.ts.map +1 -0
  170. package/node_modules/@posthog/core/dist/utils/webview-app-utils.js +132 -0
  171. package/node_modules/@posthog/core/dist/utils/webview-app-utils.mjs +94 -0
  172. package/node_modules/@posthog/core/package.json +2 -2
  173. package/node_modules/@posthog/core/src/featureFlagLocalEvaluation.ts +1 -1
  174. package/node_modules/@posthog/core/src/posthog-core.ts +14 -0
  175. package/node_modules/@posthog/core/src/types.ts +1 -0
  176. package/node_modules/@posthog/core/src/utils/index.ts +1 -0
  177. package/node_modules/@posthog/core/src/utils/otlp-any-value.spec.ts +1 -1
  178. package/node_modules/@posthog/core/src/utils/type-utils.ts +4 -4
  179. package/node_modules/@posthog/core/src/utils/webview-app-utils.spec.ts +118 -0
  180. package/node_modules/@posthog/core/src/utils/webview-app-utils.ts +49 -0
  181. package/node_modules/@posthog/types/dist/feature-flags.d.ts +1 -1
  182. package/node_modules/@posthog/types/dist/feature-flags.d.ts.map +1 -1
  183. package/node_modules/@posthog/types/dist/posthog-config.d.ts +7 -1
  184. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  185. package/node_modules/@posthog/types/package.json +1 -1
  186. package/node_modules/@posthog/types/src/feature-flags.ts +1 -1
  187. package/node_modules/@posthog/types/src/posthog-config.ts +7 -1
  188. package/node_modules/@posthog/types/src/tree-shakeable.ts +1 -1
  189. package/node_modules/@zuplo/core/package.json +1 -1
  190. package/node_modules/@zuplo/graphql/package.json +1 -1
  191. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  192. package/node_modules/@zuplo/otel/package.json +1 -1
  193. package/node_modules/@zuplo/runtime/out/esm/{chunk-Z3IKCP3N.js → chunk-R4PTES5B.js} +93 -93
  194. package/node_modules/@zuplo/runtime/out/esm/chunk-R4PTES5B.js.map +1 -0
  195. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  196. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  197. package/node_modules/@zuplo/runtime/package.json +1 -1
  198. package/package.json +11 -11
  199. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/base64.js +0 -20
  200. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/crypto_key.js +0 -27
  201. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/helpers.js +0 -45
  202. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -12
  203. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/is_key_like.js +0 -19
  204. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwk_metadata.js +0 -19
  205. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwk_to_key.js +0 -10
  206. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_options.js +0 -8
  207. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/signing.js +0 -22
  208. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/type_checks.js +0 -30
  209. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/base64.js +0 -20
  210. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/crypto_key.js +0 -27
  211. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/helpers.js +0 -45
  212. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -12
  213. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/is_key_like.js +0 -19
  214. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_metadata.js +0 -19
  215. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_to_key.js +0 -10
  216. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_options.js +0 -8
  217. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/signing.js +0 -22
  218. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/type_checks.js +0 -30
  219. package/node_modules/@zuplo/runtime/out/esm/chunk-Z3IKCP3N.js.map +0 -1
  220. /package/node_modules/@zuplo/runtime/out/esm/{chunk-Z3IKCP3N.js.LEGAL.txt → chunk-R4PTES5B.js.LEGAL.txt} +0 -0
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Decodes a base64url-encoded input.
2
+ * Decodes base64url text or its UTF-8 bytes.
3
3
  *
4
- * @param input Base64URL encoded input, as a string or its UTF-8 bytes.
4
+ * @param input Base64url-encoded string or its UTF-8 bytes.
5
5
  * @returns The decoded bytes.
6
- * @throws {!TypeError} When the input is not correctly Base64URL encoded. Standard Base64 input
7
- * (i.e. containing `+` or `/`) is rejected.
6
+ * @throws {TypeError} If the input is not valid base64url. Standard Base64 `+` and `/` are
7
+ * rejected.
8
8
  */
9
9
  export declare function decode(input: Uint8Array | string): Uint8Array;
10
10
  /**
11
- * Encodes input using unpadded base64url.
11
+ * Encodes unpadded base64url; strings are first encoded as UTF-8.
12
12
  *
13
- * @param input Input to encode, as a string or as bytes. Strings are encoded as UTF-8 first.
14
- * @returns The Base64URL encoded, unpadded, representation of the input.
13
+ * @param input Bytes or a string to encode. Strings are first encoded as UTF-8.
14
+ * @returns The unpadded base64url representation of the input.
15
15
  */
16
16
  export declare function encode(input: Uint8Array | string): string;
@@ -1,3 +1,8 @@
1
1
  import type * as t from '../types.d.ts';
2
- /** Decodes the Claims Set of a JWS-formatted JSON Web Token without verifying the signature. */
2
+ /**
3
+ * Decodes the Claims Set of a JWT in Compact JWS serialization without checking its signature or
4
+ * validating claim types and values.
5
+ *
6
+ * @returns The parsed JWT Claims Set.
7
+ */
3
8
  export declare function decodeJwt<PayloadType = t.JWTPayload>(jwt: string): PayloadType & t.JWTPayload & ([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never);
@@ -1,9 +1,10 @@
1
1
  import type * as t from '../types.d.ts';
2
- /** JWE and JWS Header Parameters. */
2
+ /** JWE and JWS Header Parameters returned by {@link decodeProtectedHeader}. */
3
3
  export type ProtectedHeaderParameters = t.JWSHeaderParameters & t.JWEHeaderParameters;
4
4
  /**
5
- * Decodes the Protected Header of a JWE, JWS, or JWT in any JOSE serialization.
5
+ * Decodes the Protected Header of a JWE, JWS, or JWT without authenticating the token.
6
6
  *
7
- * @param token JWE/JWS/JWT token in any JOSE serialization.
7
+ * @param token Compact token or JSON serialization object with a `protected` member.
8
+ * @returns The parsed Protected Header.
8
9
  */
9
10
  export declare function decodeProtectedHeader(token: string | object): ProtectedHeaderParameters;
@@ -1,70 +1,64 @@
1
1
  import type * as t from '../types.d.ts';
2
2
  /** Stable error codes used by this module. */
3
3
  export type JOSEErrorCode = 'ERR_JOSE_ALG_NOT_ALLOWED' | 'ERR_JOSE_GENERIC' | 'ERR_JOSE_NOT_SUPPORTED' | 'ERR_JWE_DECRYPTION_FAILED' | 'ERR_JWE_INVALID' | 'ERR_JWK_INVALID' | 'ERR_JWKS_INVALID' | 'ERR_JWKS_MULTIPLE_MATCHING_KEYS' | 'ERR_JWKS_NO_MATCHING_KEY' | 'ERR_JWKS_TIMEOUT' | 'ERR_JWS_INVALID' | 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED' | 'ERR_JWT_CLAIM_VALIDATION_FAILED' | 'ERR_JWT_EXPIRED' | 'ERR_JWT_INVALID';
4
- /**
5
- * Shared properties of JWT Claims Set validation errors.
6
- *
7
- * > Note: {@link JWTExpired} does not extend {@link JWTClaimValidationFailed}, so `instanceof
8
- * > JWTClaimValidationFailed` is `false` for an expired JWT. Use {@link JWTClaimValidationError} or
9
- * > the {@link JOSEError.code code} discriminant to handle both.
10
- */
4
+ /** Shared details of JWT claim or header validation failures. */
11
5
  export interface JWTClaimValidationFailure {
12
- /** The Claim for which the validation failed. */
6
+ /** Claim or header that failed validation. */
13
7
  claim: string;
14
8
  /** Reason code for the validation failure. */
15
9
  reason: JWTClaimValidationReason;
16
- /** The parsed JWT Claims Set (aka payload). */
10
+ /** The parsed JWT Claims Set; validation of other claims may be incomplete. */
17
11
  payload: t.JWTPayload;
18
12
  }
19
13
  /** Reason codes produced by JWT Claims Set validation. */
20
14
  export type JWTClaimValidationReason = 'check_failed' | 'invalid' | 'mismatch' | 'missing' | 'unspecified' | (string & {});
21
15
  /** Base class for JOSE errors. */
22
16
  export declare class JOSEError extends Error {
23
- /** A unique error code for the particular error subclass. */
17
+ /** Stable code identifying the error class. */
24
18
  static code: JOSEErrorCode | (string & {});
25
- /**
26
- * A unique error code for {@link JOSEError}. Each subclass sets its own; see {@link AnyJOSEError}
27
- * to switch over them as a discriminated union.
28
- */
19
+ /** Stable code identifying the error class. Use {@link AnyJOSEError} to narrow subclasses by code. */
29
20
  code: JOSEErrorCode | (string & {});
30
21
  constructor(message?: string, options?: {
31
22
  cause?: unknown;
32
23
  });
33
24
  }
34
- /** Thrown when JWT Claims Set validation fails. */
25
+ /**
26
+ * Thrown when JWT claim or header validation fails. Expiration is reported separately as
27
+ * {@link JWTExpired}.
28
+ */
35
29
  export declare class JWTClaimValidationFailed extends JOSEError implements JWTClaimValidationFailure {
36
30
  static code: JOSEErrorCode | (string & {});
37
31
  code: JOSEErrorCode | (string & {});
38
- /** The {@link JWTClaimValidationFailure} carried by every instance of this error. */
32
+ /** The {@link JWTClaimValidationFailure} details carried by this error. */
39
33
  cause: JWTClaimValidationFailure;
40
- /** The Claim for which the validation failed. */
34
+ /** Claim or header that failed validation. */
41
35
  claim: string;
42
36
  /** Reason code for the validation failure. */
43
37
  reason: JWTClaimValidationReason;
44
38
  /**
45
- * The parsed JWT Claims Set (aka payload). Other JWT claims may or may not have been verified at
46
- * this point. The JSON Web Signature (JWS) or a JSON Web Encryption (JWE) structures' integrity
47
- * has however been verified. Claims Set verification happens after the JWS Signature or JWE
48
- * Decryption processes.
39
+ * The parsed JWT Claims Set; validation of other claims may be incomplete. With
40
+ * {@link jwt/verify.jwtVerify jwtVerify} and {@link jwt/decrypt.jwtDecrypt jwtDecrypt}, token
41
+ * authentication precedes claim validation. {@link jwt/unsecured.UnsecuredJWT.decode} does not
42
+ * authenticate tokens.
49
43
  */
50
44
  payload: t.JWTPayload;
51
45
  constructor(message: string, payload: t.JWTPayload, claim?: string, reason?: JWTClaimValidationReason);
52
46
  }
53
- /** Thrown when a JWT is expired. */
47
+ /** Thrown when a JWT has expired or exceeds the configured maximum token age. */
54
48
  export declare class JWTExpired extends JOSEError implements JWTClaimValidationFailure {
55
49
  static code: JOSEErrorCode | (string & {});
56
50
  code: JOSEErrorCode | (string & {});
57
- /** The {@link JWTClaimValidationFailure} carried by every instance of this error. */
51
+ /** The {@link JWTClaimValidationFailure} details carried by this error. */
58
52
  cause: JWTClaimValidationFailure;
59
- /** The Claim for which the validation failed. */
53
+ /** Claim or header that failed validation. */
60
54
  claim: string;
61
55
  /** Reason code for the validation failure. */
62
56
  reason: JWTClaimValidationReason;
63
57
  /**
64
- * The parsed JWT Claims Set (aka payload). Other JWT claims may or may not have been verified at
65
- * this point. The JSON Web Signature (JWS) or a JSON Web Encryption (JWE) structures' integrity
66
- * has however been verified. Claims Set verification happens after the JWS Signature or JWE
67
- * Decryption processes.
58
+ * The parsed JWT Claims Set; validation of other claims may be incomplete. With
59
+ * {@link jwt/verify.jwtVerify jwtVerify} and {@link jwt/decrypt.jwtDecrypt jwtDecrypt}, token
60
+ * authentication precedes claim validation. {@link jwt/unsecured.UnsecuredJWT.decode} does not
61
+ * authenticate tokens.
68
62
  */
69
63
  payload: t.JWTPayload;
70
64
  constructor(message: string, payload: t.JWTPayload, claim?: string, reason?: JWTClaimValidationReason);
@@ -79,7 +73,7 @@ export declare class JOSENotSupported extends JOSEError {
79
73
  static code: JOSEErrorCode | (string & {});
80
74
  code: JOSEErrorCode | (string & {});
81
75
  }
82
- /** Thrown when JWE ciphertext decryption fails. */
76
+ /** Thrown when JWE ciphertext decryption or authentication fails. */
83
77
  export declare class JWEDecryptionFailed extends JOSEError {
84
78
  static code: JOSEErrorCode | (string & {});
85
79
  code: JOSEErrorCode | (string & {});
@@ -123,11 +117,10 @@ export declare class JWKSNoMatchingKey extends JOSEError {
123
117
  /** Thrown when multiple keys match in a JWKS. */
124
118
  export declare class JWKSMultipleMatchingKeys extends JOSEError {
125
119
  /**
126
- * Iterates the public keys that matched the JWS JOSE Header, so that verification can be
127
- * attempted with each in turn. See the {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet}
128
- * and {@link jwks/local.createLocalJWKSet createLocalJWKSet} examples. Instances thrown by this
129
- * module always iterate the matched keys; an instance constructed by other code iterates
130
- * nothing.
120
+ * Yields public keys matching the JWS Header so verification can be attempted with each. See the
121
+ * {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} and
122
+ * {@link jwks/local.createLocalJWKSet createLocalJWKSet} examples. Empty on manually constructed
123
+ * errors.
131
124
  */
132
125
  [Symbol.asyncIterator]: () => AsyncIterableIterator<t.CryptoKey>;
133
126
  static code: JOSEErrorCode | (string & {});
@@ -155,12 +148,8 @@ export declare class JWSSignatureVerificationFailed extends JOSEError {
155
148
  /** Errors thrown during JWT Claims Set validation. */
156
149
  export type JWTClaimValidationError = JWTClaimValidationFailed | JWTExpired;
157
150
  /**
158
- * Discriminated union of the specific {@link JOSEError} subclasses.
159
- *
160
- * > Note: The base {@link JOSEError} is deliberately not a member — its `code` spans every value, which
161
- * > would defeat the discriminant. A small number of JSON Web Key Set HTTP failures are thrown as the
162
- * > base class itself, so `instanceof JOSEError` remains the catch-all; this union is for handling a
163
- * > value already known to be one of the specific errors.
151
+ * Discriminated union of specific {@link JOSEError} subclasses, narrowed by `code`. Excludes base
152
+ * {@link JOSEError} instances; use `instanceof JOSEError` to catch all module errors.
164
153
  */
165
154
  export type AnyJOSEError = (JOSEAlgNotAllowed & {
166
155
  code: 'ERR_JOSE_ALG_NOT_ALLOWED';
@@ -1,7 +1,6 @@
1
1
  import { prepareDecrypt, decryptCompact } from "../../lib/jwe_decrypt.js";
2
2
  async function compactDecrypt(jwe, key, options) {
3
- const decrypted = await decryptCompact(jwe, prepareDecrypt(options), key), result = { plaintext: decrypted[0], protectedHeader: decrypted[1] };
4
- return typeof key == "function" ? { ...result, key: decrypted[2] } : result;
3
+ return decryptCompact(jwe, prepareDecrypt(options), key);
5
4
  }
6
5
  export {
7
6
  compactDecrypt
@@ -1,41 +1,24 @@
1
- import { assertNotSet } from "../../lib/helpers.js";
2
- import { assertUint8Array } from "../../lib/type_checks.js";
3
- import { createJWE } from "../../lib/jwe_encrypt.js";
1
+ import { assertNotSet, assertUint8Array } from "../../lib/validate.js";
2
+ import { compactJWE, createJWE } from "../../lib/jwe_encrypt.js";
4
3
  class CompactEncrypt {
5
- #plaintext;
6
- #protectedHeader;
7
- #cek;
8
- #iv;
9
- #keyManagementParameters;
4
+ #input;
10
5
  constructor(plaintext) {
11
- assertUint8Array(plaintext, "plaintext"), this.#plaintext = plaintext;
6
+ assertUint8Array(plaintext, "plaintext"), this.#input = [plaintext];
12
7
  }
13
8
  setContentEncryptionKey(cek) {
14
- return assertNotSet(this.#cek, "setContentEncryptionKey"), this.#cek = cek, this;
9
+ return assertNotSet(this.#input[5], "setContentEncryptionKey"), this.#input[5] = cek, this;
15
10
  }
16
11
  setInitializationVector(iv) {
17
- return assertNotSet(this.#iv, "setInitializationVector"), this.#iv = iv, this;
12
+ return assertNotSet(this.#input[6], "setInitializationVector"), this.#input[6] = iv, this;
18
13
  }
19
14
  setProtectedHeader(protectedHeader) {
20
- return assertNotSet(this.#protectedHeader, "setProtectedHeader"), this.#protectedHeader = protectedHeader, this;
15
+ return assertNotSet(this.#input[1], "setProtectedHeader"), this.#input[1] = protectedHeader, this;
21
16
  }
22
17
  setKeyManagementParameters(parameters) {
23
- return assertNotSet(this.#keyManagementParameters, "setKeyManagementParameters"), this.#keyManagementParameters = parameters, this;
18
+ return assertNotSet(this.#input[7], "setKeyManagementParameters"), this.#input[7] = parameters, this;
24
19
  }
25
20
  async encrypt(key, options) {
26
- const jwe = await createJWE([
27
- this.#plaintext,
28
- this.#protectedHeader,
29
- void 0,
30
- void 0,
31
- void 0,
32
- this.#cek,
33
- this.#iv,
34
- this.#keyManagementParameters,
35
- void 0,
36
- !1
37
- ], key, options);
38
- return [jwe.protected, jwe.encrypted_key, jwe.iv, jwe.ciphertext, jwe.tag].join(".");
21
+ return compactJWE(await createJWE([...this.#input], key, options));
39
22
  }
40
23
  }
41
24
  export {
@@ -1,6 +1,6 @@
1
1
  import { JWEInvalid } from "../../util/errors.js";
2
- import { isObject } from "../../lib/type_checks.js";
3
- import { prepareDecrypt, decryptJWE, decryptResult, checkRecipient, snapshotSharedJWE, snapshotRecipientJWE } from "../../lib/jwe_decrypt.js";
2
+ import { isObject } from "../../lib/validate.js";
3
+ import { prepareDecrypt, decryptJWE, checkRecipient, snapshotSharedJWE, snapshotRecipientJWE } from "../../lib/jwe_decrypt.js";
4
4
  async function flattenedDecrypt(jwe, key, options) {
5
5
  if (!isObject(jwe))
6
6
  throw new JWEInvalid("Flattened JWE must be an object");
@@ -8,7 +8,7 @@ async function flattenedDecrypt(jwe, key, options) {
8
8
  if (!recipient)
9
9
  throw error;
10
10
  const snapshot = { ...shared, ...recipient };
11
- return checkRecipient(snapshot), decryptResult(snapshot, await decryptJWE(snapshot, prepareDecrypt(options), key));
11
+ return checkRecipient(snapshot), decryptJWE(snapshot, prepareDecrypt(options), key);
12
12
  }
13
13
  export {
14
14
  flattenedDecrypt
@@ -1,52 +1,33 @@
1
- import { assertNotSet } from "../../lib/helpers.js";
1
+ import { assertNotSet, assertUint8Array } from "../../lib/validate.js";
2
2
  import { createJWE } from "../../lib/jwe_encrypt.js";
3
- import { assertUint8Array } from "../../lib/type_checks.js";
4
3
  class FlattenedEncrypt {
5
- #plaintext;
6
- #protectedHeader;
7
- #sharedUnprotectedHeader;
8
- #unprotectedHeader;
9
- #aad;
10
- #cek;
11
- #iv;
12
- #keyManagementParameters;
4
+ #input;
13
5
  constructor(plaintext) {
14
- assertUint8Array(plaintext, "plaintext"), this.#plaintext = plaintext;
6
+ assertUint8Array(plaintext, "plaintext"), this.#input = [plaintext];
15
7
  }
16
8
  setKeyManagementParameters(parameters) {
17
- return assertNotSet(this.#keyManagementParameters, "setKeyManagementParameters"), this.#keyManagementParameters = parameters, this;
9
+ return assertNotSet(this.#input[7], "setKeyManagementParameters"), this.#input[7] = parameters, this;
18
10
  }
19
11
  setProtectedHeader(protectedHeader) {
20
- return assertNotSet(this.#protectedHeader, "setProtectedHeader"), this.#protectedHeader = protectedHeader, this;
12
+ return assertNotSet(this.#input[1], "setProtectedHeader"), this.#input[1] = protectedHeader, this;
21
13
  }
22
14
  setSharedUnprotectedHeader(sharedUnprotectedHeader) {
23
- return assertNotSet(this.#sharedUnprotectedHeader, "setSharedUnprotectedHeader"), this.#sharedUnprotectedHeader = sharedUnprotectedHeader, this;
15
+ return assertNotSet(this.#input[3], "setSharedUnprotectedHeader"), this.#input[3] = sharedUnprotectedHeader, this;
24
16
  }
25
17
  setUnprotectedHeader(unprotectedHeader) {
26
- return assertNotSet(this.#unprotectedHeader, "setUnprotectedHeader"), this.#unprotectedHeader = unprotectedHeader, this;
18
+ return assertNotSet(this.#input[2], "setUnprotectedHeader"), this.#input[2] = unprotectedHeader, this;
27
19
  }
28
20
  setAdditionalAuthenticatedData(aad) {
29
- return this.#aad = aad, this;
21
+ return this.#input[4] = aad, this;
30
22
  }
31
23
  setContentEncryptionKey(cek) {
32
- return assertNotSet(this.#cek, "setContentEncryptionKey"), this.#cek = cek, this;
24
+ return assertNotSet(this.#input[5], "setContentEncryptionKey"), this.#input[5] = cek, this;
33
25
  }
34
26
  setInitializationVector(iv) {
35
- return assertNotSet(this.#iv, "setInitializationVector"), this.#iv = iv, this;
27
+ return assertNotSet(this.#input[6], "setInitializationVector"), this.#input[6] = iv, this;
36
28
  }
37
29
  async encrypt(key, options) {
38
- return createJWE([
39
- this.#plaintext,
40
- this.#protectedHeader,
41
- this.#unprotectedHeader,
42
- this.#sharedUnprotectedHeader,
43
- this.#aad,
44
- this.#cek,
45
- this.#iv,
46
- this.#keyManagementParameters,
47
- void 0,
48
- !1
49
- ], key, options);
30
+ return createJWE([...this.#input], key, options);
50
31
  }
51
32
  }
52
33
  export {
@@ -1,6 +1,6 @@
1
- import { prepareDecrypt, shareJWE, decryptRecipient, decryptResult, checkRecipient, snapshotSharedJWE, snapshotRecipientJWE } from "../../lib/jwe_decrypt.js";
1
+ import { prepareDecrypt, shareJWE, decryptJWE, checkRecipient, snapshotSharedJWE, snapshotRecipientJWE } from "../../lib/jwe_decrypt.js";
2
2
  import { JWEDecryptionFailed, JWEInvalid } from "../../util/errors.js";
3
- import { isObject } from "../../lib/type_checks.js";
3
+ import { isObject } from "../../lib/validate.js";
4
4
  import { JWE, isJWECEKTransport } from "../../lib/jwe_algorithms.js";
5
5
  async function generalDecrypt(jwe, key, options) {
6
6
  if (!isObject(jwe))
@@ -19,10 +19,10 @@ async function generalDecrypt(jwe, key, options) {
19
19
  } catch {
20
20
  throw new JWEDecryptionFailed();
21
21
  }
22
- const recipientSnapshots = recipients.map((recipient) => snapshotRecipientJWE(recipient)), recipientAlgorithms = recipientSnapshots.map(([, headerAlg]) => token[0]?.alg ?? headerAlg ?? sharedJwe.unprotected?.alg);
22
+ const recipientSnapshots = recipients.map((recipient) => snapshotRecipientJWE(recipient));
23
23
  if (recipients.length > 1)
24
- for (const alg of recipientAlgorithms) {
25
- const algEntry = typeof alg == "string" ? JWE[alg] : void 0;
24
+ for (const [, headerAlg] of recipientSnapshots) {
25
+ const alg = token[0]?.alg ?? headerAlg ?? sharedJwe.unprotected?.alg, algEntry = typeof alg == "string" ? JWE[alg] : void 0;
26
26
  if (algEntry && !isJWECEKTransport(algEntry))
27
27
  throw new JWEInvalid(`"${alg}" alg may only have a single recipient`);
28
28
  }
@@ -30,7 +30,7 @@ async function generalDecrypt(jwe, key, options) {
30
30
  if (recipient)
31
31
  try {
32
32
  const flattened = { ...sharedJwe, ...recipient };
33
- return checkRecipient(flattened), decryptResult(flattened, await decryptRecipient(flattened, token, shared, key));
33
+ return checkRecipient(flattened), await decryptJWE(flattened, shared, key, token);
34
34
  } catch {
35
35
  }
36
36
  throw new JWEDecryptionFailed();
@@ -1,10 +1,10 @@
1
- import { assertNotSet } from "../../lib/helpers.js";
1
+ import { assertNotSet, assertUint8Array } from "../../lib/validate.js";
2
2
  import { JWEInvalid } from "../../util/errors.js";
3
3
  import { generateCek } from "../../lib/content_encryption.js";
4
4
  import { encode as b64u } from "../../util/base64url.js";
5
- import { checkDisjoint, checkEncryptHeaders, createJWE, encryptJWE, transportCek } from "../../lib/jwe_encrypt.js";
6
- import { JWE, isJWECEKTransport, jweAlgorithm } from "../../lib/jwe_algorithms.js";
7
- import { assertUint8Array } from "../../lib/type_checks.js";
5
+ import { checkDisjoint, checkEncryptHeaders, encryptJWE } from "../../lib/jwe_encrypt.js";
6
+ import { encryptKeyManagement } from "../../lib/key_management.js";
7
+ import { isJWECEKTransport, jweAlgorithm } from "../../lib/jwe_algorithms.js";
8
8
  class IndividualRecipient {
9
9
  #parent;
10
10
  state;
@@ -27,10 +27,6 @@ class IndividualRecipient {
27
27
  return this.#parent;
28
28
  }
29
29
  }
30
- function copyOptionalMembers(flattened, jwe, recipient) {
31
- const { aad, protected: protectedHeader, unprotected, header } = flattened;
32
- aad && (jwe.aad = aad), protectedHeader && (jwe.protected = protectedHeader), unprotected && (jwe.unprotected = unprotected), header && (recipient.header = header);
33
- }
34
30
  class GeneralEncrypt {
35
31
  #plaintext;
36
32
  #recipients = [];
@@ -56,28 +52,12 @@ class GeneralEncrypt {
56
52
  async encrypt() {
57
53
  if (!this.#recipients.length)
58
54
  throw new JWEInvalid("at least one recipient must be added");
59
- if (assertUint8Array(this.#plaintext, "plaintext"), this.#recipients.length === 1) {
60
- const [unprotectedHeader, keyManagementParameters, key, crit] = this.#recipients[0].state, flattened = await createJWE([
61
- this.#plaintext,
62
- this.#protectedHeader,
63
- unprotectedHeader,
64
- this.#unprotectedHeader,
65
- this.#aad,
66
- void 0,
67
- void 0,
68
- keyManagementParameters,
69
- crit,
70
- !1
71
- ], key), jwe2 = {
72
- ciphertext: flattened.ciphertext,
73
- recipients: [{}]
74
- };
75
- return flattened.iv && (jwe2.iv = flattened.iv), flattened.tag && (jwe2.tag = flattened.tag), flattened.encrypted_key && (jwe2.recipients[0].encrypted_key = flattened.encrypted_key), copyOptionalMembers(flattened, jwe2, jwe2.recipients[0]), jwe2;
76
- }
55
+ assertUint8Array(this.#plaintext, "plaintext");
56
+ const multiple = this.#recipients.length > 1;
77
57
  let enc, protectedHeader = this.#protectedHeader, sharedUnprotectedHeader = this.#unprotectedHeader;
78
- const inputs = [], checked = [];
79
- for (let i = 0; i < this.#recipients.length; i++) {
80
- const recipient = this.#recipients[i], [unprotectedHeader, keyManagementParameters, , crit] = recipient.state, input = [
58
+ const recipients = [];
59
+ for (const recipient of this.#recipients) {
60
+ const [unprotectedHeader, keyManagementParameters, key, crit] = recipient.state, input = [
81
61
  this.#plaintext,
82
62
  protectedHeader,
83
63
  unprotectedHeader,
@@ -87,39 +67,35 @@ class GeneralEncrypt {
87
67
  void 0,
88
68
  keyManagementParameters,
89
69
  crit,
90
- !0
91
- ], headers = checkEncryptHeaders(input);
92
- inputs.push(input), checked.push(headers), i === 0 && (protectedHeader = input[1], sharedUnprotectedHeader = input[3]);
93
- const algEntry = JWE[headers[1]];
94
- if (algEntry && !isJWECEKTransport(algEntry))
95
- throw new JWEInvalid(`"${headers[1]}" alg may only have a single recipient`);
70
+ multiple
71
+ ], headers = checkEncryptHeaders(input, void 0, recipients.length > 0);
72
+ recipients.length || (protectedHeader = input[1], sharedUnprotectedHeader = input[3]), recipients.push([input, headers, key]);
73
+ const [{ alg, enc: recipientEnc }, , algEntry] = headers;
74
+ if (multiple && algEntry && !isJWECEKTransport(algEntry))
75
+ throw new JWEInvalid(`"${alg}" alg may only have a single recipient`);
96
76
  if (!enc)
97
- enc = headers[2];
98
- else if (enc !== headers[2])
77
+ enc = recipientEnc;
78
+ else if (enc !== recipientEnc)
99
79
  throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients');
100
80
  }
101
- const algEntries = checked.map(([, alg]) => {
102
- const algEntry = jweAlgorithm(alg);
103
- if (!isJWECEKTransport(algEntry))
104
- throw new JWEInvalid(`"${alg}" alg may only have a single recipient`);
105
- return algEntry;
106
- }), cek = generateCek(checked[0][3]), jwe = {
107
- ciphertext: "",
108
- recipients: []
81
+ for (const [, headers] of recipients)
82
+ headers[2] ??= jweAlgorithm(headers[0].alg);
83
+ const [firstInput, firstHeaders, firstKey] = recipients[0], cek = multiple ? generateCek(firstHeaders[1]) : void 0;
84
+ firstInput[5] = cek;
85
+ const { encrypted_key, header, ...shared } = await encryptJWE(firstInput, firstHeaders, firstKey), jwe = {
86
+ ...shared,
87
+ recipients: [{}]
109
88
  };
110
- for (let i = 0; i < this.#recipients.length; i++) {
111
- const recipient = this.#recipients[i], [, keyManagementParameters, key] = recipient.state, target = {};
112
- if (jwe.recipients.push(target), i === 0) {
113
- inputs[0][5] = cek;
114
- const flattened = await encryptJWE(inputs[0], checked[0], key, algEntries[0]);
115
- jwe.ciphertext = flattened.ciphertext, flattened.iv && (jwe.iv = flattened.iv), flattened.tag && (jwe.tag = flattened.tag), flattened.encrypted_key && (target.encrypted_key = flattened.encrypted_key), copyOptionalMembers(flattened, jwe, target);
116
- continue;
117
- }
118
- const [joseHeader, , , encEntry] = checked[i], unprotectedHeader = inputs[i][2], [, encryptedKey, parameters] = await transportCek(algEntries[i], encEntry, key, cek, joseHeader, keyManagementParameters);
119
- if (target.encrypted_key = b64u(encryptedKey), unprotectedHeader || parameters) {
120
- const header = { ...unprotectedHeader, ...parameters };
121
- parameters && checkDisjoint(inputs[i][1], header, inputs[i][3]), target.header = header;
89
+ encrypted_key && (jwe.recipients[0].encrypted_key = encrypted_key), header && (jwe.recipients[0].header = header);
90
+ for (let i = 1; i < recipients.length; i++) {
91
+ const [input, [joseHeader, encEntry, algEntry], key] = recipients[i], unprotectedHeader = input[2], [, encryptedKey, parameters] = await encryptKeyManagement(algEntry, encEntry, key, joseHeader, cek, input[7]), target = {
92
+ encrypted_key: b64u(encryptedKey)
93
+ };
94
+ if (unprotectedHeader || parameters) {
95
+ const header2 = { ...unprotectedHeader, ...parameters };
96
+ parameters && checkDisjoint(input[1], header2, input[3]), target.header = header2;
122
97
  }
98
+ jwe.recipients.push(target);
123
99
  }
124
100
  return jwe;
125
101
  }
@@ -1,8 +1,7 @@
1
- import { jwkToKey } from "../lib/jwk_to_key.js";
1
+ import { jwkToKey, normalizeJwk } from "../lib/key.js";
2
2
  import { jwsAlgorithm } from "../lib/jws_algorithms.js";
3
- import { isObject } from "../lib/type_checks.js";
3
+ import { isObject } from "../lib/validate.js";
4
4
  import { JWSInvalid } from "../util/errors.js";
5
- import { normalizeJwk } from "../lib/jwk_metadata.js";
6
5
  async function EmbeddedJWK(protectedHeader, token) {
7
6
  const joseHeader = {
8
7
  ...protectedHeader,
@@ -21,7 +20,7 @@ async function EmbeddedJWK(protectedHeader, token) {
21
20
  throw new JWSInvalid('Invalid Embedded JWK, its "use" must be "sig" when present');
22
21
  if (jwk.alg !== void 0 && jwk.alg !== entry.alg)
23
22
  throw new JWSInvalid(`Invalid Embedded JWK, its "alg" must be "${entry.alg}" when present`);
24
- const key = await jwkToKey(entry, { ...jwk, ext: !0 });
23
+ const key = await jwkToKey(entry, jwk, !0);
25
24
  if (key.type !== "public")
26
25
  throw new JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');
27
26
  return key;
@@ -1,12 +1,9 @@
1
- import { digest } from "../lib/helpers.js";
1
+ import { digest, encode } from "../lib/buffer_utils.js";
2
2
  import { encode as b64u } from "../util/base64url.js";
3
3
  import { JOSENotSupported, JWKInvalid } from "../util/errors.js";
4
- import { encode } from "../lib/buffer_utils.js";
5
- import { isKeyLike } from "../lib/is_key_like.js";
6
- import { isObject } from "../lib/type_checks.js";
4
+ import { isKeyLike, invalidKeyInput, snapshotJwk } from "../lib/key.js";
5
+ import { isObject } from "../lib/validate.js";
7
6
  import { exportJWK } from "../key/export.js";
8
- import { invalidKeyInput } from "../lib/invalid_key_input.js";
9
- import { snapshotJwk } from "../lib/jwk_metadata.js";
10
7
  const check = (value, description) => {
11
8
  if (typeof value != "string" || !value)
12
9
  throw new JWKInvalid(`${description} missing or invalid`);
@@ -1,19 +1,22 @@
1
- import { jwkToKey } from "../lib/jwk_to_key.js";
1
+ import { jwkToKey, snapshotJwk } from "../lib/key.js";
2
2
  import { JWS } from "../lib/jws_algorithms.js";
3
3
  import { JWKSInvalid, JOSENotSupported, JWKSNoMatchingKey, JWKSMultipleMatchingKeys } from "../util/errors.js";
4
- import { isJwkSet } from "../lib/type_checks.js";
5
- import { snapshotJwk } from "../lib/jwk_metadata.js";
4
+ import { isJwkSet } from "../lib/validate.js";
6
5
  function isUsableJWK(jwk, entry, alg, kid) {
7
- const { kty, key_ops, ext, kid: jwkKid, alg: jwkAlg, use, crv } = snapshotJwk(jwk), keyOps = Array.isArray(key_ops) ? [...key_ops] : key_ops;
6
+ const { kty, key_ops: keyOps, ext, kid: jwkKid, alg: jwkAlg, use, crv } = jwk;
8
7
  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);
9
8
  }
10
9
  async function importWithAlgCache(cache, jwk, entry) {
11
10
  const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk), { alg } = entry;
12
11
  if (cached[alg] === void 0) {
13
- const key = await jwkToKey(entry, { ...jwk, alg, ext: !0 });
14
- if (key.type !== "public")
15
- throw new JWKSInvalid("JSON Web Key Set members must be public keys");
16
- cached[alg] = key;
12
+ const pending = jwkToKey(entry, jwk, !0).then((key) => {
13
+ if (key.type !== "public")
14
+ throw new JWKSInvalid("JSON Web Key Set members must be public keys");
15
+ return cached[alg] = key, key;
16
+ }).catch((error) => {
17
+ throw cached[alg] === pending && delete cached[alg], error;
18
+ });
19
+ cached[alg] = pending;
17
20
  }
18
21
  return cached[alg];
19
22
  }
@@ -25,12 +28,15 @@ function createLocalJWKSet(jwks) {
25
28
  }
26
29
  if (!isJwkSet(snapshot))
27
30
  throw new JWKSInvalid("JSON Web Key Set malformed");
28
- const cached = /* @__PURE__ */ new WeakMap();
31
+ const metadata = snapshot.keys.map((jwk) => {
32
+ const normalized = snapshotJwk(jwk);
33
+ return Array.isArray(normalized.key_ops) && (normalized.key_ops = [...normalized.key_ops]), normalized;
34
+ }), cached = /* @__PURE__ */ new WeakMap();
29
35
  return Object.defineProperty(async (protectedHeader, token) => {
30
36
  const { alg, kid } = { ...protectedHeader, ...token?.header }, entry = typeof alg == "string" ? JWS[alg] : void 0;
31
37
  if (!entry || entry.secret)
32
38
  throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
33
- const candidates = snapshot.keys.filter((jwk2) => isUsableJWK(jwk2, entry, alg, kid)), { 0: jwk, length } = candidates;
39
+ const candidates = snapshot.keys.filter((_, index) => isUsableJWK(metadata[index], entry, alg, kid)), { 0: jwk, length } = candidates;
34
40
  if (!length)
35
41
  throw new JWKSNoMatchingKey();
36
42
  if (length !== 1) {
@@ -1,11 +1,11 @@
1
1
  import { JOSEError, JWKSNoMatchingKey, JWKSTimeout } from "../util/errors.js";
2
2
  import { createLocalJWKSet } from "./local.js";
3
- import { isJwkSet } from "../lib/type_checks.js";
3
+ import { isJwkSet } from "../lib/validate.js";
4
4
  function isCloudflareWorkers() {
5
5
  return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
6
6
  }
7
7
  let USER_AGENT;
8
- (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.11");
8
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.12");
9
9
  const customFetch = /* @__PURE__ */ Symbol();
10
10
  async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
11
11
  const response = await fetchImpl(url, {
@@ -1,12 +1,10 @@
1
1
  import { createCompactSignature } from "../../lib/jws_sign.js";
2
- import { assertNotSet } from "../../lib/helpers.js";
2
+ import { assertNotSet, assertUint8Array } from "../../lib/validate.js";
3
3
  class CompactSign {
4
4
  #payload;
5
5
  #protectedHeader;
6
6
  constructor(payload) {
7
- if (!(payload instanceof Uint8Array))
8
- throw new TypeError("payload must be an instance of Uint8Array");
9
- this.#payload = payload;
7
+ assertUint8Array(payload, "payload"), this.#payload = payload;
10
8
  }
11
9
  setProtectedHeader(protectedHeader) {
12
10
  return assertNotSet(this.#protectedHeader, "setProtectedHeader"), this.#protectedHeader = protectedHeader, this;
@@ -1,7 +1,7 @@
1
1
  import { prepareVerify, verifyCompact } from "../../lib/jws_verify.js";
2
2
  async function compactVerify(jws, key, options) {
3
- const verified = await verifyCompact(jws, prepareVerify(options), key), result = { payload: verified[0], protectedHeader: verified[1] };
4
- return typeof key == "function" ? { ...result, key: verified[3] } : result;
3
+ const [result] = await verifyCompact(jws, prepareVerify(options), key);
4
+ return result;
5
5
  }
6
6
  export {
7
7
  compactVerify