jose 5.7.0 → 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 (43) hide show
  1. package/dist/browser/jwe/flattened/encrypt.js +1 -1
  2. package/dist/browser/jwe/general/encrypt.js +2 -1
  3. package/dist/browser/jwks/local.js +1 -1
  4. package/dist/browser/jwks/remote.js +1 -1
  5. package/dist/browser/lib/private_symbols.js +1 -0
  6. package/dist/node/cjs/jwe/flattened/encrypt.js +3 -3
  7. package/dist/node/cjs/jwe/general/encrypt.js +2 -1
  8. package/dist/node/cjs/jwks/local.js +1 -2
  9. package/dist/node/cjs/jwks/remote.js +1 -1
  10. package/dist/node/cjs/lib/private_symbols.js +4 -0
  11. package/dist/node/esm/jwe/flattened/encrypt.js +1 -1
  12. package/dist/node/esm/jwe/general/encrypt.js +2 -1
  13. package/dist/node/esm/jwks/local.js +1 -1
  14. package/dist/node/esm/jwks/remote.js +1 -1
  15. package/dist/node/esm/lib/private_symbols.js +1 -0
  16. package/dist/types/jwe/compact/decrypt.d.ts +3 -0
  17. package/dist/types/jwe/compact/encrypt.d.ts +3 -0
  18. package/dist/types/jwe/flattened/decrypt.d.ts +3 -0
  19. package/dist/types/jwe/flattened/encrypt.d.ts +3 -2
  20. package/dist/types/jwe/general/decrypt.d.ts +3 -0
  21. package/dist/types/jwe/general/encrypt.d.ts +3 -0
  22. package/dist/types/jwk/embedded.d.ts +3 -0
  23. package/dist/types/jwk/thumbprint.d.ts +6 -0
  24. package/dist/types/jwks/local.d.ts +3 -7
  25. package/dist/types/jwks/remote.d.ts +3 -0
  26. package/dist/types/jws/compact/sign.d.ts +3 -0
  27. package/dist/types/jws/compact/verify.d.ts +3 -0
  28. package/dist/types/jws/flattened/sign.d.ts +3 -0
  29. package/dist/types/jws/flattened/verify.d.ts +3 -0
  30. package/dist/types/jws/general/sign.d.ts +3 -0
  31. package/dist/types/jws/general/verify.d.ts +3 -0
  32. package/dist/types/jwt/decrypt.d.ts +3 -0
  33. package/dist/types/jwt/encrypt.d.ts +3 -0
  34. package/dist/types/jwt/sign.d.ts +3 -0
  35. package/dist/types/jwt/unsecured.d.ts +3 -0
  36. package/dist/types/jwt/verify.d.ts +3 -0
  37. package/dist/types/key/export.d.ts +9 -0
  38. package/dist/types/key/generate_key_pair.d.ts +3 -0
  39. package/dist/types/key/generate_secret.d.ts +3 -0
  40. package/dist/types/key/import.d.ts +12 -0
  41. package/dist/types/util/decode_jwt.d.ts +3 -0
  42. package/dist/types/util/decode_protected_header.d.ts +3 -0
  43. package/package.json +271 -1
@@ -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,7 +10,7 @@ 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.7.0';
13
+ const VERSION = 'v5.8.0';
14
14
  USER_AGENT = `${NAME}/${VERSION}`;
15
15
  }
16
16
  export const jwksCache = Symbol();
@@ -0,0 +1 @@
1
+ export const unprotected = Symbol();
@@ -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) {
@@ -13,7 +13,7 @@ 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.7.0';
16
+ const VERSION = 'v5.8.0';
17
17
  USER_AGENT = `${NAME}/${VERSION}`;
18
18
  }
19
19
  exports.jwksCache = Symbol();
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unprotected = void 0;
4
+ exports.unprotected = Symbol();
@@ -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,7 +10,7 @@ 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.7.0';
13
+ const VERSION = 'v5.8.0';
14
14
  USER_AGENT = `${NAME}/${VERSION}`;
15
15
  }
16
16
  export const jwksCache = Symbol();
@@ -0,0 +1 @@
1
+ export const unprotected = Symbol();
@@ -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>;
@@ -108,6 +108,9 @@ export type JWKSCacheInput = ExportedJWKSCache | Record<string, never>;
108
108
  * Note: The function's purpose is to resolve public keys used for verifying signatures and will not
109
109
  * work for public encryption keys.
110
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
+ *
111
114
  * @param url URL to fetch the JSON Web Key Set from.
112
115
  * @param options Options for the remote JSON Web Key Set.
113
116
  */
@@ -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
@@ -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.7.0",
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",