jose 4.0.4 → 4.1.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.
Files changed (62) hide show
  1. package/dist/browser/{runtime → lib}/aesgcmkw.js +8 -8
  2. package/dist/browser/lib/check_key_type.js +1 -1
  3. package/dist/browser/lib/crypto_key.js +46 -56
  4. package/dist/browser/lib/decrypt_key_management.js +1 -1
  5. package/dist/browser/lib/encrypt_key_management.js +1 -1
  6. package/dist/browser/{runtime → lib}/invalid_key_input.js +0 -0
  7. package/dist/browser/runtime/aeskw.js +1 -1
  8. package/dist/browser/runtime/asn1.js +6 -7
  9. package/dist/browser/runtime/base64url.js +2 -4
  10. package/dist/browser/runtime/bogus.js +1 -1
  11. package/dist/browser/runtime/decrypt.js +2 -2
  12. package/dist/browser/runtime/ecdhes.js +1 -1
  13. package/dist/browser/runtime/encrypt.js +2 -2
  14. package/dist/browser/runtime/env.js +11 -0
  15. package/dist/browser/runtime/fetch_jwks.js +3 -5
  16. package/dist/browser/runtime/generate.js +5 -5
  17. package/dist/browser/runtime/get_sign_verify_key.js +2 -2
  18. package/dist/browser/runtime/jwk_to_key.js +5 -5
  19. package/dist/browser/runtime/key_to_jwk.js +1 -1
  20. package/dist/browser/runtime/pbes2kw.js +11 -34
  21. package/dist/browser/runtime/rsaes.js +1 -1
  22. package/dist/browser/runtime/subtle_dsa.js +8 -27
  23. package/dist/browser/runtime/webcrypto.js +8 -4
  24. package/dist/node/cjs/{runtime → lib}/aesgcmkw.js +8 -8
  25. package/dist/node/cjs/lib/check_key_type.js +1 -1
  26. package/dist/node/cjs/lib/crypto_key.js +48 -58
  27. package/dist/node/cjs/lib/decrypt_key_management.js +1 -1
  28. package/dist/node/cjs/lib/encrypt_key_management.js +1 -1
  29. package/dist/node/cjs/{runtime → lib}/invalid_key_input.js +0 -11
  30. package/dist/node/cjs/runtime/aeskw.js +1 -1
  31. package/dist/node/cjs/runtime/asn1.js +1 -1
  32. package/dist/node/cjs/runtime/decrypt.js +1 -1
  33. package/dist/node/cjs/runtime/ecdhes.js +1 -1
  34. package/dist/node/cjs/runtime/encrypt.js +1 -1
  35. package/dist/node/cjs/runtime/{global.js → env.js} +0 -0
  36. package/dist/node/cjs/runtime/get_named_curve.js +1 -1
  37. package/dist/node/cjs/runtime/get_sign_verify_key.js +1 -1
  38. package/dist/node/cjs/runtime/key_to_jwk.js +1 -1
  39. package/dist/node/cjs/runtime/node_key.js +6 -10
  40. package/dist/node/cjs/runtime/pbes2kw.js +1 -1
  41. package/dist/node/cjs/runtime/rsaes.js +1 -1
  42. package/dist/node/esm/{runtime → lib}/aesgcmkw.js +8 -8
  43. package/dist/node/esm/lib/check_key_type.js +1 -1
  44. package/dist/node/esm/lib/crypto_key.js +46 -56
  45. package/dist/node/esm/lib/decrypt_key_management.js +1 -1
  46. package/dist/node/esm/lib/encrypt_key_management.js +1 -1
  47. package/dist/node/esm/{runtime → lib}/invalid_key_input.js +0 -11
  48. package/dist/node/esm/runtime/aeskw.js +1 -1
  49. package/dist/node/esm/runtime/asn1.js +1 -1
  50. package/dist/node/esm/runtime/decrypt.js +1 -1
  51. package/dist/node/esm/runtime/ecdhes.js +1 -1
  52. package/dist/node/esm/runtime/encrypt.js +1 -1
  53. package/dist/node/esm/runtime/{global.js → env.js} +0 -0
  54. package/dist/node/esm/runtime/get_named_curve.js +1 -1
  55. package/dist/node/esm/runtime/get_sign_verify_key.js +1 -1
  56. package/dist/node/esm/runtime/key_to_jwk.js +1 -1
  57. package/dist/node/esm/runtime/node_key.js +6 -10
  58. package/dist/node/esm/runtime/pbes2kw.js +1 -1
  59. package/dist/node/esm/runtime/rsaes.js +1 -1
  60. package/dist/types/jwks/remote.d.ts +4 -0
  61. package/package.json +4 -1
  62. package/dist/browser/runtime/global.js +0 -27
