jose 3.20.1 → 3.20.4

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 (80) hide show
  1. package/dist/browser/jwe/flattened/decrypt.js +7 -11
  2. package/dist/browser/jwe/flattened/encrypt.js +2 -5
  3. package/dist/browser/jws/flattened/sign.js +1 -2
  4. package/dist/browser/jws/flattened/verify.js +2 -4
  5. package/dist/browser/lib/cek.js +3 -2
  6. package/dist/browser/lib/decrypt_key_management.js +4 -1
  7. package/dist/browser/lib/encrypt_key_management.js +1 -3
  8. package/dist/browser/lib/iv.js +3 -2
  9. package/dist/browser/runtime/aesgcmkw.js +1 -3
  10. package/dist/browser/runtime/random.js +1 -2
  11. package/dist/browser/util/errors.js +66 -34
  12. package/dist/node/cjs/jwe/compact/decrypt.js +1 -1
  13. package/dist/node/cjs/jwe/flattened/decrypt.js +18 -22
  14. package/dist/node/cjs/jwe/flattened/encrypt.js +13 -16
  15. package/dist/node/cjs/jwe/general/decrypt.js +2 -2
  16. package/dist/node/cjs/jwk/embedded.js +2 -2
  17. package/dist/node/cjs/jwk/from_key_like.js +1 -1
  18. package/dist/node/cjs/jwk/parse.js +1 -1
  19. package/dist/node/cjs/jwk/thumbprint.js +2 -2
  20. package/dist/node/cjs/jwks/remote.js +3 -3
  21. package/dist/node/cjs/jws/compact/verify.js +1 -1
  22. package/dist/node/cjs/jws/flattened/sign.js +8 -9
  23. package/dist/node/cjs/jws/flattened/verify.js +11 -13
  24. package/dist/node/cjs/jws/general/verify.js +2 -2
  25. package/dist/node/cjs/jwt/decrypt.js +2 -2
  26. package/dist/node/cjs/jwt/produce.js +4 -4
  27. package/dist/node/cjs/jwt/unsecured.js +1 -1
  28. package/dist/node/cjs/jwt/verify.js +2 -2
  29. package/dist/node/cjs/key/export.js +3 -3
  30. package/dist/node/cjs/key/import.js +10 -10
  31. package/dist/node/cjs/lib/cek.js +4 -3
  32. package/dist/node/cjs/lib/check_key_type.js +4 -4
  33. package/dist/node/cjs/lib/decrypt_key_management.js +16 -13
  34. package/dist/node/cjs/lib/encrypt_key_management.js +14 -16
  35. package/dist/node/cjs/lib/iv.js +4 -3
  36. package/dist/node/cjs/lib/jwt_claims_set.js +4 -4
  37. package/dist/node/cjs/runtime/aesgcmkw.js +4 -6
  38. package/dist/node/cjs/runtime/aeskw.js +11 -11
  39. package/dist/node/cjs/runtime/asn1.js +6 -6
  40. package/dist/node/cjs/runtime/cbc_tag.js +2 -2
  41. package/dist/node/cjs/runtime/check_cek_length.js +1 -1
  42. package/dist/node/cjs/runtime/ciphers.js +1 -1
  43. package/dist/node/cjs/runtime/decrypt.js +15 -15
  44. package/dist/node/cjs/runtime/digest.js +1 -1
  45. package/dist/node/cjs/runtime/ecdhes.js +18 -18
  46. package/dist/node/cjs/runtime/encrypt.js +14 -14
  47. package/dist/node/cjs/runtime/fetch_jwks.js +2 -2
  48. package/dist/node/cjs/runtime/generate.js +4 -4
  49. package/dist/node/cjs/runtime/get_named_curve.js +5 -5
  50. package/dist/node/cjs/runtime/get_sign_verify_key.js +5 -5
  51. package/dist/node/cjs/runtime/invalid_key_input.js +2 -2
  52. package/dist/node/cjs/runtime/is_key_like.js +1 -1
  53. package/dist/node/cjs/runtime/jwk_to_key.js +11 -11
  54. package/dist/node/cjs/runtime/key_to_jwk.js +27 -27
  55. package/dist/node/cjs/runtime/node_key.js +4 -4
  56. package/dist/node/cjs/runtime/pbes2kw.js +13 -13
  57. package/dist/node/cjs/runtime/random.js +3 -2
  58. package/dist/node/cjs/runtime/rsaes.js +7 -7
  59. package/dist/node/cjs/runtime/secret_key.js +1 -1
  60. package/dist/node/cjs/runtime/sign.js +4 -4
  61. package/dist/node/cjs/runtime/verify.js +5 -5
  62. package/dist/node/cjs/runtime/zlib.js +2 -2
  63. package/dist/node/cjs/util/decode_protected_header.js +2 -2
  64. package/dist/node/cjs/util/errors.js +69 -37
  65. package/dist/node/cjs/util/generate_key_pair.js +1 -1
  66. package/dist/node/cjs/util/generate_secret.js +1 -1
  67. package/dist/node/esm/jwe/flattened/decrypt.js +7 -11
  68. package/dist/node/esm/jwe/flattened/encrypt.js +2 -5
  69. package/dist/node/esm/jws/flattened/sign.js +1 -2
  70. package/dist/node/esm/jws/flattened/verify.js +2 -4
  71. package/dist/node/esm/lib/cek.js +3 -2
  72. package/dist/node/esm/lib/decrypt_key_management.js +4 -1
  73. package/dist/node/esm/lib/encrypt_key_management.js +1 -3
  74. package/dist/node/esm/lib/iv.js +3 -2
  75. package/dist/node/esm/runtime/aesgcmkw.js +1 -3
  76. package/dist/node/esm/runtime/random.js +1 -2
  77. package/dist/node/esm/util/errors.js +66 -34
  78. package/dist/types/types.d.ts +1 -0
  79. package/dist/types/util/errors.d.ts +21 -18
  80. package/package.json +2 -1
