@zuplo/cli 7.12.4 → 7.12.6

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 (119) hide show
  1. package/node_modules/@modelcontextprotocol/client/node_modules/jose/README.md +2 -2
  2. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +5 -4
  3. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -4
  4. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +5 -4
  5. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +5 -5
  6. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +5 -4
  7. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +5 -5
  8. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -4
  9. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/compact/verify.d.ts +5 -5
  10. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/flattened/sign.d.ts +5 -4
  11. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/flattened/verify.d.ts +6 -5
  12. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/sign.d.ts +9 -6
  13. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/verify.d.ts +7 -5
  14. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/decrypt.d.ts +7 -6
  15. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +1 -1
  16. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/sign.d.ts +1 -1
  17. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/unsecured.d.ts +1 -1
  18. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/verify.d.ts +3 -5
  19. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/export.d.ts +1 -1
  20. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/generate_secret.d.ts +1 -1
  21. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/import.d.ts +2 -2
  22. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/types.d.ts +165 -107
  23. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/decode_jwt.d.ts +2 -2
  24. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/errors.d.ts +1 -1
  25. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +3 -3
  26. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/thumbprint.js +8 -8
  27. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/local.js +2 -1
  28. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +4 -4
  29. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/sign.js +3 -3
  30. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/verify.js +3 -3
  31. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/encrypt.js +2 -2
  32. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/sign.js +2 -2
  33. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/unsecured.js +3 -3
  34. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_secret.js +4 -4
  35. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/asn1.js +2 -2
  36. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/buffer_utils.js +4 -4
  37. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/content_encryption.js +8 -8
  38. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +14 -14
  39. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +3 -3
  40. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_algorithms.js +2 -2
  41. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_sign.js +11 -11
  42. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_verify.js +19 -16
  43. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +44 -43
  44. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key.js +4 -4
  45. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_management.js +17 -17
  46. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/validate.js +10 -10
  47. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/decode_jwt.js +12 -12
  48. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -5
  49. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
  50. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/README.md +2 -2
  51. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +5 -4
  52. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -4
  53. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +5 -4
  54. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +5 -5
  55. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +5 -4
  56. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +5 -5
  57. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -4
  58. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/verify.d.ts +5 -5
  59. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/sign.d.ts +5 -4
  60. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/verify.d.ts +6 -5
  61. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/sign.d.ts +9 -6
  62. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts +7 -5
  63. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/decrypt.d.ts +7 -6
  64. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +1 -1
  65. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/sign.d.ts +1 -1
  66. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +1 -1
  67. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/verify.d.ts +3 -5
  68. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/export.d.ts +1 -1
  69. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_secret.d.ts +1 -1
  70. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/import.d.ts +2 -2
  71. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +165 -107
  72. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_jwt.d.ts +2 -2
  73. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/errors.d.ts +1 -1
  74. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +3 -3
  75. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/thumbprint.js +8 -8
  76. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/local.js +2 -1
  77. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +4 -4
  78. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/sign.js +3 -3
  79. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +3 -3
  80. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/encrypt.js +2 -2
  81. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/sign.js +2 -2
  82. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/unsecured.js +3 -3
  83. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_secret.js +4 -4
  84. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/asn1.js +2 -2
  85. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/buffer_utils.js +4 -4
  86. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/content_encryption.js +8 -8
  87. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +14 -14
  88. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +3 -3
  89. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_algorithms.js +2 -2
  90. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_sign.js +11 -11
  91. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_verify.js +19 -16
  92. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +44 -43
  93. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +4 -4
  94. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +17 -17
  95. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/validate.js +10 -10
  96. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_jwt.js +12 -12
  97. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -5
  98. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  99. package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.d.ts.map +1 -1
  100. package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.js +11 -3
  101. package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.mjs +11 -3
  102. package/node_modules/@posthog/core/package.json +1 -1
  103. package/node_modules/@posthog/core/src/featureFlagLocalEvaluation.ts +17 -9
  104. package/node_modules/@zuplo/core/customer.cli.minified.js +231 -231
  105. package/node_modules/@zuplo/core/index.minified.js +254 -254
  106. package/node_modules/@zuplo/core/package.json +1 -1
  107. package/node_modules/@zuplo/graphql/package.json +1 -1
  108. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  109. package/node_modules/@zuplo/otel/package.json +1 -1
  110. package/node_modules/@zuplo/runtime/out/esm/{chunk-WTWRZT3M.js → chunk-N2ZQITZD.js} +96 -96
  111. package/node_modules/@zuplo/runtime/out/esm/chunk-N2ZQITZD.js.map +1 -0
  112. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  113. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  114. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  115. package/node_modules/@zuplo/runtime/out/types/index.d.ts +10 -14
  116. package/node_modules/@zuplo/runtime/package.json +1 -1
  117. package/package.json +11 -11
  118. package/node_modules/@zuplo/runtime/out/esm/chunk-WTWRZT3M.js.map +0 -1
  119. /package/node_modules/@zuplo/runtime/out/esm/{chunk-WTWRZT3M.js.LEGAL.txt → chunk-N2ZQITZD.js.LEGAL.txt} +0 -0