@@ -1,6 +1,12 @@
1
- import { isCloudflareWorkers, isNodeJs } from '../runtime/global.js';
1
+ import { isCloudflareWorkers, isNodeJs } from '../runtime/env.js';
2
+ function unusable(name, prop = 'algorithm.name') {
3
+ return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
4
+ }
5
+ function isAlgorithm(algorithm, name) {
6
+ return algorithm.name === name;
7
+ }
2
8
  function getHashLength(hash) {
3
- return parseInt(hash === null || hash === void 0 ? void 0 : hash.name.substr(4), 10);
9
+ return parseInt(hash.name.substr(4), 10);
4
10
  }
5
11
  function getNamedCurve(alg) {
6
12
  switch (alg) {
@@ -10,6 +16,8 @@ function getNamedCurve(alg) {
10
16
  return 'P-384';
11
17
  case 'ES512':
12
18
  return 'P-521';
19
+ default:
20
+ throw new Error('unreachable');
13
21
  }
14
22
  }
15
23
  function checkUsage(key, usages) {
@@ -33,65 +41,55 @@ export function checkSigCryptoKey(key, alg, ...usages) {
33
41
  case 'HS256':
34
42
  case 'HS384':
35
43
  case 'HS512': {
36
- if (key.algorithm.name !== 'HMAC') {
37
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be HMAC.`);
38
- }
44
+ if (!isAlgorithm(key.algorithm, 'HMAC'))
45
+ throw unusable('HMAC');
39
46
  const expected = parseInt(alg.substr(2), 10);
40
47
  const actual = getHashLength(key.algorithm.hash);
41
- if (actual !== expected) {
42
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.hash must be SHA-${expected}.`);
43
- }
48
+ if (actual !== expected)
49
+ throw unusable(`SHA-${expected}`, 'algorithm.hash');
44
50
  break;
45
51
  }
46
52
  case 'RS256':
47
53
  case 'RS384':
48
54
  case 'RS512': {
49
- if (key.algorithm.name !== 'RSASSA-PKCS1-v1_5') {
50
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be RSASSA-PKCS1-v1_5.`);
51
- }
55
+ if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5'))
56
+ throw unusable('RSASSA-PKCS1-v1_5');
52
57
  const expected = parseInt(alg.substr(2), 10);
53
58
  const actual = getHashLength(key.algorithm.hash);
54
- if (actual !== expected) {
55
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.hash must be SHA-${expected}.`);
56
- }
59
+ if (actual !== expected)
60
+ throw unusable(`SHA-${expected}`, 'algorithm.hash');
57
61
  break;
58
62
  }
59
63
  case 'PS256':
60
64
  case 'PS384':
61
65
  case 'PS512': {
62
- if (key.algorithm.name !== 'RSA-PSS') {
63
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be RSA-PSS.`);
64
- }
66
+ if (!isAlgorithm(key.algorithm, 'RSA-PSS'))
67
+ throw unusable('RSA-PSS');
65
68
  const expected = parseInt(alg.substr(2), 10);
66
69
  const actual = getHashLength(key.algorithm.hash);
67
- if (actual !== expected) {
68
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.hash must be SHA-${expected}.`);
69
- }
70
+ if (actual !== expected)
71
+ throw unusable(`SHA-${expected}`, 'algorithm.hash');
70
72
  break;
71
73
  }
72
74
  case isNodeJs() && 'EdDSA': {
73
- if (key.algorithm.name !== 'NODE-ED25519' && key.algorithm.name !== 'NODE-ED448') {
74
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be NODE-ED25519 or NODE-ED448.`);
75
- }
75
+ if (key.algorithm.name !== 'NODE-ED25519' && key.algorithm.name !== 'NODE-ED448')
76
+ throw unusable('NODE-ED25519 or NODE-ED448');
76
77
  break;
77
78
  }
78
79
  case isCloudflareWorkers() && 'EdDSA': {
79
- if (key.algorithm.name !== 'NODE-ED25519') {
80
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be NODE-ED25519.`);
81
- }
80
+ if (!isAlgorithm(key.algorithm, 'NODE-ED25519'))
81
+ throw unusable('NODE-ED25519');
82
82
  break;