@@ -1,15 +1,12 @@
1
1
  import { encode as base64url } from '../../runtime/base64url.js';
2
- import random from '../../runtime/random.js';
3
2
  import encrypt from '../../runtime/encrypt.js';
4
3
  import { deflate } from '../../runtime/zlib.js';
5
- import ivFactory from '../../lib/iv.js';
4
+ import generateIv from '../../lib/iv.js';
6
5
  import encryptKeyManagement from '../../lib/encrypt_key_management.js';
7
6
  import { JOSENotSupported, JWEInvalid } from '../../util/errors.js';
8
7
  import isDisjoint from '../../lib/is_disjoint.js';
9
8
  import { encoder, decoder, concat } from '../../lib/buffer_utils.js';
10
9
  import validateCrit from '../../lib/validate_crit.js';
11
- const generateIv = ivFactory(random);
12
- const checkExtensions = validateCrit.bind(undefined, JWEInvalid, new Map());
13
10
  class FlattenedEncrypt {
14
11
  constructor(plaintext) {
15
12
  if (!(plaintext instanceof Uint8Array)) {
@@ -75,7 +72,7 @@ class FlattenedEncrypt {
75
72
  ...this._unprotectedHeader,
76
73
  ...this._sharedUnprotectedHeader,
77
74
  };
78
- checkExtensions(options === null || options === void 0 ? void 0 : options.crit, this._protectedHeader, joseHeader);
75
+ validateCrit(JWEInvalid, new Map(), options === null || options === void 0 ? void 0 : options.crit, this._protectedHeader, joseHeader);
79
76
  if (joseHeader.zip !== undefined) {
80
77
  if (!this._protectedHeader || !this._protectedHeader.zip) {
81
78
  throw new JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');
@@ -5,7 +5,6 @@ import { JWSInvalid } from '../../util/errors.js';
5
5
  import { encoder, decoder, concat } from '../../lib/buffer_utils.js';
6
6
  import checkKeyType from '../../lib/check_key_type.js';
7
7
  import validateCrit from '../../lib/validate_crit.js';
8
- const checkExtensions = validateCrit.bind(undefined, JWSInvalid, new Map([['b64', true]]));
9
8
  class FlattenedSign {
10
9
  constructor(payload) {
11
10
  if (!(payload instanceof Uint8Array)) {
@@ -38,7 +37,7 @@ class FlattenedSign {
38
37
  ...this._protectedHeader,
39
38
  ...this._unprotectedHeader,
40
39
  };
41
- const extensions = checkExtensions(options === null || options === void 0 ? void 0 : options.crit, this._protectedHeader, joseHeader);
40
+ const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options === null || options === void 0 ? void 0 : options.crit, this._protectedHeader, joseHeader);
42
41
  let b64 = true;
43
42
  if (extensions.has('b64')) {
44
43
  b64 = this._protectedHeader.b64;
@@ -7,8 +7,6 @@ import isObject from '../../lib/is_object.js';
7
7
  import checkKeyType from '../../lib/check_key_type.js';
8
8
  import validateCrit from '../../lib/validate_crit.js';
9
9
  import validateAlgorithms from '../../lib/validate_algorithms.js';
10
- const checkExtensions = validateCrit.bind(undefined, JWSInvalid, new Map([['b64', true]]));
11
- const checkAlgOption = validateAlgorithms.bind(undefined, 'algorithms');
12
10
  async function flattenedVerify(jws, key, options) {
13
11
  var _a;
14
12
  if (!isObject(jws)) {
@@ -46,7 +44,7 @@ async function flattenedVerify(jws, key, options) {
46
44
  ...parsedProt,
47
45
  ...jws.header,
48
46
  };
49
- const extensions = checkExtensions(options === null || options === void 0 ? void 0 : options.crit, parsedProt, joseHeader);
47
+ const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options === null || options === void 0 ? void 0 : options.crit, parsedProt, joseHeader);
50
48
  let b64 = true;
51
49
  if (extensions.has('b64')) {
52
50
  b64 = parsedProt.b64;
@@ -58,7 +56,7 @@ async function flattenedVerify(jws, key, options) {
58
56
  if (typeof alg !== 'string' || !alg) {
59
57
  throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
60
58
  }
61
- const algorithms = options && checkAlgOption(options.algorithms);
59
+ const algorithms = options && validateAlgorithms('algorithms', options.algorithms);
62
60
  if (algorithms && !algorithms.has(alg)) {
63
61
  throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');
64
62
  }
@@ -1,4 +1,5 @@
1
1
  import { JOSENotSupported } from '../util/errors.js';
2
+ import random from '../runtime/random.js';
2
3
  const bitLengths = new Map([
3
4
  ['A128CBC-HS256', 256],
4
5
  ['A128GCM', 128],
@@ -7,12 +8,12 @@ const bitLengths = new Map([
7
8
  ['A256CBC-HS512', 512],
8
9
  ['A256GCM', 256],
9
10
  ]);
10
- const factory = (random) => (alg) => {
11
+ const generateCek = (alg) => {
11
12
  const bitLength = bitLengths.get(alg);
12
13
  if (!bitLength) {
13
14
  throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`);
14
15
  }
15
16
  return random(new Uint8Array(bitLength >> 3));
16
17
  };
17
- export default factory;
18
+ export default generateCek;
18
19
  export { bitLengths };
@@ -9,7 +9,7 @@ import { bitLengths as cekLengths } from '../lib/cek.js';
9
9
  import { importJWK } from '../key/import.js';
10
10
  import checkKeyType from './check_key_type.js';
11
11
  import isObject from './is_object.js';
12
- async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
12
+ async function decryptKeyManagement(alg, key, encryptedKey, joseHeader, options) {
13
13
  checkKeyType(alg, key, 'decrypt');
14
14
  switch (alg) {
15
15
  case 'dir': {
@@ -63,6 +63,9 @@ async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
63
63
  throw new JWEInvalid('JWE Encrypted Key missing');
64
64
  if (typeof joseHeader.p2c !== 'number')
65
65
  throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);
66
+ const p2cLimit = (options === null || options === void 0 ? void 0 : options.maxPBES2Count) || 10000;
67
+ if (joseHeader.p2c > p2cLimit)
68
+ throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);
66
69
  if (typeof joseHeader.p2s !== 'string')
67
70
  throw new JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);
68
71
  return pbes2Kw(alg, key, encryptedKey, joseHeader.p2c, base64url(joseHeader.p2s));
@@ -1,15 +1,13 @@
1
- import random from '../runtime/random.js';
2
1
  import { wrap as aesKw } from '../runtime/aeskw.js';
3
2
  import * as ECDH from '../runtime/ecdhes.js';
4
3
  import { encrypt as pbes2Kw } from '../runtime/pbes2kw.js';
5
4
  import { encrypt as rsaEs } from '../runtime/rsaes.js';
6
5
  import { wrap as aesGcmKw } from '../runtime/aesgcmkw.js';
7
6
  import { encode as base64url } from '../runtime/base64url.js';
8
- import cekFactory, { bitLengths as cekLengths } from '../lib/cek.js';
7
+ import generateCek, { bitLengths as cekLengths } from '../lib/cek.js';
9
8
  import { JOSENotSupported } from '../util/errors.js';
10
9
  import { exportJWK } from '../key/export.js';
11
10
  import checkKeyType from './check_key_type.js';
12
- const generateCek = cekFactory(random);
13
11
  async function encryptKeyManagement(alg, enc, key, providedCek, providedParameters = {}) {
14
12
  let encryptedKey;
15
13
  let parameters;
@@ -1,4 +1,5 @@
1
1
  import { JOSENotSupported } from '../util/errors.js';
2
+ import random from '../runtime/random.js';
2
3
  const bitLengths = new Map([
3
4
  ['A128CBC-HS256', 128],
4
5
  ['A128GCM', 96],
@@ -10,12 +11,12 @@ const bitLengths = new Map([
10
11
  ['A256GCM', 96],
11
12
  ['A256GCMKW', 96],
12
13
  ]);
13
- const factory = (random) => (alg) => {
14
+ const generateIv = (alg) => {
14
15
  const bitLength = bitLengths.get(alg);
15
16
  if (!bitLength) {
16
17
  throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`);
17
18
  }
18
19
  return random(new Uint8Array(bitLength >> 3));
19
20
  };
20
- export default factory;
21
+ export default generateIv;
21
22
  export { bitLengths };
@@ -1,9 +1,7 @@
1
1
  import encrypt from './encrypt.js';
2
2
  import decrypt from './decrypt.js';
3
- import ivFactory from '../lib/iv.js';
4
- import random from './random.js';
3
+ import generateIv from '../lib/iv.js';
5
4
  import { encode as base64url } from './base64url.js';
6
- const generateIv = ivFactory(random);
7
5
  export const wrap = async (alg, key, cek, iv) => {
8
6
  const jweAlgorithm = alg.substr(0, 7);
9
7
  iv || (iv = generateIv(jweAlgorithm));
@@ -1,2 +1 @@
1
- import { randomFillSync } from 'crypto';
2
- export default randomFillSync;
1
+ export { randomFillSync as default } from 'crypto';
@@ -2,114 +2,146 @@ export class JOSEError extends Error {
2
2
  constructor(message) {
3
3
  var _a;
4
4
  super(message);
5
- this.code = JOSEError.code;
5
+ this.code = 'ERR_JOSE_GENERIC';
6
6
  this.name = this.constructor.name;
7
7
  (_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
8
8
  }
9
+ static get code() {
10
+ return 'ERR_JOSE_GENERIC';
11
+ }
9
12
  }
10
- JOSEError.code = 'ERR_JOSE_GENERIC';
11
13
  export class JWTClaimValidationFailed extends JOSEError {
12
14
  constructor(message, claim = 'unspecified', reason = 'unspecified') {
13
15
  super(message);
14
- this.code = JWTClaimValidationFailed.code;
16
+ this.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';
17
+ this.claim = claim;
18
+ this.reason = reason;
19
+ }
20
+ static get code() {
21
+ return 'ERR_JWT_CLAIM_VALIDATION_FAILED';
22
+ }
23
+ }
24
+ export class JWTExpired extends JOSEError {
25
+ constructor(message, claim = 'unspecified', reason = 'unspecified') {
26
+ super(message);
27
+ this.code = 'ERR_JWT_EXPIRED';
15
28
  this.claim = claim;
16
29
  this.reason = reason;
17
30
  }
31
+ static get code() {
32
+ return 'ERR_JWT_EXPIRED';
33
+ }
18
34
  }
19
- JWTClaimValidationFailed.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';
20
35
  export class JOSEAlgNotAllowed extends JOSEError {
21
36
  constructor() {
22
37
  super(...arguments);
23
- this.code = JOSEAlgNotAllowed.code;
38
+ this.code = 'ERR_JOSE_ALG_NOT_ALLOWED';
39
+ }
40
+ static get code() {
41
+ return 'ERR_JOSE_ALG_NOT_ALLOWED';
24
42
  }
25
43
  }
26
- JOSEAlgNotAllowed.code = 'ERR_JOSE_ALG_NOT_ALLOWED';
27
44
  export class JOSENotSupported extends JOSEError {
28
45
  constructor() {
29
46
  super(...arguments);
30
- this.code = JOSENotSupported.code;
47
+ this.code = 'ERR_JOSE_NOT_SUPPORTED';
48
+ }
49
+ static get code() {
50
+ return 'ERR_JOSE_NOT_SUPPORTED';
31
51
  }
32
52
  }
33
- JOSENotSupported.code = 'ERR_JOSE_NOT_SUPPORTED';
34
53
  export class JWEDecryptionFailed extends JOSEError {
35
54
  constructor() {
36
55
  super(...arguments);
37
- this.code = JWEDecryptionFailed.code;
56
+ this.code = 'ERR_JWE_DECRYPTION_FAILED';
38
57
  this.message = 'decryption operation failed';
39
58
  }
59
+ static get code() {
60
+ return 'ERR_JWE_DECRYPTION_FAILED';
61
+ }
40
62
  }
41
- JWEDecryptionFailed.code = 'ERR_JWE_DECRYPTION_FAILED';
42
63
  export class JWEInvalid extends JOSEError {
43
64
  constructor() {
44
65
  super(...arguments);
45
- this.code = JWEInvalid.code;
66
+ this.code = 'ERR_JWE_INVALID';
67
+ }
68
+ static get code() {
69
+ return 'ERR_JWE_INVALID';
46
70
  }
47
71
  }
48
- JWEInvalid.code = 'ERR_JWE_INVALID';
49
72
  export class JWSInvalid extends JOSEError {
50
73
  constructor() {
51
74
  super(...arguments);
52
- this.code = JWSInvalid.code;
75
+ this.code = 'ERR_JWS_INVALID';
76
+ }
77
+ static get code() {
78
+ return 'ERR_JWS_INVALID';
53
79
  }
54
80
  }
55
- JWSInvalid.code = 'ERR_JWS_INVALID';
56
81
  export class JWTInvalid extends JOSEError {
57
82
  constructor() {
58
83
  super(...arguments);
59
- this.code = JWTInvalid.code;
84
+ this.code = 'ERR_JWT_INVALID';
85
+ }
86
+ static get code() {
87
+ return 'ERR_JWT_INVALID';
60
88
  }
61
89
  }
62
- JWTInvalid.code = 'ERR_JWT_INVALID';
63
90
  export class JWKInvalid extends JOSEError {
64
91
  constructor() {
65
92
  super(...arguments);
66
- this.code = JWKInvalid.code;
93
+ this.code = 'ERR_JWK_INVALID';
94
+ }
95
+ static get code() {
96
+ return 'ERR_JWK_INVALID';
67
97
  }
68
98
  }
69
- JWKInvalid.code = 'ERR_JWK_INVALID';
70
99
  export class JWKSInvalid extends JOSEError {
71
100
  constructor() {
72
101
  super(...arguments);
73
- this.code = JWKSInvalid.code;
102
+ this.code = 'ERR_JWKS_INVALID';
103
+ }
104
+ static get code() {
105
+ return 'ERR_JWKS_INVALID';
74
106
  }
75
107
  }
76
- JWKSInvalid.code = 'ERR_JWKS_INVALID';
77
108
  export class JWKSNoMatchingKey extends JOSEError {
78
109
  constructor() {
79
110
  super(...arguments);
80
- this.code = JWKSNoMatchingKey.code;
111
+ this.code = 'ERR_JWKS_NO_MATCHING_KEY';
81
112
  this.message = 'no applicable key found in the JSON Web Key Set';
82
113
  }
114
+ static get code() {
115
+ return 'ERR_JWKS_NO_MATCHING_KEY';
116
+ }
83
117
  }
84
- JWKSNoMatchingKey.code = 'ERR_JWKS_NO_MATCHING_KEY';
85
118
  export class JWKSMultipleMatchingKeys extends JOSEError {
86
119
  constructor() {
87
120
  super(...arguments);
88
- this.code = JWKSMultipleMatchingKeys.code;
121
+ this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
89
122
  this.message = 'multiple matching keys found in the JSON Web Key Set';
90
123
  }
124
+ static get code() {
125
+ return 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
126
+ }
91
127
  }
92
- JWKSMultipleMatchingKeys.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
93
128
  export class JWKSTimeout extends JOSEError {
94
129
  constructor() {
95
130
  super(...arguments);
96
- this.code = JWKSTimeout.code;
131
+ this.code = 'ERR_JWKS_TIMEOUT';
97
132
  this.message = 'request timed out';
98
133
  }
134
+ static get code() {
135
+ return 'ERR_JWKS_TIMEOUT';
136
+ }
99
137
  }
100
- JWKSTimeout.code = 'ERR_JWKS_TIMEOUT';
101
138
  export class JWSSignatureVerificationFailed extends JOSEError {
102
139
  constructor() {
103
140
  super(...arguments);
104
- this.code = JWSSignatureVerificationFailed.code;
141
+ this.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
105
142
  this.message = 'signature verification failed';
106
143
  }
107
- }
108
- JWSSignatureVerificationFailed.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
109
- export class JWTExpired extends JWTClaimValidationFailed {
110
- constructor() {
111
- super(...arguments);
112
- this.code = JWTExpired.code;
144
+ static get code() {
145
+ return 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
113
146
  }
114
147
  }
115
- JWTExpired.code = 'ERR_JWT_EXPIRED';
@@ -199,6 +199,7 @@ export interface DecryptOptions extends CritOption {
199
199
  keyManagementAlgorithms?: string[]
200
200
  contentEncryptionAlgorithms?: string[]
201
201
  inflateRaw?: InflateFunction
202
+ maxPBES2Count?: number
202
203
  }
203
204
  export interface EncryptOptions extends CritOption {
204
205
  deflateRaw?: DeflateFunction
@@ -1,69 +1,72 @@
1
1
  export declare class JOSEError extends Error {
2
- static code: string;
2
+ static get code(): string;
3
3
  code: string;
4
4
  constructor(message?: string);
5
5
  }
6
6
  export declare class JWTClaimValidationFailed extends JOSEError {
7
- static code: string;
7
+ static get code(): 'ERR_JWT_CLAIM_VALIDATION_FAILED';
8
+ code: string;
9
+ claim: string;
10
+ reason: string;
11
+ constructor(message: string, claim?: string, reason?: string);
12
+ }
13
+ export declare class JWTExpired extends JOSEError implements JWTClaimValidationFailed {
14
+ static get code(): 'ERR_JWT_EXPIRED';
8
15
  code: string;
9
16
  claim: string;
10
17
  reason: string;
11
18
  constructor(message: string, claim?: string, reason?: string);
12
19
  }
13
20
  export declare class JOSEAlgNotAllowed extends JOSEError {
14
- static code: string;
21
+ static get code(): 'ERR_JOSE_ALG_NOT_ALLOWED';
15
22
  code: string;
16
23
  }
17
24
  export declare class JOSENotSupported extends JOSEError {
18
- static code: string;
25
+ static get code(): 'ERR_JOSE_NOT_SUPPORTED';
19
26
  code: string;
20
27
  }
21
28
  export declare class JWEDecryptionFailed extends JOSEError {
22
- static code: string;
29
+ static get code(): 'ERR_JWE_DECRYPTION_FAILED';
23
30
  code: string;
24
31
  message: string;
25
32
  }
26
33
  export declare class JWEInvalid extends JOSEError {
27
- static code: string;
34
+ static get code(): 'ERR_JWE_INVALID';
28
35
  code: string;
29
36
  }
30
37
  export declare class JWSInvalid extends JOSEError {
31
- static code: string;
38
+ static get code(): 'ERR_JWS_INVALID';
32
39
  code: string;
33
40
  }
34
41
  export declare class JWTInvalid extends JOSEError {
35
- static code: string;
42
+ static get code(): 'ERR_JWT_INVALID';
36
43
  code: string;
37
44
  }
38
45
  export declare class JWKInvalid extends JOSEError {
39
- static code: string;
46
+ static get code(): 'ERR_JWK_INVALID';
40
47
  code: string;
41
48
  }
42
49
  export declare class JWKSInvalid extends JOSEError {
43
- static code: string;
50
+ static get code(): 'ERR_JWKS_INVALID';
44
51
  code: string;
45
52
  }
46
53
  export declare class JWKSNoMatchingKey extends JOSEError {
47
- static code: string;
54
+ static get code(): 'ERR_JWKS_NO_MATCHING_KEY';
48
55
  code: string;
49
56
  message: string;
50
57
  }
51
58
  export declare class JWKSMultipleMatchingKeys extends JOSEError {
52
- static code: string;
59
+ static get code(): 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
53
60
  code: string;
54
61
  message: string;
55
62
  }
56
63
  export declare class JWKSTimeout extends JOSEError {
57
- static code: string;
64
+ static get code(): 'ERR_JWKS_TIMEOUT';
58
65
  code: string;
59
66
  message: string;
60
67
  }
61
68
  export declare class JWSSignatureVerificationFailed extends JOSEError {
62
- static code: string;
69
+ static get code(): 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
63
70
  code: string;
64
71
  message: string;
65
72
  }
66
- export declare class JWTExpired extends JWTClaimValidationFailed {
67
- static code: string;
68
- code: string;
69
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "3.20.1",
3
+ "version": "3.20.4",
4
4
  "description": "Universal 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK with no dependencies",
5
5
  "keywords": [
6
6
  "browser",
@@ -52,6 +52,7 @@
52
52
  },
53
53
  "license": "MIT",
54
54
  "author": "Filip Skokan <panva.ip@gmail.com>",
55
+ "sideEffects": false,
55
56
  "exports": {
56
57
  "./package.json": "./package.json",
57
58
  "./jwe/compact/decrypt": {