@workos-inc/node 7.40.0 → 7.40.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.
@@ -22,10 +22,7 @@ class Session {
22
22
  this.ironSessionProvider = userManagement.ironSessionProvider;
23
23
  this.cookiePassword = cookiePassword;
24
24
  this.sessionData = sessionData;
25
- const { clientId } = this.userManagement;
26
- this.jwks = clientId
27
- ? (0, jose_1.createRemoteJWKSet)(new URL(userManagement.getJwksUrl(clientId)))
28
- : undefined;
25
+ this.jwks = this.userManagement.jwks;
29
26
  }
30
27
  /**
31
28
  * Authenticates a user with a session cookie.
@@ -1,3 +1,4 @@
1
+ import { createRemoteJWKSet } from 'jose';
1
2
  import { AutoPaginatable } from '../common/utils/pagination';
2
3
  import { Challenge } from '../mfa/interfaces';
3
4
  import { WorkOS } from '../workos';
@@ -22,10 +23,11 @@ import { IronSessionProvider } from '../common/iron-session/iron-session-provide
22
23
  import { Session } from './session';
23
24
  export declare class UserManagement {
24
25
  private readonly workos;
25
- private jwks;
26
+ private _jwks;
26
27
  clientId: string | undefined;
27
28
  ironSessionProvider: IronSessionProvider;
28
29
  constructor(workos: WorkOS, ironSessionProvider: IronSessionProvider);
30
+ get jwks(): ReturnType<typeof createRemoteJWKSet> | undefined;
29
31
  /**
30
32
  * Loads a sealed session using the provided session data and cookie password.
31
33
  *
@@ -60,12 +60,17 @@ class UserManagement {
60
60
  const { clientId } = workos.options;
61
61
  this.clientId = clientId;
62
62
  this.ironSessionProvider = ironSessionProvider;
63
+ }
64
+ get jwks() {
65
+ var _a;
66
+ if (!this.clientId) {
67
+ return;
68
+ }
63
69
  // Set the JWKS URL. This is used to verify if the JWT is still valid
64
- this.jwks = clientId
65
- ? (0, jose_1.createRemoteJWKSet)(new URL(this.getJwksUrl(clientId)), {
66
- cooldownDuration: 1000 * 60 * 5,
67
- })
68
- : undefined;
70
+ (_a = this._jwks) !== null && _a !== void 0 ? _a : (this._jwks = (0, jose_1.createRemoteJWKSet)(new URL(this.getJwksUrl(this.clientId)), {
71
+ cooldownDuration: 1000 * 60 * 5,
72
+ }));
73
+ return this._jwks;
69
74
  }
70
75
  /**
71
76
  * Loads a sealed session using the provided session data and cookie password.
package/lib/workos.js CHANGED
@@ -29,7 +29,7 @@ const subtle_crypto_provider_1 = require("./common/crypto/subtle-crypto-provider
29
29
  const fetch_client_1 = require("./common/net/fetch-client");
30
30
  const widgets_1 = require("./widgets/widgets");
31
31
  const actions_1 = require("./actions/actions");
32
- const VERSION = '7.40.0';
32
+ const VERSION = '7.40.1';
33
33
  const DEFAULT_HOSTNAME = 'api.workos.com';
34
34
  const HEADER_AUTHORIZATION = 'Authorization';
35
35
  const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.40.0",
2
+ "version": "7.40.1",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",