jose 5.6.3 → 5.8.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 (48) hide show
  1. package/dist/browser/index.js +1 -1
  2. package/dist/browser/jwe/flattened/encrypt.js +1 -1
  3. package/dist/browser/jwe/general/encrypt.js +2 -1
  4. package/dist/browser/jwks/local.js +1 -1
  5. package/dist/browser/jwks/remote.js +6 -5
  6. package/dist/browser/lib/private_symbols.js +1 -0
  7. package/dist/node/cjs/index.js +2 -1
  8. package/dist/node/cjs/jwe/flattened/encrypt.js +3 -3
  9. package/dist/node/cjs/jwe/general/encrypt.js +2 -1
  10. package/dist/node/cjs/jwks/local.js +1 -2
  11. package/dist/node/cjs/jwks/remote.js +7 -6
  12. package/dist/node/cjs/lib/private_symbols.js +4 -0
  13. package/dist/node/esm/index.js +1 -1
  14. package/dist/node/esm/jwe/flattened/encrypt.js +1 -1
  15. package/dist/node/esm/jwe/general/encrypt.js +2 -1
  16. package/dist/node/esm/jwks/local.js +1 -1
  17. package/dist/node/esm/jwks/remote.js +6 -5
  18. package/dist/node/esm/lib/private_symbols.js +1 -0
  19. package/dist/types/index.d.ts +1 -1
  20. package/dist/types/jwe/compact/decrypt.d.ts +3 -0
  21. package/dist/types/jwe/compact/encrypt.d.ts +3 -0
  22. package/dist/types/jwe/flattened/decrypt.d.ts +3 -0
  23. package/dist/types/jwe/flattened/encrypt.d.ts +3 -2
  24. package/dist/types/jwe/general/decrypt.d.ts +3 -0
  25. package/dist/types/jwe/general/encrypt.d.ts +3 -0
  26. package/dist/types/jwk/embedded.d.ts +3 -0
  27. package/dist/types/jwk/thumbprint.d.ts +6 -0
  28. package/dist/types/jwks/local.d.ts +3 -7
  29. package/dist/types/jwks/remote.d.ts +14 -8
  30. package/dist/types/jws/compact/sign.d.ts +3 -0
  31. package/dist/types/jws/compact/verify.d.ts +3 -0
  32. package/dist/types/jws/flattened/sign.d.ts +3 -0
  33. package/dist/types/jws/flattened/verify.d.ts +3 -0
  34. package/dist/types/jws/general/sign.d.ts +3 -0
  35. package/dist/types/jws/general/verify.d.ts +3 -0
  36. package/dist/types/jwt/decrypt.d.ts +3 -0
  37. package/dist/types/jwt/encrypt.d.ts +3 -0
  38. package/dist/types/jwt/sign.d.ts +3 -0
  39. package/dist/types/jwt/unsecured.d.ts +3 -0
  40. package/dist/types/jwt/verify.d.ts +3 -0
  41. package/dist/types/key/export.d.ts +9 -0
  42. package/dist/types/key/generate_key_pair.d.ts +3 -0
  43. package/dist/types/key/generate_secret.d.ts +3 -0
  44. package/dist/types/key/import.d.ts +12 -0
  45. package/dist/types/types.d.ts +32 -11
  46. package/dist/types/util/decode_jwt.d.ts +3 -0
  47. package/dist/types/util/decode_protected_header.d.ts +3 -0
  48. package/package.json +271 -1
@@ -17,7 +17,7 @@ export { EncryptJWT } from './jwt/encrypt.js';
17
17
  export { calculateJwkThumbprint, calculateJwkThumbprintUri } from './jwk/thumbprint.js';
18
18
  export { EmbeddedJWK } from './jwk/embedded.js';
19
19
  export { createLocalJWKSet } from './jwks/local.js';
20
- export { createRemoteJWKSet, experimental_jwksCache } from './jwks/remote.js';
20
+ export { createRemoteJWKSet, jwksCache, experimental_jwksCache } from './jwks/remote.js';
21
21
  export { UnsecuredJWT } from './jwt/unsecured.js';
22
22
  export { exportPKCS8, exportSPKI, exportJWK } from './key/export.js';
23
23
  export { importSPKI, importPKCS8, importX509, importJWK } from './key/import.js';
@@ -1,11 +1,11 @@
1
1
  import { encode as base64url } from '../../runtime/base64url.js';
2
+ import { unprotected } from '../../lib/private_symbols.js';
2
3
  import encrypt from '../../runtime/encrypt.js';
3
4
  import encryptKeyManagement from '../../lib/encrypt_key_management.js';
4
5
  import { JOSENotSupported, JWEInvalid } from '../../util/errors.js';
5
6
  import isDisjoint from '../../lib/is_disjoint.js';
6
7
  import { encoder, decoder, concat } from '../../lib/buffer_utils.js';
7
8
  import validateCrit from '../../lib/validate_crit.js';