@@ -16,8 +16,8 @@ function secs(str) {
16
16
  typeof str != "string" && invalidDuration();
17
17
  const matched = REGEX.exec(str);
18
18
  (!matched || matched[4] && matched[1]) && invalidDuration();
19
- const value = parseFloat(matched[2]), numericDate2 = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
20
- return Number.isFinite(numericDate2) || invalidDuration(), matched[1] === "-" || matched[4] === "ago" ? -numericDate2 : numericDate2;
19
+ const value = parseFloat(matched[2]), durationSeconds = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
20
+ return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4] === "ago" ? -durationSeconds : durationSeconds;
21
21
  }
22
22
  function validateInput(label, input) {
23
23
  if (!Number.isFinite(input))
@@ -39,34 +39,35 @@ const normalizeTyp = (value) => {
39
39
  const normalized = value.toLowerCase();
40
40
  return value.includes("/") ? normalized : `application/${normalized}`;
41
41
  }, checkAudiencePresence = (audPayload, audOption) => typeof audPayload == "string" ? audOption.includes(audPayload) : Array.isArray(audPayload) ? audOption.some((aud) => audPayload.includes(aud)) : !1;
42
- function validateNumericDate(payload, claim, required = !1) {
43
- const value = payload[claim];
42
+ function validateNumericDate(claimsSet, claim, required = !1) {
43
+ const value = claimsSet[claim];
44
44
  if (!(value === void 0 && !required)) {
45
45
  if (typeof value != "number")
46
- throw new JWTClaimValidationFailed(`"${claim}" claim must be a number`, payload, claim, "invalid");
46
+ throw new JWTClaimValidationFailed(`"${claim}" claim must be a number`, claimsSet, claim, "invalid");
47
47
  return value;
48
48
  }
49
49
  }
50
- function unexpectedClaim(payload, claim) {
51
- throw new JWTClaimValidationFailed(`unexpected "${claim}" claim value`, payload, claim, checkFailed);
50
+ function unexpectedClaim(claimsSet, claim) {
51
+ throw new JWTClaimValidationFailed(`unexpected "${claim}" claim value`, claimsSet, claim, checkFailed);
52
52
  }
53
- function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
54
- let payload;
53
+ function validateClaimsSet(protectedHeader, claimsSetBytes, options = {}) {
54
+ let claimsSet;
55
55
  try {
56
- payload = JSON.parse(strictDecoder.decode(encodedPayload));
57
- } catch {
56
+ claimsSet = JSON.parse(strictDecoder.decode(claimsSetBytes));
57
+ } catch (cause) {
58
+ throw new JWTInvalid("JWT Claims Set must be a top-level JSON object", { cause });
58
59
  }
59
- if (!isObject(payload))
60
+ if (!isObject(claimsSet))
60
61
  throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
61
62
  const { typ } = options;
62
63
  if (typ !== void 0 && (typeof protectedHeader.typ != "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ)))
63
- throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ", checkFailed);
64
+ throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', claimsSet, "typ", checkFailed);
64
65
  const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options, presenceCheck = [...requiredClaims];
65
66
  maxTokenAge !== void 0 && presenceCheck.push("iat"), audience !== void 0 && presenceCheck.push("aud"), subject !== void 0 && presenceCheck.push("sub"), issuer !== void 0 && presenceCheck.push("iss");
66
67
  for (const claim of new Set(presenceCheck.reverse()))
67
- if (!Object.hasOwn(payload, claim))
68
- throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, "missing");
69
- 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");
68
+ if (!Object.hasOwn(claimsSet, claim))
69
+ throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, claimsSet, claim, "missing");
70
+ 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");
70
71
  const { clockTolerance } = options;
71
72
  let tolerance = 0;
72
73
  if (typeof clockTolerance == "string")
@@ -77,70 +78,70 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
77
78
  tolerance = clockTolerance;
78
79
  }
79
80
  validateInput("clockTolerance option", tolerance);
80
- 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");
81
+ 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");
81
82
  if (nbf !== void 0 && nbf > now + tolerance)
82
- throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", checkFailed);
83
- const exp = validateNumericDate(payload, "exp");
83
+ throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', claimsSet, "nbf", checkFailed);
84
+ const exp = validateNumericDate(claimsSet, "exp");
84
85
  if (exp !== void 0 && exp <= now - tolerance)
85
- throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", checkFailed);
86
+ throw new JWTExpired('"exp" claim timestamp check failed', claimsSet, "exp", checkFailed);
86
87
  if (maxTokenAge !== void 0) {
87
88
  const age = now - iat, max = validateInput("maxTokenAge option", typeof maxTokenAge == "number" ? maxTokenAge : secs(maxTokenAge));
88
89
  if (age - tolerance > max)
89
- throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat", checkFailed);
90
+ throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', claimsSet, "iat", checkFailed);
90
91
  if (age < -tolerance)
91
- throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat", checkFailed);
92
+ throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', claimsSet, "iat", checkFailed);
92
93
  }
93
- return payload;
94
+ return claimsSet;
94
95
  }
95
- let producerPayloads;
96
- function producerPayload(producer) {
97
- return producerPayloads.get(producer);
96
+ let producerClaimsSets;
97
+ function producerClaimsSet(producer) {
98
+ return producerClaimsSets.get(producer);
98
99
  }
99
- function jwtData(producer) {
100
- const payload = producerPayload(producer);
100
+ function jwtClaimsSetBytes(producer) {
101
+ const claimsSet = producerClaimsSet(producer);
101
102
  for (const claim of ["iat", "nbf", "exp"]) {
102
- const value = payload[claim];
103
+ const value = claimsSet[claim];
103
104
  if (typeof value == "number" && !Number.isFinite(value))
104
105
  throw new TypeError(`"${claim}" claim must be a finite number`);
105
106
  }
106
- return encoder.encode(JSON.stringify(payload));
107
+ return encoder.encode(JSON.stringify(claimsSet));
107
108
  }
108
109
  function jwtClaim(producer, claim) {
109
- return producerPayload(producer)[claim];
110
+ return producerClaimsSet(producer)[claim];
110
111
  }
111
112
  class JWTClaimsBuilder {
112
- constructor(payload = {}) {
113
- if (!isObject(payload))
113
+ constructor(claimsSet = {}) {
114
+ if (!isObject(claimsSet))
114
115
  throw new TypeError("JWT Claims Set MUST be an object");
115
- (producerPayloads ||= /* @__PURE__ */ new WeakMap()).set(this, structuredClone(payload));
116
+ (producerClaimsSets ||= /* @__PURE__ */ new WeakMap()).set(this, structuredClone(claimsSet));
116
117
  }
117
118
  setIssuer(value) {
118
- return validateStringClaim("iss", value), producerPayload(this).iss = value, this;
119
+ return validateStringClaim("iss", value), producerClaimsSet(this).iss = value, this;
119
120
  }
120
121
  setSubject(value) {
121
- return validateStringClaim("sub", value), producerPayload(this).sub = value, this;
122
+ return validateStringClaim("sub", value), producerClaimsSet(this).sub = value, this;
122
123
  }
123
124
  setAudience(value) {
124
- return validateAudienceClaim(value), producerPayload(this).aud = value, this;
125
+ return validateAudienceClaim(value), producerClaimsSet(this).aud = value, this;
125
126
  }
126
127
  setJti(value) {
127
- return validateStringClaim("jti", value), producerPayload(this).jti = value, this;
128
+ return validateStringClaim("jti", value), producerClaimsSet(this).jti = value, this;
128
129
  }
129
130
  setNotBefore(value) {
130
- return producerPayload(this).nbf = numericDate(value, "setNotBefore"), this;
131
+ return producerClaimsSet(this).nbf = numericDate(value, "setNotBefore"), this;
131
132
  }
132
133
  setExpirationTime(value) {
133
- return producerPayload(this).exp = numericDate(value, "setExpirationTime"), this;
134
+ return producerClaimsSet(this).exp = numericDate(value, "setExpirationTime"), this;
134
135
  }
135
136
  setIssuedAt(value) {
136
- const payload = producerPayload(this);
137
- 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;
137
+ const claimsSet = producerClaimsSet(this);
138
+ 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;
138
139
  }
139
140
  }
140
141
  export {
141
142
  JWTClaimsBuilder,
142
143
  jwtClaim,
143
- jwtData,
144
+ jwtClaimsSetBytes,
144
145
  secs,
145
146
  validateClaimsSet
146
147
  };
@@ -17,15 +17,15 @@ const tag = (key) => key[Symbol.toStringTag], jwkMatchesOp = (entry, key, usage)
17
17
  }
18
18
  };
19
19
  async function prepareKey(entry, key, usage) {
20
- const { alg, secret } = entry, privateKey = usage === "decrypt" || usage === "sign";
20
+ const { alg, secret } = entry, requiresPrivateKey = usage === "decrypt" || usage === "sign";
21
21
  if (secret && key instanceof Uint8Array)
22
22
  return key;
23
23
  let normalized, keyObject;
24
24
  if (isObject(key)) {
25
25
  if (normalized = normalizeJwk(key), typeof normalized.kty != "string")
26
26
  throw invalidKeyType(alg, key, secret);
27
- 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)))
28
- 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`);
27
+ 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)))
28
+ 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`);
29
29
  if (jwkMatchesOp(entry, normalized, usage), normalized.kty === "oct")
30
30
  return decode(normalized.k);
31
31
  if (!Object.isFrozen(key)) {
@@ -35,7 +35,7 @@ async function prepareKey(entry, key, usage) {
35
35
  } else {
36
36
  if (!isKeyLike(key))
37
37
  throw invalidKeyType(alg, key, secret);
38
- const expectedType = secret ? "secret" : privateKey ? "private" : "public";
38
+ const expectedType = secret ? "secret" : requiresPrivateKey ? "private" : "public";
39
39
  if (key.type !== expectedType && (secret || ["secret", "public", "private"].includes(key.type)))
40
40
  throw new TypeError(`${tag(key)} instances must be of type "${expectedType}" for the ${alg} algorithm`);
41
41
  if (isCryptoKey(key))
@@ -26,32 +26,32 @@ async function deriveKey(p2s, alg, p2c, key) {
26
26
  throw new JWEInvalid("PBES2 Salt Input must be 8 or more octets");
27
27
  if (!Number.isSafeInteger(p2c) || Math.sign(p2c) !== 1)
28
28
  throw new JWEInvalid("PBES2 Count Input must be a positive integer");
29
- const salt = concat(encode(alg), Uint8Array.of(0), p2s), keylen = parseInt(alg.slice(13, 16), 10), subtleAlg = {
29
+ const salt = concat(encode(alg), Uint8Array.of(0), p2s), keyLengthBits = parseInt(alg.slice(13, 16), 10), subtleAlg = {
30
30
  hash: `SHA-${alg.slice(8, 11)}`,
31
31
  iterations: p2c,
32
32
  name: "PBKDF2",
33
33
  salt
34
34
  }, cryptoKey = await rawKey(key, jweAlgorithm(alg).subtle, "deriveBits");
35
- return new Uint8Array(await crypto.subtle.deriveBits(subtleAlg, cryptoKey, keylen));
35
+ return new Uint8Array(await crypto.subtle.deriveBits(subtleAlg, cryptoKey, keyLengthBits));
36
36
  }
37
37
  function lengthAndInput(input) {
38
38
  return concat(uint32be(input.length), input);
39
39
  }
40
- async function concatKdf(Z, L, OtherInfo) {
41
- const dkLen = L >> 3, hashLen = 32, reps = Math.ceil(dkLen / hashLen), dk = new Uint8Array(reps * hashLen);
40
+ async function concatKdf(Z, keyDataLength, OtherInfo) {
41
+ const dkLen = keyDataLength >> 3, hashLen = 32, reps = Math.ceil(dkLen / hashLen), dk = new Uint8Array(reps * hashLen);
42
42
  for (let i = 1; i <= reps; i++) {
43
43
  const hashResult = await digest("sha256", concat(uint32be(i), Z, OtherInfo));
44
44
  dk.set(hashResult, (i - 1) * hashLen);
45
45
  }
46
46
  return dk.slice(0, dkLen);
47
47
  }
48
- async function ecdhesDeriveKey(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(), apv = new Uint8Array()) {
48
+ async function ecdhesDeriveKey(publicKey, privateKey, algorithmId, keyDataLength, apu = new Uint8Array(), apv = new Uint8Array()) {
49
49
  checkEcdhCryptoKey(publicKey), checkEcdhCryptoKey(privateKey, "deriveBits");
50
- const otherInfo = concat(lengthAndInput(encode(algorithm)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyLength)), Z = new Uint8Array(await crypto.subtle.deriveBits({
50
+ const otherInfo = concat(lengthAndInput(encode(algorithmId)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyDataLength)), Z = new Uint8Array(await crypto.subtle.deriveBits({
51
51
  name: publicKey.algorithm.name,
52
52
  public: publicKey
53
53
  }, privateKey, publicKey.algorithm.name === "X25519" ? 256 : Math.ceil(parseInt(publicKey.algorithm.namedCurve.slice(-3), 10) / 8) << 3));
54
- return concatKdf(Z, keyLength, otherInfo);
54
+ return concatKdf(Z, keyDataLength, otherInfo);
55
55
  }
56
56
  function assertEcdhKey(key) {
57
57
  assertCryptoKey(key);
@@ -100,10 +100,10 @@ async function decryptKeyManagement(entry, enc, key, encryptedKey, joseHeader, m
100
100
  assertEcdhKey(key);
101
101
  const ephemeralPublicKey = await jwkToKey(entry, epk), partyUInfo = partyInfo(joseHeader, "apu"), partyVInfo = partyInfo(joseHeader, "apv");
102
102
  checkPartyInfo(partyUInfo, partyVInfo);
103
- const sharedSecret = await ecdhesDeriveKey(ephemeralPublicKey, key, direct ? enc.alg : alg, direct ? enc.cekBits : parseInt(alg.slice(-5, -2), 10), partyUInfo, partyVInfo);
103
+ const derivedKey = await ecdhesDeriveKey(ephemeralPublicKey, key, direct ? enc.alg : alg, direct ? enc.cekBits : parseInt(alg.slice(-5, -2), 10), partyUInfo, partyVInfo);
104
104
  if (direct)
105
- return sharedSecret;
106
- key = sharedSecret;
105
+ return derivedKey;
106
+ key = derivedKey;
107
107
  break;
108
108
  }
109
109
  case "RSA-OAEP":
@@ -153,19 +153,19 @@ async function encryptKeyManagement(entry, enc, inputKey, joseHeader, providedCe
153
153
  providedApu !== void 0 && assertUint8Array(providedApu, '"apu"'), providedApv !== void 0 && assertUint8Array(providedApv, '"apv"');
154
154
  const apu = providedApu ?? partyInfo(joseHeader, "apu"), apv = providedApv ?? partyInfo(joseHeader, "apv");
155
155
  checkPartyInfo(apu, apv);
156
- let ephemeralKey;
157
- providedParameters.epk !== void 0 ? ephemeralKey = await prepareKey(entry, providedParameters.epk, "decrypt") : ephemeralKey = (await crypto.subtle.generateKey(key.algorithm, !0, ["deriveBits"])).privateKey;
156
+ let ephemeralPrivateKey;
157
+ providedParameters.epk !== void 0 ? ephemeralPrivateKey = await prepareKey(entry, providedParameters.epk, "decrypt") : ephemeralPrivateKey = (await crypto.subtle.generateKey(key.algorithm, !0, ["deriveBits"])).privateKey;
158
158
  const subtle = crypto.subtle;
159
- let exportableEpk = ephemeralKey;
159
+ let exportableEpk = ephemeralPrivateKey;
160
160
  if (!exportableEpk.extractable) {
161
161
  if (typeof subtle.getPublicKey != "function")
162
162
  throw new TypeError('CryptoKey for "epk" must be extractable');
163
- exportableEpk = await subtle.getPublicKey(ephemeralKey, []);
163
+ exportableEpk = await subtle.getPublicKey(ephemeralPrivateKey, []);
164
164
  }
165
- 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 };
165
+ 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 };
166
166
  if (kty === "EC" && (epk.y = y), parameters = { epk }, providedApu !== void 0 && (parameters.apu = b64u(providedApu)), providedApv !== void 0 && (parameters.apv = b64u(providedApv)), direct)
167
- return [sharedSecret, void 0, parameters];
168
- key = sharedSecret;
167
+ return [derivedKey, void 0, parameters];
168
+ key = derivedKey;
169
169
  break;
170
170
  }
171
171
  case "RSA-OAEP": {
@@ -32,23 +32,23 @@ function assertNotSet(value, name) {
32
32
  function decodeBase64url(value, label, ErrorClass) {
33
33
  try {
34
34
  return decode(value);
35
- } catch {
36
- throw new ErrorClass(`Failed to base64url decode the ${label}`);
35
+ } catch (cause) {
36
+ throw new ErrorClass(`Failed to base64url decode the ${label}`, { cause });
37
37
  }
38
38
  }
39
- function encodeBase64url(value, label, ErrorClass) {
39
+ function encodeAsciiMember(value, label, ErrorClass) {
40
40
  try {
41
41
  return encode(value);
42
- } catch {
43
- throw new ErrorClass(`The ${label} is not a valid base64url string`);
42
+ } catch (cause) {
43
+ throw new ErrorClass(`The ${label} is not a valid base64url string`, { cause });
44
44
  }
45
45
  }
46
- function parseJoseHeader(b64, ErrorClass, message) {
46
+ function parseJoseHeader(encodedProtectedHeader, ErrorClass, message) {
47
47
  let parsed;
48
48
  try {
49
- parsed = JSON.parse(strictDecoder.decode(decode(b64)));
50
- } catch {
51
- throw new ErrorClass(message);
49
+ parsed = JSON.parse(strictDecoder.decode(decode(encodedProtectedHeader)));
50
+ } catch (cause) {
51
+ throw new ErrorClass(message, { cause });
52
52
  }
53
53
  if (!isObject(parsed))
54
54
  throw new ErrorClass(message);
@@ -109,7 +109,7 @@ export {
109
109
  assertNotSet,
110
110
  assertUint8Array,
111
111
  decodeBase64url,
112
- encodeBase64url,
112
+ encodeAsciiMember,
113
113
  isDisjoint,
114
114
  isJwkSet,
115
115
  isObject,
@@ -5,28 +5,28 @@ import { JWTInvalid } from "./errors.js";
5
5
  function decodeJwt(jwt) {
6
6
  if (typeof jwt != "string")
7
7
  throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");
8
- const { 1: payload, length } = jwt.split(".");
8
+ const { 1: encodedPayload, length } = jwt.split(".");
9
9
  if (length === 5)
10
10
  throw new JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");
11
11
  if (length !== 3)
12
12
  throw new JWTInvalid("Invalid JWT");
13
- if (!payload)
13
+ if (!encodedPayload)
14
14
  throw new JWTInvalid("JWTs must contain a payload");
15
- let decoded;
15
+ let claimsSetBytes;
16
16
  try {
17
- decoded = b64u(payload);
18
- } catch {
19
- throw new JWTInvalid("Failed to base64url decode the payload");
17
+ claimsSetBytes = b64u(encodedPayload);
18
+ } catch (cause) {
19
+ throw new JWTInvalid("Failed to base64url decode the payload", { cause });
20
20
  }
21
- let result;
21
+ let claimsSet;
22
22
  try {
23
- result = JSON.parse(strictDecoder.decode(decoded));
24
- } catch {
25
- throw new JWTInvalid("Failed to parse the decoded payload as JSON");
23
+ claimsSet = JSON.parse(strictDecoder.decode(claimsSetBytes));
24
+ } catch (cause) {
25
+ throw new JWTInvalid("Failed to parse the decoded payload as JSON", { cause });
26
26
  }
27
- if (!isObject(result))
27
+ if (!isObject(claimsSet))
28
28
  throw new JWTInvalid("Invalid JWT Claims Set");
29
- return result;
29
+ return claimsSet;
30
30
  }
31
31
  export {
32
32
  decodeJwt
@@ -1,18 +1,18 @@
1
1
  import { parseJoseHeader } from "../lib/validate.js";
2
2
  function decodeProtectedHeader(token) {
3
- let protectedB64u;
3
+ let encodedProtectedHeader;
4
4
  if (typeof token == "string") {
5
5
  const parts = token.split(".");
6
- (parts.length === 3 || parts.length === 5) && ([protectedB64u] = parts);
6
+ (parts.length === 3 || parts.length === 5) && ([encodedProtectedHeader] = parts);
7
7
  } else if (typeof token == "object" && token)
8
8
  if ("protected" in token)
9
- protectedB64u = token.protected;
9
+ encodedProtectedHeader = token.protected;
10
10
  else
11
11
  throw new TypeError("Token does not contain a Protected Header");
12
12
  const invalid = "Invalid Token or Protected Header formatting";
13
- if (typeof protectedB64u != "string" || !protectedB64u)
13
+ if (typeof encodedProtectedHeader != "string" || !encodedProtectedHeader)
14
14
  throw new TypeError(invalid);
15
- return parseJoseHeader(protectedB64u, TypeError, invalid);
15
+ return parseJoseHeader(encodedProtectedHeader, TypeError, invalid);
16
16
  }
17
17
  export {
18
18
  decodeProtectedHeader
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.12",
3
+ "version": "6.2.13",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",
@@ -70,7 +70,7 @@ The `jose` module supports importing, exporting, and generating keys and secrets
70
70
 
71
71
  ### JSON Web Signature (JWS)
72
72
 
73
- The `jose` module supports signing and verification of JWS messages with arbitrary payloads in Compact, Flattened JSON, and General JSON serialization syntaxes.
73
+ The `jose` module supports digital signature and MAC computation and validation over arbitrary JWS Payloads using the JWS Compact Serialization and the flattened and general JWS JSON Serialization syntaxes ([RFC 7515, Section 7](https://www.rfc-editor.org/info/rfc7515/#section-7)).
74
74
 
75
75
  - Signing - [Compact](docs/jws/compact/sign/classes/CompactSign.md), [Flattened JSON](docs/jws/flattened/sign/classes/FlattenedSign.md), [General JSON](docs/jws/general/sign/classes/GeneralSign.md)
76
76
  - Verification - [Compact](docs/jws/compact/verify/functions/compactVerify.md), [Flattened JSON](docs/jws/flattened/verify/functions/flattenedVerify.md), [General JSON](docs/jws/general/verify/functions/generalVerify.md)
@@ -81,7 +81,7 @@ The `jose` module supports signing and verification of JWS messages with arbitra
81
81
 
82
82
  ### JSON Web Encryption (JWE)
83
83
 
84
- The `jose` module supports encryption and decryption of JWE messages with arbitrary plaintext in Compact, Flattened JSON, and General JSON serialization syntaxes.
84
+ The `jose` module supports encryption and authenticated decryption of arbitrary plaintext using the JWE Compact Serialization and the flattened and general JWE JSON Serialization syntaxes ([RFC 7516, Section 7](https://www.rfc-editor.org/info/rfc7516/#section-7)).
85
85
 
86
86
  - Encryption - [Compact](docs/jwe/compact/encrypt/classes/CompactEncrypt.md), [Flattened JSON](docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md), [General JSON](docs/jwe/general/encrypt/classes/GeneralEncrypt.md)
87
87
  - Decryption - [Compact](docs/jwe/compact/decrypt/functions/compactDecrypt.md), [Flattened JSON](docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md), [General JSON](docs/jwe/general/decrypt/functions/generalDecrypt.md)
@@ -3,21 +3,22 @@ import type * as t from '../../types.d.ts';
3
3
  export interface CompactDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.CompactJWEHeaderParameters, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Decrypts a Compact JWE.
6
+ * Authenticates and decrypts a JWE Compact Serialization.
7
7
  *
8
8
  * @param key Private key or shared secret. See
9
9
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
10
10
  */
11
11
  export declare function compactDecrypt(jwe: string | Uint8Array, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.CompactDecryptResult>;
12
12
  /**
13
- * Decrypts a Compact JWE with a dynamically resolved key, included in the result.
13
+ * Authenticates and decrypts a JWE Compact Serialization with a dynamically resolved key, included
14
+ * in the result.
14
15
  *
15
16
  * @param getKey Resolves a private key or shared secret from unverified token data.
16
17
  */
17
18
  export declare function compactDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: string | Uint8Array, getKey: CompactDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.CompactDecryptResult & t.ResolvedKey<KeyType>>;
18
19
  /**
19
- * Decrypts a Compact JWE with a key or key resolver. The result includes `key` only when a resolver
20
- * is used.
20
+ * Authenticates and decrypts a JWE Compact Serialization with a key or key resolver. The result
21
+ * includes `key` only when a resolver is used.
21
22
  *
22
23
  * @param key Private key or shared secret, or a function resolving one.
23
24
  */
@@ -1,9 +1,9 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Builds and encrypts Compact JWE strings. */
2
+ /** Produces JWE Compact Serialization using authenticated encryption. */
3
3
  export declare class CompactEncrypt {
4
4
  #private;
5
5
  /**
6
- * Creates a Compact JWE encryptor.
6
+ * Creates an encryptor for JWE Compact Serialization.
7
7
  *
8
8
  * @param plaintext Binary representation of the plaintext to encrypt.
9
9
  */
@@ -26,12 +26,12 @@ export declare class CompactEncrypt {
26
26
  setProtectedHeader(protectedHeader: t.CompactJWEHeaderParameters): this;
27
27
  /**
28
28
  * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
29
- * of header setters; the resulting parameters are added to the JOSE header. May only be called
29
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
30
30
  * once.
31
31
  */
32
32
  setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): this;
33
33
  /**
34
- * Encrypts the plaintext as a Compact JWE.
34
+ * Encrypts the plaintext and returns the JWE Compact Serialization.
35
35
  *
36
36
  * @param key Public key or shared secret. See
37
37
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -3,21 +3,22 @@ import type * as t from '../../types.d.ts';
3
3
  export interface FlattenedDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWEHeaderParameters | undefined, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Decrypts a Flattened JWE.
6
+ * Authenticates and decrypts a flattened JWE JSON Serialization.
7
7
  *
8
8
  * @param key Private key or shared secret. See
9
9
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
10
10
  */
11
11
  export declare function flattenedDecrypt(jwe: t.FlattenedJWE, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.FlattenedDecryptResult>;
12
12
  /**
13
- * Decrypts a Flattened JWE with a dynamically resolved key, included in the result.
13
+ * Authenticates and decrypts a flattened JWE JSON Serialization with a dynamically resolved key,
14
+ * included in the result.
14
15
  *
15
16
  * @param getKey Resolves a private key or shared secret from unverified token data.
16
17
  */
17
18
  export declare function flattenedDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: t.FlattenedJWE, getKey: FlattenedDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.FlattenedDecryptResult & t.ResolvedKey<KeyType>>;
18
19
  /**
19
- * Decrypts a Flattened JWE with a key or key resolver. The result includes `key` only when a
20
- * resolver is used.
20
+ * Authenticates and decrypts a flattened JWE JSON Serialization with a key or key resolver. The
21
+ * result includes `key` only when a resolver is used.
21
22
  *
22
23
  * @param key Private key or shared secret, or a function resolving one.
23
24
  */
@@ -1,16 +1,16 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Builds and encrypts Flattened JWE objects. */
2
+ /** Produces flattened JWE JSON Serialization using authenticated encryption. */
3
3
  export declare class FlattenedEncrypt {
4
4
  #private;
5
5
  /**
6
- * Creates a Flattened JWE encryptor.
6
+ * Creates an encryptor for flattened JWE JSON Serialization.
7
7
  *
8
8
  * @param plaintext Binary representation of the plaintext to encrypt.
9
9
  */
10
10
  constructor(plaintext: Uint8Array);
11
11
  /**
12
12
  * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
13
- * of header setters; the resulting parameters are added to the JOSE header. May only be called
13
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
14
14
  * once.
15
15
  */
16
16
  setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): this;
@@ -20,7 +20,7 @@ export declare class FlattenedEncrypt {
20
20
  setSharedUnprotectedHeader(sharedUnprotectedHeader: t.JWEHeaderParameters): this;
21
21
  /** Sets the JWE Per-Recipient Unprotected Header. May only be called once. */
22
22
  setUnprotectedHeader(unprotectedHeader: t.JWEHeaderParameters): this;
23
- /** Sets additional data to authenticate without encrypting it. */
23
+ /** Sets the JWE AAD, which is integrity protected but not encrypted. */
24
24
  setAdditionalAuthenticatedData(aad: Uint8Array): this;
25
25
  /**
26
26
  * Sets a content encryption key instead of generating a random one for the JWE "enc" algorithm.
@@ -37,7 +37,7 @@ export declare class FlattenedEncrypt {
37
37
  */
38
38
  setInitializationVector(iv: Uint8Array): this;
39
39
  /**
40
- * Encrypts the plaintext as a Flattened JWE.
40
+ * Encrypts the plaintext and returns the flattened JWE JSON Serialization.
41
41
  *
42
42
  * @param key Public key or shared secret. See
43
43
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -3,7 +3,7 @@ import type * as t from '../../types.d.ts';
3
3
  export interface GeneralDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWEHeaderParameters | undefined, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Decrypts a General JWE.
6
+ * Authenticates and decrypts a general JWE JSON Serialization.
7
7
  *
8
8
  * > Note: Returns plaintext and headers from the first recipient that decrypts successfully. Other
9
9
  * > recipients may be inspected to enforce serialization rules, but their headers are not included in
@@ -14,14 +14,15 @@ export interface GeneralDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array =
14
14
  */
15
15
  export declare function generalDecrypt(jwe: t.GeneralJWE, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.GeneralDecryptResult>;
16
16
  /**
17
- * Decrypts a General JWE with a dynamically resolved key, included in the result.
17
+ * Authenticates and decrypts a general JWE JSON Serialization with a dynamically resolved key,
18
+ * included in the result.
18
19
  *
19
20
  * @param getKey Resolves a private key or shared secret from unverified token data.
20
21
  */
21
22
  export declare function generalDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: t.GeneralJWE, getKey: GeneralDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.GeneralDecryptResult & t.ResolvedKey<KeyType>>;
22
23
  /**
23
- * Decrypts a General JWE with a key or key resolver. The result includes `key` only when a resolver
24
- * is used.
24
+ * Authenticates and decrypts a general JWE JSON Serialization with a key or key resolver. The
25
+ * result includes `key` only when a resolver is used.
25
26
  *
26
27
  * @param key Private key or shared secret, or a function resolving one.
27
28
  */
@@ -5,7 +5,7 @@ export interface Recipient {
5
5
  setUnprotectedHeader(unprotectedHeader: t.JWEHeaderParameters): Recipient;
6
6
  /**
7
7
  * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
8
- * of header setters; the resulting parameters are added to the JOSE header. May only be called
8
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
9
9
  * once.
10
10
  */
11
11
  setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): Recipient;
@@ -24,11 +24,11 @@ export interface Recipient {
24
24
  /** Returns the enclosing {@link GeneralEncrypt} instance. */
25
25
  done(): GeneralEncrypt;
26
26
  }
27
- /** Builds and encrypts General JWE objects. */
27
+ /** Produces general JWE JSON Serialization using authenticated encryption. */
28
28
  export declare class GeneralEncrypt {
29
29
  #private;
30
30
  /**
31
- * Creates a General JWE encryptor.
31
+ * Creates an encryptor for general JWE JSON Serialization.
32
32
  *
33
33
  * @param plaintext Binary representation of the plaintext to encrypt.
34
34
  */
@@ -44,8 +44,8 @@ export declare class GeneralEncrypt {
44
44
  setProtectedHeader(protectedHeader: t.JWEHeaderParameters): this;
45
45
  /** Sets the JWE Shared Unprotected Header. May only be called once. */
46
46
  setSharedUnprotectedHeader(sharedUnprotectedHeader: t.JWEHeaderParameters): this;
47
- /** Sets additional data to authenticate without encrypting it. */
47
+ /** Sets the JWE AAD, which is integrity protected but not encrypted. */
48
48
  setAdditionalAuthenticatedData(aad: Uint8Array): this;
49
- /** Encrypts the plaintext as a General JWE. */
49
+ /** Encrypts the plaintext and returns the general JWE JSON Serialization. */
50
50
  encrypt(): Promise<t.GeneralJWE>;
51
51
  }
@@ -1,17 +1,18 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Builds and signs Compact JWS strings. */
2
+ /** Produces JWS Compact Serialization using a digital signature or MAC. */
3
3
  export declare class CompactSign {
4
4
  #private;
5
5
  /**
6
- * Creates a Compact JWS signer.
6
+ * Creates a signer for JWS Compact Serialization.
7
7
  *
8
- * @param payload Binary representation of the payload to sign.
8
+ * @param payload JWS Payload bytes to sign or MAC.
9
9
  */
10
10
  constructor(payload: Uint8Array);
11
11
  /** Sets the JWS Protected Header. May only be called once. */
12
12
  setProtectedHeader(protectedHeader: t.CompactJWSHeaderParameters): this;
13
13
  /**
14
- * Signs the payload as a Compact JWS.
14
+ * Computes the JWS Signature (digital signature or MAC) and returns the JWS Compact
15
+ * Serialization.
15
16
  *
16
17
  * @param key Private key or shared secret. See
17
18
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.