jose 5.9.1 → 5.9.3

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.
@@ -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.9.1';
13
+ const VERSION = 'v5.9.3';
14
14
  USER_AGENT = `${NAME}/${VERSION}`;
15
15
  }
16
16
  export const jwksCache = Symbol();
@@ -44,7 +44,8 @@ export default (protectedHeader, encodedPayload, options = {}) => {
44
44
  throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, 'missing');
45
45
  }
46
46
  }
47
- if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
47
+ if (issuer &&
48
+ !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
48
49
  throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');
49
50
  }
50
51
  if (subject && payload.sub !== subject) {
@@ -22,7 +22,8 @@ export async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu
22
22
  }
23
23
  else {
24
24
  length =
25
- Math.ceil(parseInt(publicKey.algorithm.namedCurve.substr(-3), 10) / 8) << 3;
25
+ Math.ceil(parseInt(publicKey.algorithm.namedCurve.substr(-3), 10) / 8) <<
26
+ 3;
26
27
  }
27
28
  const sharedSecret = new Uint8Array(await crypto.subtle.deriveBits({
28
29
  name: publicKey.algorithm.name,
@@ -135,5 +135,5 @@ export async function generateKeyPair(alg, options) {
135
135
  default:
136
136
  throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
137
137
  }
138
- return (crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages));
138
+ return crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);
139
139
  }
@@ -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.9.1';
16
+ const VERSION = 'v5.9.3';
17
17
  USER_AGENT = `${NAME}/${VERSION}`;
18
18
  }
19
19
  exports.jwksCache = Symbol();
@@ -46,7 +46,8 @@ exports.default = (protectedHeader, encodedPayload, options = {}) => {
46
46
  throw new errors_js_1.JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, 'missing');
47
47
  }
48
48
  }
49
- if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
49
+ if (issuer &&
50
+ !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
50
51
  throw new errors_js_1.JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');
51
52
  }
52
53
  if (subject && payload.sub !== subject) {
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const node_crypto_1 = require("node:crypto");
4
- const parse = (jwk) => {
5
- return (jwk.d ? node_crypto_1.createPrivateKey : node_crypto_1.createPublicKey)({ format: 'jwk', key: jwk });
4
+ const parse = (key) => {
5
+ if (key.d) {
6
+ return (0, node_crypto_1.createPrivateKey)({ format: 'jwk', key });
7
+ }
8
+ return (0, node_crypto_1.createPublicKey)({ format: 'jwk', key });
6
9
  };
7
10
  exports.default = parse;
@@ -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.9.1';
13
+ const VERSION = 'v5.9.3';
14
14
  USER_AGENT = `${NAME}/${VERSION}`;
15
15
  }
16
16
  export const jwksCache = Symbol();
@@ -44,7 +44,8 @@ export default (protectedHeader, encodedPayload, options = {}) => {
44
44
  throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, 'missing');
45
45
  }
46
46
  }
47
- if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
47
+ if (issuer &&
48
+ !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
48
49
  throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');
49
50
  }
