jose 4.10.3 → 4.11.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # jose
2
2
 
3
- > "JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, and other Web-interoperable runtimes.
3
+ > "JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes.
4
4
 
5
5
  ## Implemented specs & features
6
6
 
@@ -78,14 +78,18 @@ import * as jose from 'https://deno.land/x/jose/index.ts'
78
78
  - [Unsecured JWT](docs/classes/jwt_unsecured.UnsecuredJWT.md#readme)
79
79
  - [JOSE Errors](docs/modules/util_errors.md#readme)
80
80
 
81
- ## Supported Runtimes, Environments, Platforms
81
+ ## Supported Runtimes
82
82
 
83
- - [Browser Support][]
84
- - [Cloudflare Workers Support][]
85
- - [Deno Support][]
86
- - [Electron Support][]
87
- - [Next.js Middleware / Vercel Edge Functions Support][]
88
- - [Node.js Support][]
83
+ The supported JavaScript runtimes include ones that support the utilized Web API globals and standard built-in objects or are Node.js
84
+
85
+ These are _(this is not an exhaustive list)_:
86
+ - [Bun](https://github.com/panva/jose/issues/471)
87
+ - [Browsers](https://github.com/panva/jose/issues/263)
88
+ - [Cloudflare Workers](https://github.com/panva/jose/issues/265)
89
+ - [Deno](https://github.com/panva/jose/issues/266)
90
+ - [Electron](https://github.com/panva/jose/issues/264)
91
+ - [Node.js](https://github.com/panva/jose/issues/262)
92
+ - [Vercel's Edge Runtime](https://github.com/panva/jose/issues/301)
89
93
 
90
94
  ## FAQ
91
95
 
@@ -109,8 +113,6 @@ multiple times so that it can remain truly without dependencies and be universal
109
113
  Nevertheless, since each module can be required independently and is fully tree-shakeable, the
110
114
  install size should not be a cause for concern.
111
115
 
112
- [documentation]: /docs/README.md
113
- [node-jose]: https://github.com/cisco/node-jose
114
116
  [spec-b64]: https://www.rfc-editor.org/rfc/rfc7797
115
117
  [spec-cookbook]: https://www.rfc-editor.org/rfc/rfc7520
116
118
  [spec-jwa]: https://www.rfc-editor.org/rfc/rfc7518
@@ -122,15 +124,3 @@ install size should not be a cause for concern.
122
124
  [spec-secp256k1]: https://www.rfc-editor.org/rfc/rfc8812
123
125
  [spec-thumbprint]: https://www.rfc-editor.org/rfc/rfc7638
124
126
  [spec-thumbprint-uri]: https://www.rfc-editor.org/rfc/rfc9278
125
- [support-sponsor]: https://github.com/sponsors/panva
126
- [conditional-exports]: https://nodejs.org/api/packages.html#packages_conditional_exports
127
- [webcrypto]: https://www.w3.org/TR/WebCryptoAPI/
128
- [nodewebcrypto]: https://nodejs.org/docs/latest-v15.x/api/webcrypto.html
129
- [deno.land/x/jose]: https://deno.land/x/jose
130
-
131
- [Browser Support]: https://github.com/panva/jose/issues/263
132
- [Cloudflare Workers Support]: https://github.com/panva/jose/issues/265
133
- [Deno Support]: https://github.com/panva/jose/issues/266
134
- [Electron Support]: https://github.com/panva/jose/issues/264
135
- [Next.js Middleware / Vercel Edge Functions Support]: https://github.com/panva/jose/issues/301
136
- [Node.js Support]: https://github.com/panva/jose/issues/262
@@ -94,11 +94,12 @@ export async function importX509(x509, alg, options) {
94
94
  }
95
95
  export async function importPKCS8(pkcs8, alg, options) {
96
96
  if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {
97
- throw new TypeError('"pkcs8" must be PCKS8 formatted string');
97
+ throw new TypeError('"pkcs8" must be PKCS8 formatted string');
98
98
  }
99
99
  return importPrivate(pkcs8, alg, options);
100
100
  }
101
101
  export async function importJWK(jwk, alg, octAsKeyObject) {
102
+ var _a;
102
103
  if (!isObject(jwk)) {
103
104
  throw new TypeError('JWK must be an object');
104
105
  }
@@ -113,7 +114,7 @@ export async function importJWK(jwk, alg, octAsKeyObject) {
113
114
  }
114
115
  octAsKeyObject !== null && octAsKeyObject !== void 0 ? octAsKeyObject : (octAsKeyObject = jwk.ext !== true);
115
116
  if (octAsKeyObject) {
116
- return asKeyObject({ ...jwk, alg, ext: false });
117
+ return asKeyObject({ ...jwk, alg, ext: (_a = jwk.ext) !== null && _a !== void 0 ? _a : false });
117
118
  }
118
119
  return decodeBase64URL(jwk.k);
119
120
  case 'RSA':
@@ -148,6 +148,7 @@ const parse = async (jwk) => {
148
148
  }
149
149
  const keyData = { ...jwk };
150
150
  delete keyData.alg;
151
+ delete keyData.use;
151
152
  return crypto.subtle.importKey('jwk', keyData, ...rest);
152
153
  };
153
154
  export default parse;
@@ -99,12 +99,13 @@ async function importX509(x509, alg, options) {
99
99
  exports.importX509 = importX509;
100
100
  async function importPKCS8(pkcs8, alg, options) {
101
101
  if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {
102
- throw new TypeError('"pkcs8" must be PCKS8 formatted string');
102
+ throw new TypeError('"pkcs8" must be PKCS8 formatted string');
103
103
  }
104
104
  return (0, asn1_js_2.fromPKCS8)(pkcs8, alg, options);
105
105
  }
106
106
  exports.importPKCS8 = importPKCS8;
107
107
  async function importJWK(jwk, alg, octAsKeyObject) {
108
+ var _a;
108
109
  if (!(0, is_object_js_1.default)(jwk)) {
109
110
  throw new TypeError('JWK must be an object');
110
111
  }
@@ -119,7 +120,7 @@ async function importJWK(jwk, alg, octAsKeyObject) {
119
120
  }
120
121
  octAsKeyObject !== null && octAsKeyObject !== void 0 ? octAsKeyObject : (octAsKeyObject = jwk.ext !== true);
121
122
  if (octAsKeyObject) {
122
- return (0, jwk_to_key_js_1.default)({ ...jwk, alg, ext: false });
123
+ return (0, jwk_to_key_js_1.default)({ ...jwk, alg, ext: (_a = jwk.ext) !== null && _a !== void 0 ? _a : false });
123
124
  }
124
125
  return (0, base64url_js_1.decode)(jwk.k);
125
126
  case 'RSA':
@@ -94,11 +94,12 @@ export async function importX509(x509, alg, options) {
94
94
  }
95
95
  export async function importPKCS8(pkcs8, alg, options) {
96
96
  if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {
97
- throw new TypeError('"pkcs8" must be PCKS8 formatted string');
97
+ throw new TypeError('"pkcs8" must be PKCS8 formatted string');
98
98
  }
99
99
  return importPrivate(pkcs8, alg, options);
100
100
  }
101
101
  export async function importJWK(jwk, alg, octAsKeyObject) {
102
+ var _a;
102
103
  if (!isObject(jwk)) {
103
104
  throw new TypeError('JWK must be an object');
104
105
  }
@@ -113,7 +114,7 @@ export async function importJWK(jwk, alg, octAsKeyObject) {
113
114
  }
114
115
  octAsKeyObject !== null && octAsKeyObject !== void 0 ? octAsKeyObject : (octAsKeyObject = jwk.ext !== true);
115
116
  if (octAsKeyObject) {
116
- return asKeyObject({ ...jwk, alg, ext: false });
117
+ return asKeyObject({ ...jwk, alg, ext: (_a = jwk.ext) !== null && _a !== void 0 ? _a : false });
117
118
  }
118
119
  return decodeBase64URL(jwk.k);
119
120
  case 'RSA':
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "4.10.3",
4
- "description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, and other Web-interoperable runtimes",
3
+ "version": "4.11.0",
4
+ "description": "'JSON Web Almost Everything' - 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",
7
+ "bun",
7
8
  "cloudflare",
8
9
  "compact",
9
10
  "decode",
@@ -13,6 +14,7 @@
13
14
  "ec",
14
15
  "ecdsa",
15
16
  "eddsa",
17
+ "edge",
16
18
  "electron",
17
19
  "embedded",
18
20
  "encrypt",
@@ -28,6 +30,9 @@
28
30
  "jwks",
29
31
  "jws",
30
32
  "jwt",
33
+ "netlify",
34
+ "next",
35
+ "nextjs",
31
36
  "oct",
32
37
  "okp",
33
38
  "payload",
@@ -40,6 +45,7 @@
40
45
  "spki",
41
46
  "universal",
42
47
  "validate",
48
+ "vercel",
43
49
  "verify",
44
50
  "webcrypto",
45
51
  "workers",
@@ -56,6 +62,7 @@
56
62
  "exports": {
57
63
  ".": {
58
64
  "types": "./dist/types/index.d.ts",
65
+ "bun": "./dist/browser/index.js",
59
66
  "deno": "./dist/browser/index.js",
60
67
  "browser": "./dist/browser/index.js",
61
68
  "worker": "./dist/browser/index.js",