jose 4.13.0 → 4.13.1

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
@@ -38,7 +38,7 @@ const jose = require('jose')
38
38
 
39
39
  **`example`** Deno import
40
40
  ```js
41
- import * as jose from 'https://deno.land/x/jose@v4.13.0/index.ts'
41
+ import * as jose from 'https://deno.land/x/jose@v4.13.1/index.ts'
42
42
  ```
43
43
 
44
44
  - JSON Web Tokens (JWT)
@@ -46,33 +46,21 @@ class RemoteJWKSet extends LocalJWKSet {
46
46
  }
47
47
  async reload() {
48
48
  if (this._pendingFetch && isCloudflareWorkers()) {
49
- return new Promise((resolve) => {
50
- const isDone = () => {
51
- if (this._pendingFetch === undefined) {
52
- resolve();
53
- }
54
- else {
55
- setTimeout(isDone, 5);
56
- }
57
- };
58
- isDone();
59
- });
60
- }
61
- if (!this._pendingFetch) {
62
- this._pendingFetch = fetchJwks(this._url, this._timeoutDuration, this._options)
63
- .then((json) => {
64
- if (!isJWKSLike(json)) {
65
- throw new JWKSInvalid('JSON Web Key Set malformed');
66
- }
67
- this._jwks = { keys: json.keys };
68
- this._jwksTimestamp = Date.now();
69
- this._pendingFetch = undefined;
70
- })
71
- .catch((err) => {
72
- this._pendingFetch = undefined;
73
- throw err;
74
- });
49
+ this._pendingFetch = undefined;
75
50
  }
51
+ this._pendingFetch || (this._pendingFetch = fetchJwks(this._url, this._timeoutDuration, this._options)
52
+ .then((json) => {
53
+ if (!isJWKSLike(json)) {
54
+ throw new JWKSInvalid('JSON Web Key Set malformed');
55
+ }
56
+ this._jwks = { keys: json.keys };
57
+ this._jwksTimestamp = Date.now();
58
+ this._pendingFetch = undefined;
59
+ })
60
+ .catch((err) => {
61
+ this._pendingFetch = undefined;
62
+ throw err;
63
+ }));
76
64
  await this._pendingFetch;
77
65
  }
78
66
  }
@@ -49,33 +49,21 @@ class RemoteJWKSet extends local_js_1.LocalJWKSet {
49
49
  }
50
50
  async reload() {
51
51
  if (this._pendingFetch && (0, env_js_1.isCloudflareWorkers)()) {
52
- return new Promise((resolve) => {
53
- const isDone = () => {
54
- if (this._pendingFetch === undefined) {
55
- resolve();
56
- }
57
- else {
58
- setTimeout(isDone, 5);
59
- }
60
- };
61
- isDone();
62
- });
63
- }
64
- if (!this._pendingFetch) {
65
- this._pendingFetch = (0, fetch_jwks_js_1.default)(this._url, this._timeoutDuration, this._options)
66
- .then((json) => {
67
- if (!(0, local_js_1.isJWKSLike)(json)) {
68
- throw new errors_js_1.JWKSInvalid('JSON Web Key Set malformed');
69
- }
70
- this._jwks = { keys: json.keys };
71
- this._jwksTimestamp = Date.now();
72
- this._pendingFetch = undefined;
73
- })
74
- .catch((err) => {
75
- this._pendingFetch = undefined;
76
- throw err;
77
- });
52
+ this._pendingFetch = undefined;
78
53
  }
54
+ this._pendingFetch || (this._pendingFetch = (0, fetch_jwks_js_1.default)(this._url, this._timeoutDuration, this._options)
55
+ .then((json) => {
56
+ if (!(0, local_js_1.isJWKSLike)(json)) {
57
+ throw new errors_js_1.JWKSInvalid('JSON Web Key Set malformed');
58
+ }
59
+ this._jwks = { keys: json.keys };
60
+ this._jwksTimestamp = Date.now();
61
+ this._pendingFetch = undefined;
62
+ })
63
+ .catch((err) => {
64
+ this._pendingFetch = undefined;
65
+ throw err;
66
+ }));
79
67
  await this._pendingFetch;
80
68
  }
81
69
  }
@@ -46,33 +46,21 @@ class RemoteJWKSet extends LocalJWKSet {
46
46
  }
47
47
  async reload() {
48
48
  if (this._pendingFetch && isCloudflareWorkers()) {
49
- return new Promise((resolve) => {
50
- const isDone = () => {
51
- if (this._pendingFetch === undefined) {
52
- resolve();
53
- }
54
- else {
55
- setTimeout(isDone, 5);
56
- }
57
- };
58
- isDone();
59
- });
60
- }
61
- if (!this._pendingFetch) {
62
- this._pendingFetch = fetchJwks(this._url, this._timeoutDuration, this._options)
63
- .then((json) => {
64
- if (!isJWKSLike(json)) {
65
- throw new JWKSInvalid('JSON Web Key Set malformed');
66
- }
67
- this._jwks = { keys: json.keys };
68
- this._jwksTimestamp = Date.now();
69
- this._pendingFetch = undefined;
70
- })
71
- .catch((err) => {
72
- this._pendingFetch = undefined;
73
- throw err;
74
- });
49
+ this._pendingFetch = undefined;
75
50
  }
51
+ this._pendingFetch || (this._pendingFetch = fetchJwks(this._url, this._timeoutDuration, this._options)
52
+ .then((json) => {
53
+ if (!isJWKSLike(json)) {
54
+ throw new JWKSInvalid('JSON Web Key Set malformed');
55
+ }
56
+ this._jwks = { keys: json.keys };
57
+ this._jwksTimestamp = Date.now();
58
+ this._pendingFetch = undefined;
59
+ })
60
+ .catch((err) => {
61
+ this._pendingFetch = undefined;
62
+ throw err;
63
+ }));
76
64
  await this._pendingFetch;
77
65
  }
78
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
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",