8
- export const unprotected = Symbol();
9
9
  export class FlattenedEncrypt {
10
10
  constructor(plaintext) {
11
11
  if (!(plaintext instanceof Uint8Array)) {
@@ -1,4 +1,5 @@
1
- import { FlattenedEncrypt, unprotected } from '../flattened/encrypt.js';
1
+ import { FlattenedEncrypt } from '../flattened/encrypt.js';
2
+ import { unprotected } from '../../lib/private_symbols.js';
2
3
  import { JOSENotSupported, JWEInvalid } from '../../util/errors.js';
3
4
  import generateCek from '../../lib/cek.js';
4
5
  import isDisjoint from '../../lib/is_disjoint.js';
@@ -29,7 +29,7 @@ function clone(obj) {
29
29
  }
30
30
  return JSON.parse(JSON.stringify(obj));
31
31
  }
32
- export class LocalJWKSet {
32
+ class LocalJWKSet {
33
33
  constructor(jwks) {
34
34
  this._cached = new WeakMap();
35
35
  if (!isJWKSLike(jwks)) {
@@ -10,10 +10,10 @@ function isCloudflareWorkers() {
10
10
  let USER_AGENT;
11
11
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
12
12
  const NAME = 'jose';
13
- const VERSION = 'v5.6.3';
13
+ const VERSION = 'v5.8.0';
14
14
  USER_AGENT = `${NAME}/${VERSION}`;
15
15
  }
16
- export const experimental_jwksCache = Symbol();
16
+ export const jwksCache = Symbol();
17
17
  function isFreshJwksCache(input, cacheMaxAge) {
18
18
  if (typeof input !== 'object' || input === null) {
19
19
  return false;
@@ -41,9 +41,9 @@ class RemoteJWKSet {
41
41
  this._cooldownDuration =
42
42
  typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000;
43
43
  this._cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000;
44
- if (options?.[experimental_jwksCache] !== undefined) {
45
- this._cache = options?.[experimental_jwksCache];
46
- if (isFreshJwksCache(options?.[experimental_jwksCache], this._cacheMaxAge)) {
44
+ if (options?.[jwksCache] !== undefined) {
45
+ this._cache = options?.[jwksCache];
46
+ if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {
47
47
  this._jwksTimestamp = this._cache.uat;
48
48
  this._local = createLocalJWKSet(this._cache.jwks);
49
49
  }
@@ -136,3 +136,4 @@ export function createRemoteJWKSet(url, options) {
136
136
  });
137
137
  return remoteJWKSet;
138
138
  }
139
+ export const experimental_jwksCache = jwksCache;
@@ -0,0 +1 @@
1
+ export const unprotected = Symbol();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cryptoRuntime = exports.base64url = exports.generateSecret = exports.generateKeyPair = exports.errors = exports.decodeJwt = exports.decodeProtectedHeader = exports.importJWK = exports.importX509 = exports.importPKCS8 = exports.importSPKI = exports.exportJWK = exports.exportSPKI = exports.exportPKCS8 = exports.UnsecuredJWT = exports.experimental_jwksCache = exports.createRemoteJWKSet = exports.createLocalJWKSet = exports.EmbeddedJWK = exports.calculateJwkThumbprintUri = exports.calculateJwkThumbprint = exports.EncryptJWT = exports.SignJWT = exports.GeneralSign = exports.FlattenedSign = exports.CompactSign = exports.FlattenedEncrypt = exports.CompactEncrypt = exports.jwtDecrypt = exports.jwtVerify = exports.generalVerify = exports.flattenedVerify = exports.compactVerify = exports.GeneralEncrypt = exports.generalDecrypt = exports.flattenedDecrypt = exports.compactDecrypt = void 0;
3
+ exports.cryptoRuntime = exports.base64url = exports.generateSecret = exports.generateKeyPair = exports.errors = exports.decodeJwt = exports.decodeProtectedHeader = exports.importJWK = exports.importX509 = exports.importPKCS8 = exports.importSPKI = exports.exportJWK = exports.exportSPKI = exports.exportPKCS8 = exports.UnsecuredJWT = exports.experimental_jwksCache = exports.jwksCache = exports.createRemoteJWKSet = exports.createLocalJWKSet = exports.EmbeddedJWK = exports.calculateJwkThumbprintUri = exports.calculateJwkThumbprint = exports.EncryptJWT = exports.SignJWT = exports.GeneralSign = exports.FlattenedSign = exports.CompactSign = exports.FlattenedEncrypt = exports.CompactEncrypt = exports.jwtDecrypt = exports.jwtVerify = exports.generalVerify = exports.flattenedVerify = exports.compactVerify = exports.GeneralEncrypt = exports.generalDecrypt = exports.flattenedDecrypt = exports.compactDecrypt = void 0;
4
4
  var decrypt_js_1 = require("./jwe/compact/decrypt.js");
5
5
  Object.defineProperty(exports, "compactDecrypt", { enumerable: true, get: function () { return decrypt_js_1.compactDecrypt; } });
6
6
  var decrypt_js_2 = require("./jwe/flattened/decrypt.js");
@@ -42,6 +42,7 @@ var local_js_1 = require("./jwks/local.js");
42
42
  Object.defineProperty(exports, "createLocalJWKSet", { enumerable: true, get: function () { return local_js_1.createLocalJWKSet; } });
43
43
  var remote_js_1 = require("./jwks/remote.js");
44
44
  Object.defineProperty(exports, "createRemoteJWKSet", { enumerable: true, get: function () { return remote_js_1.createRemoteJWKSet; } });
45
+ Object.defineProperty(exports, "jwksCache", { enumerable: true, get: function () { return remote_js_1.jwksCache; } });
45
46
  Object.defineProperty(exports, "experimental_jwksCache", { enumerable: true, get: function () { return remote_js_1.experimental_jwksCache; } });
46
47
  var unsecured_js_1 = require("./jwt/unsecured.js");
47
48
  Object.defineProperty(exports, "UnsecuredJWT", { enumerable: true, get: function () { return unsecured_js_1.UnsecuredJWT; } });
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlattenedEncrypt = exports.unprotected = void 0;
3
+ exports.FlattenedEncrypt = void 0;
4
4
  const base64url_js_1 = require("../../runtime/base64url.js");
5
+ const private_symbols_js_1 = require("../../lib/private_symbols.js");
5
6
  const encrypt_js_1 = require("../../runtime/encrypt.js");
6
7
  const encrypt_key_management_js_1 = require("../../lib/encrypt_key_management.js");
7
8
  const errors_js_1 = require("../../util/errors.js");
8
9
  const is_disjoint_js_1 = require("../../lib/is_disjoint.js");
9
10
  const buffer_utils_js_1 = require("../../lib/buffer_utils.js");
10
11
  const validate_crit_js_1 = require("../../lib/validate_crit.js");
11
- exports.unprotected = Symbol();
12
12
  class FlattenedEncrypt {
13
13
  _plaintext;
14
14
  _protectedHeader;
@@ -102,7 +102,7 @@ class FlattenedEncrypt {
102
102
  let parameters;
103
103
  ({ cek, encryptedKey, parameters } = await (0, encrypt_key_management_js_1.default)(alg, enc, key, this._cek, this._keyManagementParameters));
104
104
  if (parameters) {
105
- if (options && exports.unprotected in options) {
105
+ if (options && private_symbols_js_1.unprotected in options) {
106
106
  if (!this._unprotectedHeader) {
107
107
  this.setUnprotectedHeader(parameters);
108
108
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GeneralEncrypt = void 0;
4
4
  const encrypt_js_1 = require("../flattened/encrypt.js");
5
+ const private_symbols_js_1 = require("../../lib/private_symbols.js");
5
6
  const errors_js_1 = require("../../util/errors.js");
6
7
  const cek_js_1 = require("../../lib/cek.js");
7
8
  const is_disjoint_js_1 = require("../../lib/is_disjoint.js");
@@ -156,7 +157,7 @@ class GeneralEncrypt {
156
157
  .setKeyManagementParameters({ p2c })
157
158
  .encrypt(recipient.key, {
158
159
  ...recipient.options,
159
- [encrypt_js_1.unprotected]: true,
160
+ [private_symbols_js_1.unprotected]: true,
160
161
  });
161
162
  jwe.ciphertext = flattened.ciphertext;
162
163
  jwe.iv = flattened.iv;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLocalJWKSet = exports.LocalJWKSet = void 0;
3
+ exports.createLocalJWKSet = void 0;
4
4
  const import_js_1 = require("../key/import.js");
5
5
  const errors_js_1 = require("../util/errors.js");
6
6
  const is_object_js_1 = require("../lib/is_object.js");
@@ -99,7 +99,6 @@ class LocalJWKSet {
99
99
  return importWithAlgCache(this._cached, jwk, alg);
100
100
  }
101
101
  }
102
- exports.LocalJWKSet = LocalJWKSet;
103
102
  async function importWithAlgCache(cache, jwk, alg) {
104
103
  const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
105
104
  if (cached[alg] === undefined) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRemoteJWKSet = exports.experimental_jwksCache = void 0;
3
+ exports.experimental_jwksCache = exports.createRemoteJWKSet = exports.jwksCache = void 0;
4
4
  const fetch_jwks_js_1 = require("../runtime/fetch_jwks.js");
5
5
  const errors_js_1 = require("../util/errors.js");
6
6
  const local_js_1 = require("./local.js");
@@ -13,10 +13,10 @@ function isCloudflareWorkers() {
13
13
  let USER_AGENT;
14
14
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
15
15
  const NAME = 'jose';
16
- const VERSION = 'v5.6.3';
16
+ const VERSION = 'v5.8.0';
17
17
  USER_AGENT = `${NAME}/${VERSION}`;
18
18
  }
19
- exports.experimental_jwksCache = Symbol();
19
+ exports.jwksCache = Symbol();
20
20
  function isFreshJwksCache(input, cacheMaxAge) {
21
21
  if (typeof input !== 'object' || input === null) {
22
22
  return false;
@@ -53,9 +53,9 @@ class RemoteJWKSet {
53
53
  this._cooldownDuration =
54
54
  typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000;
55
55
  this._cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000;
56
- if (options?.[exports.experimental_jwksCache] !== undefined) {
57
- this._cache = options?.[exports.experimental_jwksCache];
58
- if (isFreshJwksCache(options?.[exports.experimental_jwksCache], this._cacheMaxAge)) {
56
+ if (options?.[exports.jwksCache] !== undefined) {
57
+ this._cache = options?.[exports.jwksCache];
58
+ if (isFreshJwksCache(options?.[exports.jwksCache], this._cacheMaxAge)) {
59
59
  this._jwksTimestamp = this._cache.uat;
60
60
  this._local = (0, local_js_1.createLocalJWKSet)(this._cache.jwks);
61
61
  }
@@ -149,3 +149,4 @@ function createRemoteJWKSet(url, options) {
149
149
  return remoteJWKSet;
150
150
  }
151
151
  exports.createRemoteJWKSet = createRemoteJWKSet;
152
+ exports.experimental_jwksCache = exports.jwksCache;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unprotected = void 0;
4
+ exports.unprotected = Symbol();
@@ -17,7 +17,7 @@ export { EncryptJWT } from './jwt/encrypt.js';
17
17
  export { calculateJwkThumbprint, calculateJwkThumbprintUri } from './jwk/thumbprint.js';
18
18
  export { EmbeddedJWK } from './jwk/embedded.js';
19
19
  export { createLocalJWKSet } from './jwks/local.js';
20
- export { createRemoteJWKSet, experimental_jwksCache } from './jwks/remote.js';
20
+ export { createRemoteJWKSet, jwksCache, experimental_jwksCache } from './jwks/remote.js';
21
21
  export { UnsecuredJWT } from './jwt/unsecured.js';
22
22
  export { exportPKCS8, exportSPKI, exportJWK } from './key/export.js';
23
23
  export { importSPKI, importPKCS8, importX509, importJWK } from './key/import.js';
@@ -1,11 +1,11 @@
1
1
  import { encode as base64url } from '../../runtime/base64url.js';
2
+ import { unprotected } from '../../lib/private_symbols.js';
2
3
  import encrypt from '../../runtime/encrypt.js';
3
4
  import encryptKeyManagement from '../../lib/encrypt_key_management.js';
4
5
  import { JOSENotSupported, JWEInvalid } from '../../util/errors.js';
5
6
  import isDisjoint from '../../lib/is_disjoint.js';
6
7
  import { encoder, decoder, concat } from '../../lib/buffer_utils.js';
7
8
  import validateCrit from '../../lib/validate_crit.js';
8
- export const unprotected = Symbol();
9
9
  export class FlattenedEncrypt {
10
10
  _plaintext;
11
11
  _protectedHeader;
@@ -1,4 +1,5 @@
1
- import { FlattenedEncrypt, unprotected } from '../flattened/encrypt.js';
1
+ import { FlattenedEncrypt } from '../flattened/encrypt.js';
2
+ import { unprotected } from '../../lib/private_symbols.js';
2
3
  import { JOSENotSupported, JWEInvalid } from '../../util/errors.js';
3
4
  import generateCek from '../../lib/cek.js';
4
5
  import isDisjoint from '../../lib/is_disjoint.js';
@@ -29,7 +29,7 @@ function clone(obj) {
29
29
  }
30
30
  return JSON.parse(JSON.stringify(obj));
31
31
  }
32
- export class LocalJWKSet {
32
+ class LocalJWKSet {
33
33
  _jwks;
34
34
  _cached = new WeakMap();
35
35
  constructor(jwks) {
@@ -10,10 +10,10 @@ function isCloudflareWorkers() {
10
10
  let USER_AGENT;
11
11
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
12
12
  const NAME = 'jose';
13
- const VERSION = 'v5.6.3';
13
+ const VERSION = 'v5.8.0';
14
14
  USER_AGENT = `${NAME}/${VERSION}`;
15
15
  }
16
- export const experimental_jwksCache = Symbol();
16
+ export const jwksCache = Symbol();
17
17
  function isFreshJwksCache(input, cacheMaxAge) {
18
18
  if (typeof input !== 'object' || input === null) {
19
19
  return false;
@@ -50,9 +50,9 @@ class RemoteJWKSet {
50
50
  this._cooldownDuration =
51
51
  typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000;
52
52
  this._cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000;
53
- if (options?.[experimental_jwksCache] !== undefined) {
54
- this._cache = options?.[experimental_jwksCache];
55
- if (isFreshJwksCache(options?.[experimental_jwksCache], this._cacheMaxAge)) {
53
+ if (options?.[jwksCache] !== undefined) {
54
+ this._cache = options?.[jwksCache];
55
+ if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {
56
56
  this._jwksTimestamp = this._cache.uat;
57
57
  this._local = createLocalJWKSet(this._cache.jwks);
58
58
  }
@@ -145,3 +145,4 @@ export function createRemoteJWKSet(url, options) {
145
145
  });
146
146
  return remoteJWKSet;
147
147
  }
148
+ export const experimental_jwksCache = jwksCache;
@@ -0,0 +1 @@
1
+ export const unprotected = Symbol();
@@ -28,7 +28,7 @@ export { EncryptJWT } from './jwt/encrypt';
28
28
  export { calculateJwkThumbprint, calculateJwkThumbprintUri } from './jwk/thumbprint';
29
29
  export { EmbeddedJWK } from './jwk/embedded';
30
30
  export { createLocalJWKSet } from './jwks/local';
31
- export { createRemoteJWKSet, experimental_jwksCache } from './jwks/remote';
31
+ export { createRemoteJWKSet, jwksCache, experimental_jwksCache } from './jwks/remote';
32
32
  export type { RemoteJWKSetOptions, JWKSCacheInput, ExportedJWKSCache } from './jwks/remote';
33
33
  export { UnsecuredJWT } from './jwt/unsecured';
34
34
  export type { UnsecuredResult } from './jwt/unsecured';
@@ -8,6 +8,9 @@ export interface CompactDecryptGetKey extends GetKeyFunction<CompactJWEHeaderPar
8
8
  /**
9
9
  * Decrypts a Compact JWE.
10
10
  *
11
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
12
+ * as from its subpath export `'jose/jwe/compact/decrypt'`.
13
+ *
11
14
  * @param jwe Compact JWE.
12
15
  * @param key Private Key or Secret to decrypt the JWE with. See
13
16
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -2,6 +2,9 @@ import type { KeyLike, JWEKeyManagementHeaderParameters, CompactJWEHeaderParamet
2
2
  /**
3
3
  * The CompactEncrypt class is used to build and encrypt Compact JWE strings.
4
4
  *
5
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
6
+ * from its subpath export `'jose/jwe/compact/encrypt'`.
7
+ *
5
8
  */
6
9
  export declare class CompactEncrypt {
7
10
  private _flattened;
@@ -8,6 +8,9 @@ export interface FlattenedDecryptGetKey extends GetKeyFunction<JWEHeaderParamete
8
8
  /**
9
9
  * Decrypts a Flattened JWE.
10
10
  *
11
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
12
+ * as from its subpath export `'jose/jwe/flattened/decrypt'`.
13
+ *
11
14
  * @param jwe Flattened JWE.
12
15
  * @param key Private Key or Secret to decrypt the JWE with. See
13
16
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -1,9 +1,10 @@
1
1
  import type { KeyLike, FlattenedJWE, JWEHeaderParameters, JWEKeyManagementHeaderParameters, EncryptOptions } from '../../types';
2
- /** @private */
3
- export declare const unprotected: unique symbol;
4
2
  /**
5
3
  * The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects.
6
4
  *
5
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
6
+ * from its subpath export `'jose/jwe/flattened/encrypt'`.
7
+ *
7
8
  */
8
9
  export declare class FlattenedEncrypt {
9
10
  private _plaintext;
@@ -8,6 +8,9 @@ export interface GeneralDecryptGetKey extends GetKeyFunction<JWEHeaderParameters
8
8
  /**
9
9
  * Decrypts a General JWE.
10
10
  *
11
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
12
+ * as from its subpath export `'jose/jwe/general/decrypt'`.
13
+ *
11
14
  * @param jwe General JWE.
12
15
  * @param key Private Key or Secret to decrypt the JWE with. See
13
16
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -16,6 +16,9 @@ export interface Recipient {
16
16
  /**
17
17
  * The GeneralEncrypt class is used to build and encrypt General JWE objects.
18
18
  *
19
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
20
+ * from its subpath export `'jose/jwe/general/encrypt'`.
21
+ *
19
22
  */
20
23
  export declare class GeneralEncrypt {
21
24
  private _plaintext;
@@ -5,5 +5,8 @@ import type { KeyLike, FlattenedJWSInput, JWSHeaderParameters } from '../types';
5
5
  * token's "jwk" (JSON Web Key) Header Parameter. It is recommended to combine this with the verify
6
6
  * function's `algorithms` option to define accepted JWS "alg" (Algorithm) Header Parameter values.
7
7
  *
8
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
9
+ * as from its subpath export `'jose/jwk/embedded'`.
10
+ *
8
11
  */
9
12
  export declare function EmbeddedJWK<KeyLikeType extends KeyLike = KeyLike>(protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput): Promise<KeyLikeType>;
@@ -2,6 +2,9 @@ import type { JWK } from '../types';
2
2
  /**
3
3
  * Calculates a base64url-encoded JSON Web Key (JWK) Thumbprint
4
4
  *
5
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
6
+ * as from its subpath export `'jose/jwk/thumbprint'`.
7
+ *
5
8
  * @param jwk JSON Web Key.
6
9
  * @param digestAlgorithm Digest Algorithm to use for calculating the thumbprint. Default is
7
10
  * "sha256".
@@ -12,6 +15,9 @@ export declare function calculateJwkThumbprint(jwk: JWK, digestAlgorithm?: 'sha2
12
15
  /**
13
16
  * Calculates a JSON Web Key (JWK) Thumbprint URI
14
17
  *
18
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
19
+ * as from its subpath export `'jose/jwk/thumbprint'`.
20
+ *
15
21
  * @param jwk JSON Web Key.
16
22
  * @param digestAlgorithm Digest Algorithm to use for calculating the thumbprint. Default is
17
23
  * "sha256".
@@ -1,11 +1,4 @@
1
1
  import type { KeyLike, JWSHeaderParameters, JSONWebKeySet, FlattenedJWSInput } from '../types';
2
- /** @private */
3
- export declare class LocalJWKSet<KeyLikeType extends KeyLike = KeyLike> {
4
- private _jwks?;
5
- private _cached;
6
- constructor(jwks: unknown);
7
- getKey(protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput): Promise<KeyLikeType>;
8
- }
9
2
  /**
10
3
  * Returns a function that resolves a JWS JOSE Header to a public key object from a locally stored,
11
4
  * or otherwise available, JSON Web Key Set.
@@ -22,6 +15,9 @@ export declare class LocalJWKSet<KeyLikeType extends KeyLike = KeyLike> {
22
15
  * Note: The function's purpose is to resolve public keys used for verifying signatures and will not
23
16
  * work for public encryption keys.
24
17
  *
18
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
19
+ * as from its subpath export `'jose/jwks/local'`.
20
+ *
25
21
  * @param jwks JSON Web Key Set formatted object.
26
22
  */
27
23
  export declare function createLocalJWKSet<KeyLikeType extends KeyLike = KeyLike>(jwks: JSONWebKeySet): (protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput) => Promise<KeyLikeType>;
@@ -1,8 +1,5 @@
1
1
  import type { KeyLike, JWSHeaderParameters, FlattenedJWSInput, JSONWebKeySet } from '../types';
2
2
  /**
3
- * This is an experimental feature, it is not subject to semantic versioning rules. Non-backward
4
- * compatible changes or removal may occur in any future release.
5
- *
6
3
  * DANGER ZONE - This option has security implications that must be understood, assessed for
7
4
  * applicability, and accepted before use. It is critical that the JSON Web Key Set cache only be
8
5
  * writable by your own code.
@@ -25,7 +22,7 @@ import type { KeyLike, JWSHeaderParameters, FlattenedJWSInput, JSONWebKeySet } f
25
22
  * previously cached object from a low-latency key-value store offered by the cloud computing
26
23
  * runtime it is executed on;
27
24
  * - Default to an empty object `{}` instead when there's no previously cached value;
28
- * - Pass it in as {@link RemoteJWKSetOptions[experimental_jwksCache]};
25
+ * - Pass it in as {@link RemoteJWKSetOptions[jwksCache]};
29
26
  * - Afterwards, update the key-value storage if the {@link ExportedJWKSCache.uat `uat`} property of
30
27
  * the object has changed.
31
28
  *
@@ -40,7 +37,7 @@ import type { KeyLike, JWSHeaderParameters, FlattenedJWSInput, JSONWebKeySet } f
40
37
  * const { uat } = jwksCache
41
38
  *
42
39
  * const JWKS = jose.createRemoteJWKSet(url, {
43
- * [jose.experimental_jwksCache]: jwksCache,
40
+ * [jose.jwksCache]: jwksCache,
44
41
  * })
45
42
  *
46
43
  * // Use JSON Web Key Set cache
@@ -52,7 +49,7 @@ import type { KeyLike, JWSHeaderParameters, FlattenedJWSInput, JSONWebKeySet } f
52
49
  * }
53
50
  * ```
54
51
  */
55
- export declare const experimental_jwksCache: unique symbol;
52
+ export declare const jwksCache: unique symbol;
56
53
  /** Options for the remote JSON Web Key Set. */
57
54
  export interface RemoteJWKSetOptions {
58
55
  /**
@@ -85,8 +82,8 @@ export interface RemoteJWKSetOptions {
85
82
  * configuration would cause an unnecessary CORS preflight request.
86
83
  */
87
84
  headers?: Record<string, string>;
88
- /** See {@link experimental_jwksCache}. */
89
- [experimental_jwksCache]?: JWKSCacheInput;
85
+ /** See {@link jwksCache}. */
86
+ [jwksCache]?: JWKSCacheInput;
90
87
  }
91
88
  export interface ExportedJWKSCache {
92
89
  jwks: JSONWebKeySet;
@@ -111,6 +108,9 @@ export type JWKSCacheInput = ExportedJWKSCache | Record<string, never>;
111
108
  * Note: The function's purpose is to resolve public keys used for verifying signatures and will not
112
109
  * work for public encryption keys.
113
110
  *
111
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
112
+ * as from its subpath export `'jose/jwks/remote'`.
113
+ *
114
114
  * @param url URL to fetch the JSON Web Key Set from.
115
115
  * @param options Options for the remote JSON Web Key Set.
116
116
  */
@@ -127,3 +127,9 @@ export declare function createRemoteJWKSet<KeyLikeType extends KeyLike = KeyLike
127
127
  /** @ignore */
128
128
  jwks: () => JSONWebKeySet | undefined;
129
129
  };
130
+ /**
131
+ * @ignore
132
+ *
133
+ * @deprecated Use {@link jwksCache}.
134
+ */
135
+ export declare const experimental_jwksCache: symbol;
@@ -2,6 +2,9 @@ import type { CompactJWSHeaderParameters, KeyLike, SignOptions } from '../../typ
2
2
  /**
3
3
  * The CompactSign class is used to build and sign Compact JWS strings.
4
4
  *
5
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
6
+ * from its subpath export `'jose/jws/compact/sign'`.
7
+ *
5
8
  */
6
9
  export declare class CompactSign {
7
10
  private _flattened;
@@ -10,6 +10,9 @@ export interface CompactVerifyGetKey extends GetKeyFunction<CompactJWSHeaderPara
10
10
  /**
11
11
  * Verifies the signature and format of and afterwards decodes the Compact JWS.
12
12
  *
13
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
14
+ * as from its subpath export `'jose/jws/compact/verify'`.
15
+ *
13
16
  * @param jws Compact JWS.
14
17
  * @param key Key to verify the JWS with. See
15
18
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
@@ -2,6 +2,9 @@ import type { KeyLike, FlattenedJWS, JWSHeaderParameters, SignOptions } from '..
2
2
  /**
3
3
  * The FlattenedSign class is used to build and sign Flattened JWS objects.
4
4
  *
5
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
6
+ * from its subpath export `'jose/jws/flattened/sign'`.
7
+ *
5
8
  */
6
9
  export declare class FlattenedSign {
7
10
  private _payload;
@@ -10,6 +10,9 @@ export interface FlattenedVerifyGetKey extends GetKeyFunction<JWSHeaderParameter
10
10
  /**
11
11
  * Verifies the signature and format of and afterwards decodes the Flattened JWS.
12
12
  *
13
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
14
+ * as from its subpath export `'jose/jws/flattened/verify'`.
15
+ *
13
16
  * @param jws Flattened JWS.
14
17
  * @param key Key to verify the JWS with. See
15
18
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
@@ -22,6 +22,9 @@ export interface Signature {
22
22
  /**
23
23
  * The GeneralSign class is used to build and sign General JWS objects.
24
24
  *
25
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
26
+ * from its subpath export `'jose/jws/general/sign'`.
27
+ *
25
28
  */
26
29
  export declare class GeneralSign {
27
30
  private _payload;
@@ -10,6 +10,9 @@ export interface GeneralVerifyGetKey extends GetKeyFunction<JWSHeaderParameters,
10
10
  /**
11
11
  * Verifies the signature and format of and afterwards decodes the General JWS.
12
12
  *
13
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
14
+ * as from its subpath export `'jose/jws/general/verify'`.
15
+ *
13
16
  * @param jws General JWS.
14
17
  * @param key Key to verify the JWS with. See
15
18
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
@@ -12,6 +12,9 @@ export interface JWTDecryptGetKey extends GetKeyFunction<CompactJWEHeaderParamet
12
12
  * Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, validates the JWT
13
13
  * Claims Set.
14
14
  *
15
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
16
+ * as from its subpath export `'jose/jwt/decrypt'`.
17
+ *
15
18
  * @param jwt JSON Web Token value (encoded as JWE).
16
19
  * @param key Private Key or Secret to decrypt and verify the JWT with. See
17
20
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -3,6 +3,9 @@ import { ProduceJWT } from './produce';
3
3
  /**
4
4
  * The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens.
5
5
  *
6
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
7
+ * from its subpath export `'jose/jwt/encrypt'`.
8
+ *
6
9
  */
7
10
  export declare class EncryptJWT extends ProduceJWT {
8
11
  private _cek;
@@ -3,6 +3,9 @@ import { ProduceJWT } from './produce';
3
3
  /**
4
4
  * The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens.
5
5
  *
6
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
7
+ * from its subpath export `'jose/jwt/sign'`.
8
+ *
6
9
  */
7
10
  export declare class SignJWT extends ProduceJWT {
8
11
  private _protectedHeader;
@@ -7,6 +7,9 @@ export interface UnsecuredResult<PayloadType = JWTPayload> {
7
7
  /**
8
8
  * The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs.
9
9
  *
10
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
11
+ * from its subpath export `'jose/jwt/unsecured'`.
12
+ *
10
13
  */
11
14
  export declare class UnsecuredJWT extends ProduceJWT {
12
15
  /** Encodes the Unsecured JWT. */
@@ -14,6 +14,9 @@ export interface JWTVerifyGetKey extends GetKeyFunction<JWTHeaderParameters, Fla
14
14
  * Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature, validates the
15
15
  * JWT Claims Set.
16
16
  *
17
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
18
+ * as from its subpath export `'jose/jwt/verify'`.
19
+ *
17
20
  * @param jwt JSON Web Token value (encoded as JWS).
18
21
  * @param key Key to verify the JWT with. See
19
22
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
@@ -3,6 +3,9 @@ import type { JWK, KeyLike } from '../types';
3
3
  * Exports a runtime-specific public key representation (KeyObject or CryptoKey) to a PEM-encoded
4
4
  * SPKI string format.
5
5
  *
6
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
7
+ * as from its subpath export `'jose/key/export'`.
8
+ *
6
9
  * @param key Key representation to transform to a PEM-encoded SPKI string format.
7
10
  */
8
11
  export declare function exportSPKI(key: KeyLike): Promise<string>;
@@ -10,12 +13,18 @@ export declare function exportSPKI(key: KeyLike): Promise<string>;
10
13
  * Exports a runtime-specific private key representation (KeyObject or CryptoKey) to a PEM-encoded
11
14
  * PKCS8 string format.
12
15
  *
16
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
17
+ * as from its subpath export `'jose/key/export'`.
18
+ *
13
19
  * @param key Key representation to transform to a PEM-encoded PKCS8 string format.
14
20
  */
15
21
  export declare function exportPKCS8(key: KeyLike): Promise<string>;
16
22
  /**
17
23
  * Exports a runtime-specific key representation (KeyLike) to a JWK.
18
24
  *
25
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
26
+ * as from its subpath export `'jose/key/export'`.
27
+ *
19
28
  * @param key Key representation to export as JWK.
20
29
  */
21
30
  export declare function exportJWK(key: KeyLike | Uint8Array): Promise<JWK>;
@@ -32,6 +32,9 @@ export interface GenerateKeyPairOptions {
32
32
  * `false` by default. See {@link GenerateKeyPairOptions.extractable} to generate an extractable
33
33
  * `privateKey`.
34
34
  *
35
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
36
+ * as from its subpath export `'jose/generate/keypair'`.
37
+ *
35
38
  * @param alg JWA Algorithm Identifier to be used with the generated key pair.
36
39
  * @param options Additional options passed down to the key pair generation.
37
40
  */
@@ -13,6 +13,9 @@ export interface GenerateSecretOptions {
13
13
  * Note: Under Web Crypto API runtime the secret key is generated with `extractable` set to `false`
14
14
  * by default.
15
15
  *
16
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
17
+ * as from its subpath export `'jose/generate/secret'`.
18
+ *
16
19
  * @param alg JWA Algorithm Identifier to be used with the generated secret.
17
20
  * @param options Additional options passed down to the secret generation.
18
21
  */
@@ -15,6 +15,9 @@ export interface PEMImportOptions {
15
15
  * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
16
16
  * (1.2.840.113549.1.1.1) instead for all RSA algorithms.
17
17
  *
18
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
19
+ * as from its subpath export `'jose/key/import'`.
20
+ *
18
21
  * @param spki PEM-encoded SPKI string
19
22
  * @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used
20
23
  * with the imported key, its presence is only enforced in Web Crypto API runtimes. See
@@ -29,6 +32,9 @@ export declare function importSPKI<KeyLikeType extends KeyLike = KeyLike>(spki:
29
32
  * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
30
33
  * (1.2.840.113549.1.1.1) instead for all RSA algorithms.
31
34
  *
35
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
36
+ * as from its subpath export `'jose/key/import'`.
37
+ *
32
38
  * @param x509 X.509 certificate string
33
39
  * @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used
34
40
  * with the imported key, its presence is only enforced in Web Crypto API runtimes. See
@@ -43,6 +49,9 @@ export declare function importX509<KeyLikeType extends KeyLike = KeyLike>(x509:
43
49
  * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
44
50
  * (1.2.840.113549.1.1.1) instead for all RSA algorithms.
45
51
  *
52
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
53
+ * as from its subpath export `'jose/key/import'`.
54
+ *
46
55
  * @param pkcs8 PEM-encoded PKCS#8 string
47
56
  * @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used
48
57
  * with the imported key, its presence is only enforced in Web Crypto API runtimes. See
@@ -56,6 +65,9 @@ export declare function importPKCS8<KeyLikeType extends KeyLike = KeyLike>(pkcs8
56
65
  * Note: When the runtime is using {@link https://w3c.github.io/webcrypto/ Web Cryptography API} the
57
66
  * jwk parameters "use", "key_ops", and "ext" are also used in the resulting `CryptoKey`.
58
67
  *
68
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
69
+ * as from its subpath export `'jose/key/import'`.
70
+ *
59
71
  * @param jwk JSON Web Key.
60
72
  * @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used
61
73
  * with the imported key. Default is the "alg" property on the JWK, its presence is only enforced
@@ -370,7 +370,11 @@ export interface EncryptOptions extends CritOption {}
370
370
 
371
371
  /** JWT Claims Set verification options. */
372
372
  export interface JWTClaimVerificationOptions {
373
- /** Expected JWT "aud" (Audience) Claim value(s). */
373
+ /**
374
+ * Expected JWT "aud" (Audience) Claim value(s).
375
+ *
376
+ * This option makes the JWT "aud" (Audience) Claim presence required.
377
+ */
374
378
  audience?: string | string[]
375
379
 
376
380
  /**
@@ -381,7 +385,11 @@ export interface JWTClaimVerificationOptions {
381
385
  */
382
386
  clockTolerance?: string | number
383
387
 
384
- /** Expected JWT "iss" (Issuer) Claim value(s). */
388
+ /**
389
+ * Expected JWT "iss" (Issuer) Claim value(s).
390
+ *
391
+ * This option makes the JWT "iss" (Issuer) Claim presence required.
392
+ */
385
393
  issuer?: string | string[]
386
394
 
387
395
  /**
@@ -389,13 +397,23 @@ export interface JWTClaimVerificationOptions {
389
397
  *
390
398
  * - In seconds when number (e.g. 5)
391
399
  * - Parsed as seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
400
+ *
401
+ * This option makes the JWT "iat" (Issued At) Claim presence required.
392
402
  */
393
403
  maxTokenAge?: string | number
394
404
 
395
- /** Expected JWT "sub" (Subject) Claim value. */
405
+ /**
406
+ * Expected JWT "sub" (Subject) Claim value.
407
+ *
408
+ * This option makes the JWT "sub" (Subject) Claim presence required.
409
+ */
396
410
  subject?: string
397
411
 
398
- /** Expected JWT "typ" (Type) Header Parameter value. */
412
+ /**
413
+ * Expected JWT "typ" (Type) Header Parameter value.
414
+ *
415
+ * This option makes the JWT "typ" (Type) Header Parameter presence required.
416
+ */
399
417
  typ?: string
400
418
 
401
419
  /** Date to use when comparing NumericDate claims, defaults to `new Date()`. */
@@ -403,11 +421,13 @@ export interface JWTClaimVerificationOptions {
403
421
 
404
422
  /**
405
423
  * Array of required Claim Names that must be present in the JWT Claims Set. Default is that: if
406
- * the {@link JWTClaimVerificationOptions.issuer issuer option} is set, then "iss" must be present;
407
- * if the {@link JWTClaimVerificationOptions.audience audience option} is set, then "aud" must be
408
- * present; if the {@link JWTClaimVerificationOptions.subject subject option} is set, then "sub"
409
- * must be present; if the {@link JWTClaimVerificationOptions.maxTokenAge maxTokenAge option} is
410
- * set, then "iat" must be present.
424
+ * the {@link JWTClaimVerificationOptions.issuer `issuer` option} is set, then JWT "iss" (Issuer)
425
+ * Claim must be present; if the {@link JWTClaimVerificationOptions.audience `audience` option} is
426
+ * set, then JWT "aud" (Audience) Claim must be present; if the
427
+ * {@link JWTClaimVerificationOptions.subject `subject` option} is set, then JWT "sub" (Subject)
428
+ * Claim must be present; if the
429
+ * {@link JWTClaimVerificationOptions.maxTokenAge `maxTokenAge` option} is set, then JWT "iat"
430
+ * (Issued At) Claim must be present.
411
431
  */
412
432
  requiredClaims?: string[]
413
433
  }
@@ -416,8 +436,9 @@ export interface JWTClaimVerificationOptions {
416
436
  export interface VerifyOptions extends CritOption {
417
437
  /**
418
438
  * A list of accepted JWS "alg" (Algorithm) Header Parameter values. By default all "alg"
419
- * (Algorithm) values applicable for the used key/secret are allowed. Note: "none" is never
420
- * accepted.
439
+ * (Algorithm) values applicable for the used key/secret are allowed.
440
+ *
441
+ * Note: Unsecured JWTs (`{ "alg": "none" }`) are never accepted by this API.
421
442
  */
422
443
  algorithms?: string[]
423
444
  }
@@ -5,6 +5,9 @@ import type { JWTPayload } from '../types';
5
5
  * and JWS signature verification use `jose.jwtVerify()`. For an encrypted JWT Claims Set validation
6
6
  * and JWE decryption use `jose.jwtDecrypt()`.
7
7
  *
8
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
9
+ * as from its subpath export `'jose/jwt/decode'`.
10
+ *
8
11
  * @param jwt JWT token in compact JWS serialization.
9
12
  */
10
13
  export declare function decodeJwt<PayloadType = JWTPayload>(jwt: string): PayloadType & JWTPayload;
@@ -3,6 +3,9 @@ export type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderParameter
3
3
  /**
4
4
  * Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization.
5
5
  *
6
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
7
+ * as from its subpath export `'jose/decode/protected_header'`.
8
+ *
6
9
  * @param token JWE/JWS/JWT token in any JOSE serialization.
7
10
  */
8
11
  export declare function decodeProtectedHeader(token: string | object): ProtectedHeaderParameters;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "5.6.3",
3
+ "version": "5.8.0",
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
  "browser",
@@ -70,6 +70,276 @@
70
70
  "import": "./dist/node/esm/index.js",
71
71
  "require": "./dist/node/cjs/index.js"
72
72
  },
73
+ "./jwk/embedded": {
74
+ "types": "./dist/types/jwk/embedded.d.ts",
75
+ "bun": "./dist/browser/jwk/embedded.js",
76
+ "deno": "./dist/browser/jwk/embedded.js",
77
+ "browser": "./dist/browser/jwk/embedded.js",
78
+ "worker": "./dist/browser/jwk/embedded.js",
79
+ "workerd": "./dist/browser/jwk/embedded.js",
80
+ "import": "./dist/node/esm/jwk/embedded.js",
81
+ "require": "./dist/node/cjs/jwk/embedded.js"
82
+ },
83
+ "./jwk/thumbprint": {
84
+ "types": "./dist/types/jwk/thumbprint.d.ts",
85
+ "bun": "./dist/browser/jwk/thumbprint.js",
86
+ "deno": "./dist/browser/jwk/thumbprint.js",
87
+ "browser": "./dist/browser/jwk/thumbprint.js",
88
+ "worker": "./dist/browser/jwk/thumbprint.js",
89
+ "workerd": "./dist/browser/jwk/thumbprint.js",
90
+ "import": "./dist/node/esm/jwk/thumbprint.js",
91
+ "require": "./dist/node/cjs/jwk/thumbprint.js"
92
+ },
93
+ "./key/import": {
94
+ "types": "./dist/types/key/import.d.ts",
95
+ "bun": "./dist/browser/key/import.js",
96
+ "deno": "./dist/browser/key/import.js",
97
+ "browser": "./dist/browser/key/import.js",
98
+ "worker": "./dist/browser/key/import.js",
99
+ "workerd": "./dist/browser/key/import.js",
100
+ "import": "./dist/node/esm/key/import.js",
101
+ "require": "./dist/node/cjs/key/import.js"
102
+ },
103
+ "./key/export": {
104
+ "types": "./dist/types/key/export.d.ts",
105
+ "bun": "./dist/browser/key/export.js",
106
+ "deno": "./dist/browser/key/export.js",
107
+ "browser": "./dist/browser/key/export.js",
108
+ "worker": "./dist/browser/key/export.js",
109
+ "workerd": "./dist/browser/key/export.js",
110
+ "import": "./dist/node/esm/key/export.js",
111
+ "require": "./dist/node/cjs/key/export.js"
112
+ },
113
+ "./key/generate/keypair": {
114
+ "types": "./dist/types/key/generate_key_pair.d.ts",
115
+ "bun": "./dist/browser/key/generate_key_pair.js",
116
+ "deno": "./dist/browser/key/generate_key_pair.js",
117
+ "browser": "./dist/browser/key/generate_key_pair.js",
118
+ "worker": "./dist/browser/key/generate_key_pair.js",
119
+ "workerd": "./dist/browser/key/generate_key_pair.js",
120
+ "import": "./dist/node/esm/key/generate_key_pair.js",
121
+ "require": "./dist/node/cjs/key/generate_key_pair.js"
122
+ },
123
+ "./key/generate/secret": {
124
+ "types": "./dist/types/key/generate_secret.d.ts",
125
+ "bun": "./dist/browser/key/generate_secret.js",
126
+ "deno": "./dist/browser/key/generate_secret.js",
127
+ "browser": "./dist/browser/key/generate_secret.js",
128
+ "worker": "./dist/browser/key/generate_secret.js",
129
+ "workerd": "./dist/browser/key/generate_secret.js",
130
+ "import": "./dist/node/esm/key/generate_secret.js",
131
+ "require": "./dist/node/cjs/key/generate_secret.js"
132
+ },
133
+ "./jwks/remote": {
134
+ "types": "./dist/types/jwks/remote.d.ts",
135
+ "bun": "./dist/browser/jwks/remote.js",
136
+ "deno": "./dist/browser/jwks/remote.js",
137
+ "browser": "./dist/browser/jwks/remote.js",
138
+ "worker": "./dist/browser/jwks/remote.js",
139
+ "workerd": "./dist/browser/jwks/remote.js",
140
+ "import": "./dist/node/esm/jwks/remote.js",
141
+ "require": "./dist/node/cjs/jwks/remote.js"
142
+ },
143
+ "./jwks/local": {
144
+ "types": "./dist/types/jwks/local.d.ts",
145
+ "bun": "./dist/browser/jwks/local.js",
146
+ "deno": "./dist/browser/jwks/local.js",
147
+ "browser": "./dist/browser/jwks/local.js",
148
+ "worker": "./dist/browser/jwks/local.js",
149
+ "workerd": "./dist/browser/jwks/local.js",
150
+ "import": "./dist/node/esm/jwks/local.js",
151
+ "require": "./dist/node/cjs/jwks/local.js"
152
+ },
153
+ "./jwt/sign": {
154
+ "types": "./dist/types/jwt/sign.d.ts",
155
+ "bun": "./dist/browser/jwt/sign.js",
156
+ "deno": "./dist/browser/jwt/sign.js",
157
+ "browser": "./dist/browser/jwt/sign.js",
158
+ "worker": "./dist/browser/jwt/sign.js",
159
+ "workerd": "./dist/browser/jwt/sign.js",
160
+ "import": "./dist/node/esm/jwt/sign.js",
161
+ "require": "./dist/node/cjs/jwt/sign.js"
162
+ },
163
+ "./jwt/verify": {
164
+ "types": "./dist/types/jwt/verify.d.ts",
165
+ "bun": "./dist/browser/jwt/verify.js",
166
+ "deno": "./dist/browser/jwt/verify.js",
167
+ "browser": "./dist/browser/jwt/verify.js",
168
+ "worker": "./dist/browser/jwt/verify.js",
169
+ "workerd": "./dist/browser/jwt/verify.js",
170
+ "import": "./dist/node/esm/jwt/verify.js",
171
+ "require": "./dist/node/cjs/jwt/verify.js"
172
+ },
173
+ "./jwt/encrypt": {
174
+ "types": "./dist/types/jwt/encrypt.d.ts",
175
+ "bun": "./dist/browser/jwt/encrypt.js",
176
+ "deno": "./dist/browser/jwt/encrypt.js",
177
+ "browser": "./dist/browser/jwt/encrypt.js",
178
+ "worker": "./dist/browser/jwt/encrypt.js",
179
+ "workerd": "./dist/browser/jwt/encrypt.js",
180
+ "import": "./dist/node/esm/jwt/encrypt.js",
181
+ "require": "./dist/node/cjs/jwt/encrypt.js"
182
+ },
183
+ "./jwt/decrypt": {
184
+ "types": "./dist/types/jwt/decrypt.d.ts",
185
+ "bun": "./dist/browser/jwt/decrypt.js",
186
+ "deno": "./dist/browser/jwt/decrypt.js",
187
+ "browser": "./dist/browser/jwt/decrypt.js",
188
+ "worker": "./dist/browser/jwt/decrypt.js",
189
+ "workerd": "./dist/browser/jwt/decrypt.js",
190
+ "import": "./dist/node/esm/jwt/decrypt.js",
191
+ "require": "./dist/node/cjs/jwt/decrypt.js"
192
+ },
193
+ "./jwt/unsecured": {
194
+ "types": "./dist/types/jwt/unsecured.d.ts",
195
+ "bun": "./dist/browser/jwt/unsecured.js",
196
+ "deno": "./dist/browser/jwt/unsecured.js",
197
+ "browser": "./dist/browser/jwt/unsecured.js",
198
+ "worker": "./dist/browser/jwt/unsecured.js",
199
+ "workerd": "./dist/browser/jwt/unsecured.js",
200
+ "import": "./dist/node/esm/jwt/unsecured.js",
201
+ "require": "./dist/node/cjs/jwt/unsecured.js"
202
+ },
203
+ "./jwt/decode": {
204
+ "types": "./dist/types/util/decode_jwt.d.ts",
205
+ "bun": "./dist/browser/util/decode_jwt.js",
206
+ "deno": "./dist/browser/util/decode_jwt.js",
207
+ "browser": "./dist/browser/util/decode_jwt.js",
208
+ "worker": "./dist/browser/util/decode_jwt.js",
209
+ "workerd": "./dist/browser/util/decode_jwt.js",
210
+ "import": "./dist/node/esm/util/decode_jwt.js",
211
+ "require": "./dist/node/cjs/util/decode_jwt.js"
212
+ },
213
+ "./decode/protected_header": {
214
+ "types": "./dist/types/util/decode_protected_header.d.ts",
215
+ "bun": "./dist/browser/util/decode_protected_header.js",
216
+ "deno": "./dist/browser/util/decode_protected_header.js",
217
+ "browser": "./dist/browser/util/decode_protected_header.js",
218
+ "worker": "./dist/browser/util/decode_protected_header.js",
219
+ "workerd": "./dist/browser/util/decode_protected_header.js",
220
+ "import": "./dist/node/esm/util/decode_protected_header.js",
221
+ "require": "./dist/node/cjs/util/decode_protected_header.js"
222
+ },
223
+ "./jws/compact/sign": {
224
+ "types": "./dist/types/jws/compact/sign.d.ts",
225
+ "bun": "./dist/browser/jws/compact/sign.js",
226
+ "deno": "./dist/browser/jws/compact/sign.js",
227
+ "browser": "./dist/browser/jws/compact/sign.js",
228
+ "worker": "./dist/browser/jws/compact/sign.js",
229
+ "workerd": "./dist/browser/jws/compact/sign.js",
230
+ "import": "./dist/node/esm/jws/compact/sign.js",
231
+ "require": "./dist/node/cjs/jws/compact/sign.js"
232
+ },
233
+ "./jws/compact/verify": {
234
+ "types": "./dist/types/jws/compact/verify.d.ts",
235
+ "bun": "./dist/browser/jws/compact/verify.js",
236
+ "deno": "./dist/browser/jws/compact/verify.js",
237
+ "browser": "./dist/browser/jws/compact/verify.js",
238
+ "worker": "./dist/browser/jws/compact/verify.js",
239
+ "workerd": "./dist/browser/jws/compact/verify.js",
240
+ "import": "./dist/node/esm/jws/compact/verify.js",
241
+ "require": "./dist/node/cjs/jws/compact/verify.js"
242
+ },
243
+ "./jws/flattened/sign": {
244
+ "types": "./dist/types/jws/flattened/sign.d.ts",
245
+ "bun": "./dist/browser/jws/flattened/sign.js",
246
+ "deno": "./dist/browser/jws/flattened/sign.js",
247
+ "browser": "./dist/browser/jws/flattened/sign.js",
248
+ "worker": "./dist/browser/jws/flattened/sign.js",
249
+ "workerd": "./dist/browser/jws/flattened/sign.js",
250
+ "import": "./dist/node/esm/jws/flattened/sign.js",
251
+ "require": "./dist/node/cjs/jws/flattened/sign.js"
252
+ },
253
+ "./jws/flattened/verify": {
254
+ "types": "./dist/types/jws/flattened/verify.d.ts",
255
+ "bun": "./dist/browser/jws/flattened/verify.js",
256
+ "deno": "./dist/browser/jws/flattened/verify.js",
257
+ "browser": "./dist/browser/jws/flattened/verify.js",
258
+ "worker": "./dist/browser/jws/flattened/verify.js",
259
+ "workerd": "./dist/browser/jws/flattened/verify.js",
260
+ "import": "./dist/node/esm/jws/flattened/verify.js",
261
+ "require": "./dist/node/cjs/jws/flattened/verify.js"
262
+ },
263
+ "./jws/general/sign": {
264
+ "types": "./dist/types/jws/general/sign.d.ts",
265
+ "bun": "./dist/browser/jws/general/sign.js",
266
+ "deno": "./dist/browser/jws/general/sign.js",
267
+ "browser": "./dist/browser/jws/general/sign.js",
268
+ "worker": "./dist/browser/jws/general/sign.js",
269
+ "workerd": "./dist/browser/jws/general/sign.js",
270
+ "import": "./dist/node/esm/jws/general/sign.js",
271
+ "require": "./dist/node/cjs/jws/general/sign.js"
272
+ },
273
+ "./jws/general/verify": {
274
+ "types": "./dist/types/jws/general/verify.d.ts",
275
+ "bun": "./dist/browser/jws/general/verify.js",
276
+ "deno": "./dist/browser/jws/general/verify.js",
277
+ "browser": "./dist/browser/jws/general/verify.js",
278
+ "worker": "./dist/browser/jws/general/verify.js",
279
+ "workerd": "./dist/browser/jws/general/verify.js",
280
+ "import": "./dist/node/esm/jws/general/verify.js",
281
+ "require": "./dist/node/cjs/jws/general/verify.js"
282
+ },
283
+ "./jwe/compact/encrypt": {
284
+ "types": "./dist/types/jwe/compact/encrypt.d.ts",
285
+ "bun": "./dist/browser/jwe/compact/encrypt.js",
286
+ "deno": "./dist/browser/jwe/compact/encrypt.js",
287
+ "browser": "./dist/browser/jwe/compact/encrypt.js",
288
+ "worker": "./dist/browser/jwe/compact/encrypt.js",
289
+ "workerd": "./dist/browser/jwe/compact/encrypt.js",
290
+ "import": "./dist/node/esm/jwe/compact/encrypt.js",
291
+ "require": "./dist/node/cjs/jwe/compact/encrypt.js"
292
+ },
293
+ "./jwe/compact/decrypt": {
294
+ "types": "./dist/types/jwe/compact/decrypt.d.ts",
295
+ "bun": "./dist/browser/jwe/compact/decrypt.js",
296
+ "deno": "./dist/browser/jwe/compact/decrypt.js",
297
+ "browser": "./dist/browser/jwe/compact/decrypt.js",
298
+ "worker": "./dist/browser/jwe/compact/decrypt.js",
299
+ "workerd": "./dist/browser/jwe/compact/decrypt.js",
300
+ "import": "./dist/node/esm/jwe/compact/decrypt.js",
301
+ "require": "./dist/node/cjs/jwe/compact/decrypt.js"
302
+ },
303
+ "./jwe/flattened/encrypt": {
304
+ "types": "./dist/types/jwe/flattened/encrypt.d.ts",
305
+ "bun": "./dist/browser/jwe/flattened/encrypt.js",
306
+ "deno": "./dist/browser/jwe/flattened/encrypt.js",
307
+ "browser": "./dist/browser/jwe/flattened/encrypt.js",
308
+ "worker": "./dist/browser/jwe/flattened/encrypt.js",
309
+ "workerd": "./dist/browser/jwe/flattened/encrypt.js",
310
+ "import": "./dist/node/esm/jwe/flattened/encrypt.js",
311
+ "require": "./dist/node/cjs/jwe/flattened/encrypt.js"
312
+ },
313
+ "./jwe/flattened/decrypt": {
314
+ "types": "./dist/types/jwe/flattened/decrypt.d.ts",
315
+ "bun": "./dist/browser/jwe/flattened/decrypt.js",
316
+ "deno": "./dist/browser/jwe/flattened/decrypt.js",
317
+ "browser": "./dist/browser/jwe/flattened/decrypt.js",
318
+ "worker": "./dist/browser/jwe/flattened/decrypt.js",
319
+ "workerd": "./dist/browser/jwe/flattened/decrypt.js",
320
+ "import": "./dist/node/esm/jwe/flattened/decrypt.js",
321
+ "require": "./dist/node/cjs/jwe/flattened/decrypt.js"
322
+ },
323
+ "./jwe/general/encrypt": {
324
+ "types": "./dist/types/jwe/general/encrypt.d.ts",
325
+ "bun": "./dist/browser/jwe/general/encrypt.js",
326
+ "deno": "./dist/browser/jwe/general/encrypt.js",
327
+ "browser": "./dist/browser/jwe/general/encrypt.js",
328
+ "worker": "./dist/browser/jwe/general/encrypt.js",
329
+ "workerd": "./dist/browser/jwe/general/encrypt.js",
330
+ "import": "./dist/node/esm/jwe/general/encrypt.js",
331
+ "require": "./dist/node/cjs/jwe/general/encrypt.js"
332
+ },
333
+ "./jwe/general/decrypt": {
334
+ "types": "./dist/types/jwe/general/decrypt.d.ts",
335
+ "bun": "./dist/browser/jwe/general/decrypt.js",
336
+ "deno": "./dist/browser/jwe/general/decrypt.js",
337
+ "browser": "./dist/browser/jwe/general/decrypt.js",
338
+ "worker": "./dist/browser/jwe/general/decrypt.js",
339
+ "workerd": "./dist/browser/jwe/general/decrypt.js",
340
+ "import": "./dist/node/esm/jwe/general/decrypt.js",
341
+ "require": "./dist/node/cjs/jwe/general/decrypt.js"
342
+ },
73
343
  "./errors": {
74
344
  "types": "./dist/types/util/errors.d.ts",
75
345
  "bun": "./dist/browser/util/errors.js",