50
51
  if (subject && payload.sub !== subject) {
@@ -1,5 +1,8 @@
1
1
  import { createPrivateKey, createPublicKey } from 'node:crypto';
2
- const parse = (jwk) => {
3
- return (jwk.d ? createPrivateKey : createPublicKey)({ format: 'jwk', key: jwk });
2
+ const parse = (key) => {
3
+ if (key.d) {
4
+ return createPrivateKey({ format: 'jwk', key });
5
+ }
6
+ return createPublicKey({ format: 'jwk', key });
4
7
  };
5
8
  export default parse;
@@ -3,7 +3,7 @@ import type { JWK, CompactVerifyResult, FlattenedJWSInput, GenericGetKeyFunction
3
3
  * Interface for Compact JWS Verification dynamic key resolution. No token components have been
4
4
  * verified at the time of this function call.
5
5
  *
6
- * @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
6
+ * @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
7
7
  */
8
8
  export interface CompactVerifyGetKey extends GenericGetKeyFunction<CompactJWSHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {
9
9
  }
@@ -3,7 +3,7 @@ import type { JWK, FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderP
3
3
  * Interface for Flattened JWS Verification dynamic key resolution. No token components have been
4
4
  * verified at the time of this function call.
5
5
  *
6
- * @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
6
+ * @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
7
7
  */
8
8
  export interface FlattenedVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters | undefined, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {
9
9
  }
@@ -3,7 +3,7 @@ import type { JWK, GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, Gene
3
3
  * Interface for General JWS Verification dynamic key resolution. No token components have been
4
4
  * verified at the time of this function call.
5
5
  *
6
- * @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
6
+ * @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
7
7
  */
8
8
  export interface GeneralVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {
9
9
  }
@@ -6,7 +6,7 @@ export interface JWTVerifyOptions extends VerifyOptions, JWTClaimVerificationOpt
6
6
  * Interface for JWT Verification dynamic key resolution. No token components have been verified at
7
7
  * the time of this function call.
8
8
  *
9
- * @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
9
+ * @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
10
10
  */
11
11
  export interface JWTVerifyGetKey extends GenericGetKeyFunction<JWTHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {
12
12
  }
@@ -1,7 +1,7 @@
1
1
  import type { JWK, KeyLike } from '../types';
2
2
  /**
3
- * Exports a runtime-specific public key representation (KeyObject or CryptoKey) to a PEM-encoded
4
- * SPKI string format.
3
+ * Exports a runtime-specific public key representation ({@link !KeyObject} or {@link !CryptoKey}) to
4
+ * a PEM-encoded SPKI string format.
5
5
  *
6
6
  * This function is exported (as a named export) from the main `'jose'` module entry point as well
7
7
  * as from its subpath export `'jose/key/export'`.
@@ -10,8 +10,8 @@ import type { JWK, KeyLike } from '../types';
10
10
  */
11
11
  export declare function exportSPKI(key: KeyLike): Promise<string>;
12
12
  /**
13
- * Exports a runtime-specific private key representation (KeyObject or CryptoKey) to a PEM-encoded
14
- * PKCS8 string format.
13
+ * Exports a runtime-specific private key representation ({@link !KeyObject} or {@link !CryptoKey}) to
14
+ * a PEM-encoded PKCS8 string format.
15
15
  *
16
16
  * This function is exported (as a named export) from the main `'jose'` module entry point as well
17
17
  * as from its subpath export `'jose/key/export'`.
@@ -18,8 +18,7 @@ export interface GenerateKeyPairOptions {
18
18
  modulusLength?: number;
19
19
  /**
20
20
  * (Only effective in Web Crypto API runtimes) The value to use as
21
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey SubtleCrypto.generateKey()}
22
- * `extractable` argument. Default is false.
21
+ * {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
23
22
  *
24
23
  */
25
24
  extractable?: boolean;
@@ -2,8 +2,7 @@ import type { KeyLike } from '../types';
2
2
  export interface GenerateSecretOptions {
3
3
  /**
4
4
  * (Only effective in Web Crypto API runtimes) The value to use as
5
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey SubtleCrypto.generateKey()}
6
- * `extractable` argument. Default is false.
5
+ * {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
7
6
  */
8
7
  extractable?: boolean;
9
8
  }
@@ -1,15 +1,14 @@
1
1
  import type { JWK, KeyLike } from '../types';
2
2
  export interface PEMImportOptions {
3
3
  /**
4
- * (Only effective in Web Crypto API runtimes) The value to use as
5
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey SubtleCrypto.importKey()}
4
+ * (Only effective in Web Crypto API runtimes) The value to use as {@link !SubtleCrypto.importKey}
6
5
  * `extractable` argument. Default is false.
7
6
  */
8
7
  extractable?: boolean;
9
8
  }
10
9
  /**
11
- * Imports a PEM-encoded SPKI string as a runtime-specific public key representation (KeyObject or
12
- * CryptoKey).
10
+ * Imports a PEM-encoded SPKI string as a runtime-specific public key representation
11
+ * ({@link !KeyObject} or {@link !CryptoKey}).
13
12
  *
14
13
  * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
15
14
  * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
@@ -26,7 +25,7 @@ export interface PEMImportOptions {
26
25
  export declare function importSPKI<KeyLikeType extends KeyLike = KeyLike>(spki: string, alg: string, options?: PEMImportOptions): Promise<KeyLikeType>;
27
26
  /**
28
27
  * Imports the SPKI from an X.509 string certificate as a runtime-specific public key representation
29
- * (KeyObject or CryptoKey).
28
+ * ({@link !KeyObject} or {@link !CryptoKey}).
30
29
  *
31
30
  * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
32
31
  * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
@@ -42,8 +41,8 @@ export declare function importSPKI<KeyLikeType extends KeyLike = KeyLike>(spki:
42
41
  */
43
42
  export declare function importX509<KeyLikeType extends KeyLike = KeyLike>(x509: string, alg: string, options?: PEMImportOptions): Promise<KeyLikeType>;
44
43
  /**
45
- * Imports a PEM-encoded PKCS#8 string as a runtime-specific private key representation (KeyObject
46
- * or CryptoKey).
44
+ * Imports a PEM-encoded PKCS#8 string as a runtime-specific private key representation
45
+ * ({@link !KeyObject} or {@link !CryptoKey}).
47
46
  *
48
47
  * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
49
48
  * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
@@ -63,7 +62,7 @@ export declare function importPKCS8<KeyLikeType extends KeyLike = KeyLike>(pkcs8
63
62
  * (Algorithm) Parameter, or the optional "alg" argument, must be present.
64
63
  *
65
64
  * Note: When the runtime is using {@link https://w3c.github.io/webcrypto/ Web Cryptography API} the
66
- * jwk parameters "use", "key_ops", and "ext" are also used in the resulting `CryptoKey`.
65
+ * jwk parameters "use", "key_ops", and "ext" are also used in the resulting {@link !CryptoKey}.
67
66
  *
68
67
  * This function is exported (as a named export) from the main `'jose'` module entry point as well
69
68
  * as from its subpath export `'jose/key/import'`.
@@ -1,138 +1,123 @@
1
1
  /**
2
2
  * KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets. These are
3
- * instances of {@link https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey CryptoKey} and
4
- * additionally {@link https://nodejs.org/api/crypto.html#class-keyobject KeyObject} in Node.js
5
- * runtime.
6
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array Uint8Array}
7
- * instances are also accepted as symmetric secret representation only.
3
+ * instances of {@link !CryptoKey} and additionally {@link !KeyObject} in Node.js runtime.
4
+ * {@link !Uint8Array} instances are also accepted as symmetric secret representation only.
8
5
  *
9
- * [Key Import Functions](../modules/key_import.md) can be used to import PEM, or JWK formatted
10
- * asymmetric keys and certificates to these runtime-specific representations.
6
+ * {@link key/import Key Import Functions} can be used to import PEM, or JWK formatted asymmetric
7
+ * keys and certificates to these runtime-specific representations.
11
8
  *
12
- * In Node.js the {@link https://nodejs.org/api/buffer.html#buffer Buffer} class is a subclass of
13
- * Uint8Array and so Buffer can be provided for symmetric secrets as well.
9
+ * In Node.js the {@link !Buffer} class is a subclass of {@link !Uint8Array} and so {@link !Buffer} can
10
+ * be provided for symmetric secrets as well.
14
11
  *
15
- * {@link https://nodejs.org/api/crypto.html#class-keyobject KeyObject} is a representation of a
16
- * key/secret available in the Node.js runtime. In addition to the import functions of this library
17
- * you may use the runtime APIs
18
- * {@link https://nodejs.org/api/crypto.html#cryptocreatepublickeykey crypto.createPublicKey},
19
- * {@link https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey crypto.createPrivateKey}, and
20
- * {@link https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding crypto.createSecretKey}
21
- * to obtain a `KeyObject` from your existing key material.
12
+ * {@link !KeyObject} is a representation of a key/secret available in the Node.js runtime. In
13
+ * addition to the {@link key/import Key Import Functions} you may use the runtime APIs
14
+ * {@link !createPublicKey}, {@link !createPrivateKey}, and {@link !createSecretKey} to obtain a
15
+ * {@link !KeyObject} from your existing key material.
22
16
  *
23
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey CryptoKey} is a representation
24
- * of a key/secret available in the Browser and Web-interoperable runtimes. In addition to the
25
- * import functions of this library you may use the
26
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey SubtleCrypto.importKey}
27
- * API to obtain a CryptoKey from your existing key material.
17
+ * {@link !CryptoKey} is a representation of a key/secret available in the Browser and
18
+ * Web-interoperable runtimes. In addition to the {@link key/import Key Import Functions} you may use
19
+ * the {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key
20
+ * material.
28
21
  *
29
22
  */
30
23
  export type KeyLike = { type: string }
31
24
 
32
25
  /** Generic JSON Web Key Parameters. */
33
26
  export interface JWKParameters {
34
- /** JWK "kty" (Key Type) Parameter. */
27
+ /** JWK "kty" (Key Type) Parameter */
35
28
  kty: string
36
- /** JWK "alg" (Algorithm) Parameter. */
29
+ /**
30
+ * JWK "alg" (Algorithm) Parameter
31
+ *
32
+ * @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}
33
+ */
37
34
  alg?: string
38
- /** JWK "key_ops" (Key Operations) Parameter. */
35
+ /** JWK "key_ops" (Key Operations) Parameter */
39
36
  key_ops?: string[]
40
- /** JWK "ext" (Extractable) Parameter. */
37
+ /** JWK "ext" (Extractable) Parameter */
41
38
  ext?: boolean
42
- /** JWK "use" (Public Key Use) Parameter. */
39
+ /** JWK "use" (Public Key Use) Parameter */
43
40
  use?: string
44
- /** JWK "x5c" (X.509 Certificate Chain) Parameter. */
41
+ /** JWK "x5c" (X.509 Certificate Chain) Parameter */
45
42
  x5c?: string[]
46
- /** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter. */
43
+ /** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter */
47
44
  x5t?: string
48
- /** "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter. */
45
+ /** JWK "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter */
49
46
  'x5t#S256'?: string
50
- /** JWK "x5u" (X.509 URL) Parameter. */
47
+ /** JWK "x5u" (X.509 URL) Parameter */
51
48
  x5u?: string
52
- /** JWK "kid" (Key ID) Parameter. */
49
+ /** JWK "kid" (Key ID) Parameter */
53
50
  kid?: string
54
-
55
- [propName: string]: unknown
56
51
  }
57
52
 
58
53
  /** Convenience interface for Public OKP JSON Web Keys */
59
54
  export interface JWK_OKP_Public extends JWKParameters {
60
- /** The Subtype of Key Pair */
55
+ /** OKP JWK "crv" (The Subtype of Key Pair) Parameter */
61
56
  crv: string
62
- /** The public key */
57
+ /** OKP JWK "x" (The public key) Parameter */
63
58
  x: string
64
-
65
- [propName: string]: unknown
66
59
  }
67
60
 
68
61
  /** Convenience interface for Private OKP JSON Web Keys */
69
62
  export interface JWK_OKP_Private extends JWK_OKP_Public, JWKParameters {
70
- /** The Private Key */
63
+ /** OKP JWK "d" (The Private Key) Parameter */
71
64
  d: string
72
-
73
- [propName: string]: unknown
74
65
  }
75
66
 
76
67
  /** Convenience interface for Public EC JSON Web Keys */
77
68
  export interface JWK_EC_Public extends JWKParameters {
78
- /** Curve */
69
+ /** EC JWK "crv" (Curve) Parameter */
79
70
  crv: string
80
- /** X Coordinate */
71
+ /** EC JWK "x" (X Coordinate) Parameter */
81
72
  x: string
82
- /** Y Coordinate */
73
+ /** EC JWK "y" (Y Coordinate) Parameter */
83
74
  y: string
84
-
85
- [propName: string]: unknown
86
75
  }
87
76
 
88
77
  /** Convenience interface for Private EC JSON Web Keys */
89
78
  export interface JWK_EC_Private extends JWK_EC_Public, JWKParameters {
90
- /** ECC Private Key */
79
+ /** EC JWK "d" (ECC Private Key) Parameter */
91
80
  d: string
92
-
93
- [propName: string]: unknown
94
81
  }
95
82
 
96
83
  /** Convenience interface for Public RSA JSON Web Keys */
97
84
  export interface JWK_RSA_Public extends JWKParameters {
98
- /** Exponent */
85
+ /** RSA JWK "e" (Exponent) Parameter */
99
86
  e: string
100
- /** Modulus */
87
+ /** RSA JWK "n" (Modulus) Parameter */
101
88
  n: string
102
-
103
- [propName: string]: unknown
104
89
  }
105
90
 
106
91
  /** Convenience interface for Private RSA JSON Web Keys */
107
92
  export interface JWK_RSA_Private extends JWK_RSA_Public, JWKParameters {
108
- /** Private Exponent */
93
+ /** RSA JWK "d" (Private Exponent) Parameter */
109
94
  d: string
110
- /** First Factor CRT Exponent */
95
+ /** RSA JWK "dp" (First Factor CRT Exponent) Parameter */
111
96
  dp: string
112
- /** Second Factor CRT Exponent */
97
+ /** RSA JWK "dq" (Second Factor CRT Exponent) Parameter */
113
98
  dq: string
114
- /** Other Primes Info. This parameter is not supported. */
99
+ /**
100
+ * RSA JWK "oth" (Other Primes Info) Parameter
101
+ *
102
+ * This parameter is not supported
103
+ */
115
104
  oth?: Array<{
116
105
  d?: string
117
106
  r?: string
118
107
  t?: string
119
108
  }>
120
- /** First Prime Factor */
109
+ /** RSA JWK "p" (First Prime Factor) Parameter */
121
110
  p: string
122
- /** Second Prime Factor */
111
+ /** RSA JWK "q" (Second Prime Factor) Parameter */
123
112
  q: string
124
- /** First CRT Coefficient */
113
+ /** RSA JWK "qi" (First CRT Coefficient) Parameter */
125
114
  qi: string
126
-
127
- [propName: string]: unknown
128
115
  }
129
116
 
130
117
  /** Convenience interface for oct JSON Web Keys */
131
118
  export interface JWK_oct extends JWKParameters {
132
- /** Key Value */
119
+ /** Oct JWK "k" (Key Value) Parameter */
133
120
  k: string
134
-
135
- [propName: string]: unknown
136
121
  }
137
122
 
138
123
  /**
@@ -149,47 +134,49 @@ export interface JWK_oct extends JWKParameters {
149
134
  */
150
135
  export interface JWK extends JWKParameters {
151
136
  /**
152
- * - (EC) Curve
153
- * - (OKP) The Subtype of Key Pair
137
+ * - EC JWK "crv" (Curve) Parameter
138
+ * - OKP JWK "crv" (The Subtype of Key Pair) Parameter
154
139
  */
155
140
  crv?: string
156
141
  /**
157
- * - (Private RSA) Private Exponent
158
- * - (Private EC) ECC Private Key
159
- * - (Private OKP) The Private Key
142
+ * - Private RSA JWK "d" (Private Exponent) Parameter
143
+ * - Private EC JWK "d" (ECC Private Key) Parameter
144
+ * - Private OKP JWK "d" (The Private Key) Parameter
160
145
  */
161
146
  d?: string
162
- /** (Private RSA) First Factor CRT Exponent */
147
+ /** Private RSA JWK "dp" (First Factor CRT Exponent) Parameter */
163
148
  dp?: string
164
- /** (Private RSA) Second Factor CRT Exponent */
149
+ /** Private RSA JWK "dq" (Second Factor CRT Exponent) Parameter */
165
150
  dq?: string
166
- /** (RSA) Exponent */
151
+ /** RSA JWK "e" (Exponent) Parameter */
167
152
  e?: string
168
- /** (oct) Key Value */
153
+ /** Oct JWK "k" (Key Value) Parameter */
169
154
  k?: string
170
- /** (RSA) Modulus */
155
+ /** RSA JWK "n" (Modulus) Parameter */
171
156
  n?: string
172
- /** (Private RSA) Other Primes Info. This parameter is not supported. */
157
+ /**
158
+ * Private RSA JWK "oth" (Other Primes Info) Parameter
159
+ *
160
+ * This parameter is not supported
161
+ */
173
162
  oth?: Array<{
174
163
  d?: string
175
164
  r?: string
176
165
  t?: string
177
166
  }>
178
- /** (Private RSA) First Prime Factor */
167
+ /** Private RSA JWK "p" (First Prime Factor) Parameter */
179
168
  p?: string
180
- /** (Private RSA) Second Prime Factor */
169
+ /** Private RSA JWK "q" (Second Prime Factor) Parameter */
181
170
  q?: string
182
- /** (Private RSA) First CRT Coefficient */
171
+ /** Private RSA JWK "qi" (First CRT Coefficient) Parameter */
183
172
  qi?: string
184
173
  /**
185
- * - (EC) X Coordinate
186
- * - (OKP) The public key
174
+ * - EC JWK "x" (X Coordinate) Parameter
175
+ * - OKP JWK "x" (The public key) Parameter
187
176
  */
188
177
  x?: string
189
- /** (EC) Y Coordinate */
178
+ /** EC JWK "y" (Y Coordinate) Parameter */
190
179
  y?: string
191
-
192
- [propName: string]: unknown
193
180
  }
194
181
 
195
182
  /**
@@ -220,8 +207,8 @@ export interface GetKeyFunction<IProtectedHeader, IToken>
220
207
  extends GenericGetKeyFunction<IProtectedHeader, IToken, KeyLike | Uint8Array> {}
221
208
 
222
209
  /**
223
- * Flattened JWS definition for verify function inputs, allows payload as Uint8Array for detached
224
- * signature validation.
210
+ * Flattened JWS definition for verify function inputs, allows payload as {@link !Uint8Array} for
211
+ * detached signature validation.
225
212
  */
226
213
  export interface FlattenedJWSInput {
227
214
  /**
@@ -234,7 +221,7 @@ export interface FlattenedJWSInput {
234
221
 
235
222
  /**
236
223
  * The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When RFC7797
237
- * "b64": false is used the value passed may also be a Uint8Array.
224
+ * "b64": false is used the value passed may also be a {@link !Uint8Array}.
238
225
  */
239
226
  payload: string | Uint8Array
240
227
 
@@ -250,14 +237,14 @@ export interface FlattenedJWSInput {
250
237
  }
251
238
 
252
239
  /**
253
- * General JWS definition for verify function inputs, allows payload as Uint8Array for detached
254
- * signature validation.
240
+ * General JWS definition for verify function inputs, allows payload as {@link !Uint8Array} for
241
+ * detached signature validation.
255
242
  */
256
243
  export interface GeneralJWSInput {
257
244
  /**
258
245
  * The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When when
259
246
  * JWS Unencoded Payload ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) "b64": false is
260
- * used the value passed may also be a Uint8Array.
247
+ * used the value passed may also be a {@link !Uint8Array}.
261
248
  */
262
249
  payload: string | Uint8Array
263
250
 
@@ -287,34 +274,38 @@ export interface GeneralJWS {
287
274
  }
288
275
 
289
276
  export interface JoseHeaderParameters {
290
- /** "kid" (Key ID) Header Parameter. */
277
+ /** "kid" (Key ID) Header Parameter */
291
278
  kid?: string
292
279
 
293
- /** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter. */
280
+ /** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter */
294
281
  x5t?: string
295
282
 
296
- /** "x5c" (X.509 Certificate Chain) Header Parameter. */
283
+ /** "x5c" (X.509 Certificate Chain) Header Parameter */
297
284
  x5c?: string[]
298
285
 
299
- /** "x5u" (X.509 URL) Header Parameter. */
286
+ /** "x5u" (X.509 URL) Header Parameter */
300
287
  x5u?: string
301
288
 
302
- /** "jku" (JWK Set URL) Header Parameter. */
289
+ /** "jku" (JWK Set URL) Header Parameter */
303
290
  jku?: string
304
291
 
305
- /** "jwk" (JSON Web Key) Header Parameter. */
292
+ /** "jwk" (JSON Web Key) Header Parameter */
306
293
  jwk?: Pick<JWK, 'kty' | 'crv' | 'x' | 'y' | 'e' | 'n'>
307
294
 
308
- /** "typ" (Type) Header Parameter. */
295
+ /** "typ" (Type) Header Parameter */
309
296
  typ?: string
310
297
 
311
- /** "cty" (Content Type) Header Parameter. */
298
+ /** "cty" (Content Type) Header Parameter */
312
299
  cty?: string
313
300
  }
314
301
 
315
302
  /** Recognized JWS Header Parameters, any other Header Members may also be present. */
316
303
  export interface JWSHeaderParameters extends JoseHeaderParameters {
317
- /** JWS "alg" (Algorithm) Header Parameter. */
304
+ /**
305
+ * JWS "alg" (Algorithm) Header Parameter
306
+ *
307
+ * @see {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}
308
+ */
318
309
  alg?: string
319
310
 
320
311
  /**
@@ -323,7 +314,7 @@ export interface JWSHeaderParameters extends JoseHeaderParameters {
323
314
  */
324
315
  b64?: boolean
325
316
 
326
- /** JWS "crit" (Critical) Header Parameter. */
317
+ /** JWS "crit" (Critical) Header Parameter */
327
318
  crit?: string[]
328
319
 
329
320
  /** Any other JWS Header member. */
@@ -416,13 +407,21 @@ export interface GeneralJWE extends Omit<FlattenedJWE, 'encrypted_key' | 'header
416
407
 
417
408
  /** Recognized JWE Header Parameters, any other Header members may also be present. */
418
409
  export interface JWEHeaderParameters extends JoseHeaderParameters {
419
- /** JWE "alg" (Algorithm) Header Parameter. */
410
+ /**
411
+ * JWE "alg" (Algorithm) Header Parameter
412
+ *
413
+ * @see {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}
414
+ */
420
415
  alg?: string
421
416
 
422
- /** JWE "enc" (Encryption Algorithm) Header Parameter. */
417
+ /**
418
+ * JWE "enc" (Encryption Algorithm) Header Parameter
419
+ *
420
+ * @see {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}
421
+ */
423
422
  enc?: string
424
423
 
425
- /** JWE "crit" (Critical) Header Parameter. */
424
+ /** JWE "crit" (Critical) Header Parameter */
426
425
  crit?: string[]
427
426
 
428
427
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Utility function to encode a string or Uint8Array as a base64url string.
2
+ * Utility function to encode a string or {@link !Uint8Array} as a base64url string.
3
3
  *
4
4
  * @param input Value that will be base64url-encoded.
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "5.9.1",
3
+ "version": "5.9.3",
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",