83
83
  }
84
84
  case 'ES256':
85
85
  case 'ES384':
86
86
  case 'ES512': {
87
- if (key.algorithm.name !== 'ECDSA') {
88
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be ECDSA.`);
89
- }
87
+ if (!isAlgorithm(key.algorithm, 'ECDSA'))
88
+ throw unusable('ECDSA');
90
89
  const expected = getNamedCurve(alg);
91
90
  const actual = key.algorithm.namedCurve;
92
- if (actual !== expected) {
93
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.namedCurve must be ${expected}.`);
94
- }
91
+ if (actual !== expected)
92
+ throw unusable(expected, 'algorithm.namedCurve');
95
93
  break;
96
94
  }
97
95
  default:
@@ -104,53 +102,45 @@ export function checkEncCryptoKey(key, alg, ...usages) {
104
102
  case 'A128GCM':
105
103
  case 'A192GCM':
106
104
  case 'A256GCM': {
107
- if (key.algorithm.name !== 'AES-GCM') {
108
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be AES-GCM.`);
109
- }
105
+ if (!isAlgorithm(key.algorithm, 'AES-GCM'))
106
+ throw unusable('AES-GCM');
110
107
  const expected = parseInt(alg.substr(1, 3), 10);
111
108
  const actual = key.algorithm.length;
112
- if (actual !== expected) {
113
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.length must be ${expected}.`);
114
- }
109
+ if (actual !== expected)
110
+ throw unusable(expected, 'algorithm.length');
115
111
  break;
116
112
  }
117
113
  case 'A128KW':
118
114
  case 'A192KW':
119
115
  case 'A256KW': {
120
- if (key.algorithm.name !== 'AES-KW') {
121
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be AES-KW.`);
122
- }
116
+ if (!isAlgorithm(key.algorithm, 'AES-KW'))
117
+ throw unusable('AES-KW');
123
118
  const expected = parseInt(alg.substr(1, 3), 10);
124
119
  const actual = key.algorithm.length;
125
- if (actual !== expected) {
126
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.length must be ${expected}.`);
127
- }
120
+ if (actual !== expected)
121
+ throw unusable(expected, 'algorithm.length');
128
122
  break;
129
123
  }
130
124
  case 'ECDH-ES':
131
- if (key.algorithm.name !== 'ECDH') {
132
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be ECDH.`);
133
- }
125
+ if (!isAlgorithm(key.algorithm, 'ECDH'))
126
+ throw unusable('ECDH');
134
127
  break;
135
128
  case 'PBES2-HS256+A128KW':
136
129
  case 'PBES2-HS384+A192KW':
137
130
  case 'PBES2-HS512+A256KW':
138
- if (key.algorithm.name !== 'PBKDF2') {
139
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be PBKDF2.`);
140
- }
131
+ if (!isAlgorithm(key.algorithm, 'PBKDF2'))
132
+ throw unusable('PBKDF2');
141
133
  break;
142
134
  case 'RSA-OAEP':
143
135
  case 'RSA-OAEP-256':
144
136
  case 'RSA-OAEP-384':
145
137
  case 'RSA-OAEP-512': {
146
- if (key.algorithm.name !== 'RSA-OAEP') {
147
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be RSA-OAEP.`);
148
- }
138
+ if (!isAlgorithm(key.algorithm, 'RSA-OAEP'))
139
+ throw unusable('RSA-OAEP');
149
140
  const expected = parseInt(alg.substr(9), 10) || 1;
150
141
  const actual = getHashLength(key.algorithm.hash);
151
- if (actual !== expected) {
152
- throw new TypeError(`CryptoKey does not support this operation, its algorithm.hash must be SHA-${expected}.`);
153
- }
142
+ if (actual !== expected)
143
+ throw unusable(`SHA-${expected}`, 'algorithm.hash');
154
144
  break;
155
145
  }
156
146
  default:
@@ -2,13 +2,13 @@ import { unwrap as aesKw } from '../runtime/aeskw.js';
2
2
  import * as ECDH from '../runtime/ecdhes.js';
3
3
  import { decrypt as pbes2Kw } from '../runtime/pbes2kw.js';
4
4
  import { decrypt as rsaEs } from '../runtime/rsaes.js';
5
- import { unwrap as aesGcmKw } from '../runtime/aesgcmkw.js';
6
5
  import { decode as base64url } from '../runtime/base64url.js';
7
6
  import { JOSENotSupported, JWEInvalid } from '../util/errors.js';
8
7
  import { bitLength as cekLength } from '../lib/cek.js';
9
8
  import { importJWK } from '../key/import.js';
10
9
  import checkKeyType from './check_key_type.js';
11
10
  import isObject from './is_object.js';
11
+ import { unwrap as aesGcmKw } from './aesgcmkw.js';
12
12
  async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
13
13
  checkKeyType(alg, key, 'decrypt');
14
14
  switch (alg) {
@@ -2,12 +2,12 @@ import { wrap as aesKw } from '../runtime/aeskw.js';
2
2
  import * as ECDH from '../runtime/ecdhes.js';
3
3
  import { encrypt as pbes2Kw } from '../runtime/pbes2kw.js';
4
4
  import { encrypt as rsaEs } from '../runtime/rsaes.js';
5
- import { wrap as aesGcmKw } from '../runtime/aesgcmkw.js';
6
5
  import { encode as base64url } from '../runtime/base64url.js';
7
6
  import generateCek, { bitLength as cekLength } from '../lib/cek.js';
8
7
  import { JOSENotSupported } from '../util/errors.js';
9
8
  import { exportJWK } from '../key/export.js';
10
9
  import checkKeyType from './check_key_type.js';
10
+ import { wrap as aesGcmKw } from './aesgcmkw.js';
11
11
  async function encryptKeyManagement(alg, enc, key, providedCek, providedParameters = {}) {
12
12
  let encryptedKey;
13
13
  let parameters;
@@ -1,4 +1,3 @@
1
- import { inspect } from 'util';
2
1
  export default (actual, ...types) => {
3
2
  let msg = 'Key must be ';
4
3
  if (types.length > 2) {
@@ -21,16 +20,6 @@ export default (actual, ...types) => {
21
20
  if (actual.constructor && actual.constructor.name) {
22
21
  msg += ` Received an instance of ${actual.constructor.name}`;
23
22
  }
24
- else {
25
- const inspected = inspect(actual, { depth: -1 });
26
- msg += ` Received ${inspected}`;
27
- }
28
- }
29
- else {
30
- let inspected = inspect(actual, { colors: false });
31
- if (inspected.length > 25)
32
- inspected = `${inspected.slice(0, 25)}...`;
33
- msg += ` Received type ${typeof actual} (${inspected})`;
34
23
  }
35
24
  return msg;
36
25
  };
@@ -6,7 +6,7 @@ import getSecretKey from './secret_key.js';
6
6
  import { isCryptoKey } from './webcrypto.js';
7
7
  import { checkEncCryptoKey } from '../lib/crypto_key.js';
8
8
  import isKeyObject from './is_key_object.js';
9
- import invalidKeyInput from './invalid_key_input.js';
9
+ import invalidKeyInput from '../lib/invalid_key_input.js';
10
10
  import supported from './ciphers.js';
11
11
  function checkKeySize(key, alg) {
12
12
  if (key.symmetricKeySize << 3 !== parseInt(alg.substr(1, 3), 10)) {
@@ -2,7 +2,7 @@ import { createPrivateKey, createPublicKey, KeyObject } from 'crypto';
2
2
  import { Buffer } from 'buffer';
3
3
  import { isCryptoKey } from './webcrypto.js';
4
4
  import isKeyObject from './is_key_object.js';
5
- import invalidKeyInput from './invalid_key_input.js';
5
+ import invalidKeyInput from '../lib/invalid_key_input.js';
6
6
  const genericExport = (keyType, keyFormat, key) => {
7
7
  let keyObject;
8
8
  if (isCryptoKey(key)) {
@@ -8,7 +8,7 @@ import cbcTag from './cbc_tag.js';
8
8
  import { isCryptoKey } from './webcrypto.js';
9
9
  import { checkEncCryptoKey } from '../lib/crypto_key.js';
10
10
  import isKeyObject from './is_key_object.js';
11
- import invalidKeyInput from './invalid_key_input.js';
11
+ import invalidKeyInput from '../lib/invalid_key_input.js';
12
12
  import supported from './ciphers.js';
13
13
  async function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) {
14
14
  const keySize = parseInt(enc.substr(1, 3), 10);
@@ -7,7 +7,7 @@ import { JOSENotSupported } from '../util/errors.js';
7
7
  import { isCryptoKey } from './webcrypto.js';
8
8
  import { checkEncCryptoKey } from '../lib/crypto_key.js';
9
9
  import isKeyObject from './is_key_object.js';
10
- import invalidKeyInput from './invalid_key_input.js';
10
+ import invalidKeyInput from '../lib/invalid_key_input.js';
11
11
  const generateKeyPair = promisify(generateKeyPairCb);
12
12
  export const deriveKey = async (publicKee, privateKee, algorithm, keyLength, apu = new Uint8Array(0), apv = new Uint8Array(0)) => {
13
13
  let publicKey;
@@ -6,7 +6,7 @@ import cbcTag from './cbc_tag.js';
6
6
  import { isCryptoKey } from './webcrypto.js';
7
7
  import { checkEncCryptoKey } from '../lib/crypto_key.js';
8
8
  import isKeyObject from './is_key_object.js';
9
- import invalidKeyInput from './invalid_key_input.js';
9
+ import invalidKeyInput from '../lib/invalid_key_input.js';
10
10
  import { JOSENotSupported } from '../util/errors.js';
11
11
  import supported from './ciphers.js';
12
12
  async function cbcEncrypt(enc, plaintext, cek, iv, aad) {
File without changes
@@ -3,7 +3,7 @@ import { createPublicKey, KeyObject } from 'crypto';
3
3
  import { JOSENotSupported } from '../util/errors.js';
4
4
  import { isCryptoKey } from './webcrypto.js';
5
5
  import isKeyObject from './is_key_object.js';
6
- import invalidKeyInput from './invalid_key_input.js';
6
+ import invalidKeyInput from '../lib/invalid_key_input.js';
7
7
  const p256 = Buffer.from([42, 134, 72, 206, 61, 3, 1, 7]);
8
8
  const p384 = Buffer.from([43, 129, 4, 0, 34]);
9
9
  const p521 = Buffer.from([43, 129, 4, 0, 35]);
@@ -2,7 +2,7 @@ import { KeyObject } from 'crypto';
2
2
  import { isCryptoKey } from './webcrypto.js';
3
3
  import { checkSigCryptoKey } from '../lib/crypto_key.js';
4
4
  import getSecretKey from './secret_key.js';
5
- import invalidKeyInput from './invalid_key_input.js';
5
+ import invalidKeyInput from '../lib/invalid_key_input.js';
6
6
  export default function getSignVerifyKey(alg, key, usage) {
7
7
  if (key instanceof Uint8Array) {
8
8
  if (!alg.startsWith('HS')) {
@@ -5,7 +5,7 @@ import { JOSENotSupported } from '../util/errors.js';
5
5
  import getNamedCurve from './get_named_curve.js';
6
6
  import { isCryptoKey } from './webcrypto.js';
7
7
  import isKeyObject from './is_key_object.js';
8
- import invalidKeyInput from './invalid_key_input.js';
8
+ import invalidKeyInput from '../lib/invalid_key_input.js';
9
9
  const [major, minor] = process.version
10
10
  .substr(1)
11
11
  .split('.')
@@ -7,6 +7,10 @@ const [major, minor] = process.version
7
7
  .split('.')
8
8
  .map((str) => parseInt(str, 10));
9
9
  const rsaPssParams = major >= 17 || (major === 16 && minor >= 9);
10
+ const PSS = {
11
+ padding: constants.RSA_PKCS1_PSS_PADDING,
12
+ saltLength: constants.RSA_PSS_SALTLEN_DIGEST,
13
+ };
10
14
  const ecCurveAlgMap = new Map([
11
15
  ['ES256', 'P-256'],
12
16
  ['ES256K', 'secp256k1'],
@@ -46,11 +50,7 @@ export default function keyForCrypto(alg, key) {
46
50
  throw new TypeError('Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss');
47
51
  }
48
52
  checkModulusLength(key, alg);
49
- return {
50
- key,
51
- padding: constants.RSA_PKCS1_PSS_PADDING,
52
- saltLength: constants.RSA_PSS_SALTLEN_DIGEST,
53
- };
53
+ return { key, ...PSS };
54
54
  case !rsaPssParams && 'PS256':
55
55
  case !rsaPssParams && 'PS384':
56
56
  case !rsaPssParams && 'PS512':
@@ -58,11 +58,7 @@ export default function keyForCrypto(alg, key) {
58
58
  throw new TypeError('Invalid key for this operation, its asymmetricKeyType must be rsa');
59
59
  }
60
60
  checkModulusLength(key, alg);
61
- return {
62
- key,
63
- padding: constants.RSA_PKCS1_PSS_PADDING,
64
- saltLength: constants.RSA_PSS_SALTLEN_DIGEST,
65
- };
61
+ return { key, ...PSS };
66
62
  case 'ES256':
67
63
  case 'ES256K':
68
64
  case 'ES384':
@@ -8,7 +8,7 @@ import checkP2s from '../lib/check_p2s.js';
8
8
  import { isCryptoKey } from './webcrypto.js';
9
9
  import { checkEncCryptoKey } from '../lib/crypto_key.js';
10
10
  import isKeyObject from './is_key_object.js';
11
- import invalidKeyInput from './invalid_key_input.js';
11
+ import invalidKeyInput from '../lib/invalid_key_input.js';
12
12
  const pbkdf2 = promisify(pbkdf2cb);
13
13
  function getPassword(key, alg) {
14
14
  if (isKeyObject(key)) {
@@ -3,7 +3,7 @@ import checkModulusLength from './check_modulus_length.js';
3
3
  import { isCryptoKey } from './webcrypto.js';
4
4
  import { checkEncCryptoKey } from '../lib/crypto_key.js';
5
5
  import isKeyObject from './is_key_object.js';
6
- import invalidKeyInput from './invalid_key_input.js';
6
+ import invalidKeyInput from '../lib/invalid_key_input.js';
7
7
  const checkKey = (key, alg) => {
8
8
  if (key.asymmetricKeyType !== 'rsa') {
9
9
  throw new TypeError('Invalid key for this operation, its asymmetricKeyType must be rsa');
@@ -4,4 +4,8 @@ export interface RemoteJWKSetOptions {
4
4
  cooldownDuration?: number;
5
5
  agent?: any;
6
6
  }
7
+ interface URL {
8
+ href: string;
9
+ }
7
10
  export declare function createRemoteJWKSet(url: URL, options?: RemoteJWKSetOptions): GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput>;
11
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "4.0.4",
3
+ "version": "4.1.3",
4
4
  "description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto",
5
5
  "keywords": [
6
6
  "browser",
@@ -68,6 +68,9 @@
68
68
  "dist/**/package.json",
69
69
  "dist/**/*.js",
70
70
  "dist/types/**/*.d.ts",
71
+ "!dist/**/*.bundle.js",
72
+ "!dist/**/*.umd.js",
73
+ "!dist/**/*.min.js",
71
74
  "!dist/node/webcrypto/**/*",
72
75
  "!dist/types/runtime/*",
73
76
  "!dist/types/lib/*"
@@ -1,27 +0,0 @@
1
- function getGlobal() {
2
- if (typeof globalThis !== 'undefined')
3
- return globalThis;
4
- if (typeof self !== 'undefined')
5
- return self;
6
- if (typeof window !== 'undefined')
7
- return window;
8
- throw new Error('unable to locate global object');
9
- }
10
- export default getGlobal();
11
- export function isCloudflareWorkers() {
12
- try {
13
- return getGlobal().WebSocketPair !== undefined;
14
- }
15
- catch (_a) {
16
- return false;
17
- }
18
- }
19
- export function isNodeJs() {
20
- var _a, _b;
21
- try {
22
- return ((_b = (_a = getGlobal().process) === null || _a === void 0 ? void 0 : _a.versions) === null || _b === void 0 ? void 0 : _b.node) !== undefined;
23
- }
24
- catch (_c) {
25
- return false;
26
- }
27
- }