@asgardeo/auth-spa 3.1.4 → 3.2.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.
Files changed (53) hide show
  1. package/README.md +23 -0
  2. package/dist/asgardeo-spa.production.esm.js +33 -13
  3. package/dist/asgardeo-spa.production.esm.js.map +1 -1
  4. package/dist/asgardeo-spa.production.js +29 -9
  5. package/dist/asgardeo-spa.production.js.map +1 -1
  6. package/dist/asgardeo-spa.production.min.js +1 -1
  7. package/dist/asgardeo-spa.production.min.js.map +1 -1
  8. package/dist/polyfilled/asgardeo-spa.production.esm.js +31 -11
  9. package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
  10. package/dist/polyfilled/asgardeo-spa.production.js +47 -27
  11. package/dist/polyfilled/asgardeo-spa.production.js.map +1 -1
  12. package/dist/polyfilled/asgardeo-spa.production.min.js +1 -1
  13. package/dist/polyfilled/asgardeo-spa.production.min.js.map +1 -1
  14. package/dist/src/client.d.ts +24 -2
  15. package/dist/src/client.d.ts.map +1 -1
  16. package/dist/src/client.js +42 -4
  17. package/dist/src/client.js.map +1 -1
  18. package/dist/src/clients/main-thread-client.d.ts.map +1 -1
  19. package/dist/src/clients/main-thread-client.js +6 -1
  20. package/dist/src/clients/main-thread-client.js.map +1 -1
  21. package/dist/src/clients/web-worker-client.d.ts.map +1 -1
  22. package/dist/src/clients/web-worker-client.js +3 -1
  23. package/dist/src/clients/web-worker-client.js.map +1 -1
  24. package/dist/src/constants/storage.d.ts +0 -18
  25. package/dist/src/constants/storage.d.ts.map +1 -1
  26. package/dist/src/constants/storage.js +0 -19
  27. package/dist/src/constants/storage.js.map +1 -1
  28. package/dist/src/helpers/authentication-helper.d.ts.map +1 -1
  29. package/dist/src/helpers/authentication-helper.js +2 -1
  30. package/dist/src/helpers/authentication-helper.js.map +1 -1
  31. package/dist/src/helpers/session-management-helper.d.ts +1 -1
  32. package/dist/src/helpers/session-management-helper.d.ts.map +1 -1
  33. package/dist/src/helpers/session-management-helper.js +2 -1
  34. package/dist/src/helpers/session-management-helper.js.map +1 -1
  35. package/dist/src/models/client-config.d.ts +12 -3
  36. package/dist/src/models/client-config.d.ts.map +1 -1
  37. package/dist/src/models/client.d.ts +2 -0
  38. package/dist/src/models/client.d.ts.map +1 -1
  39. package/dist/src/models/storage.d.ts +39 -0
  40. package/dist/src/models/storage.d.ts.map +1 -0
  41. package/dist/src/models/storage.js +40 -0
  42. package/dist/src/models/storage.js.map +1 -0
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +1 -1
  45. package/src/client.ts +45 -4
  46. package/src/clients/main-thread-client.ts +9 -7
  47. package/src/clients/web-worker-client.ts +4 -3
  48. package/src/constants/storage.ts +0 -19
  49. package/src/helpers/authentication-helper.ts +2 -2
  50. package/src/helpers/session-management-helper.ts +2 -2
  51. package/src/models/client-config.ts +18 -3
  52. package/src/models/client.ts +2 -0
  53. package/src/models/storage.ts +39 -0
@@ -16,23 +16,4 @@
16
16
  * under the License.
17
17
  */
18
18
 
19
- /**
20
- * Specifies where the session information should be stored.
21
- */
22
- export enum Storage {
23
- /**
24
- * Stores the session information in the local storage
25
- */
26
- LocalStorage = "localStorage",
27
- /**
28
- * Store the session information in the session storage.
29
- */
30
- SessionStorage = "sessionStorage",
31
- /**
32
- * Store the session information in the web worker.
33
- */
34
- WebWorker = "webWorker",
35
- BrowserMemory = "browserMemory"
36
- }
37
-
38
19
  export const TOKEN_REQUEST_CONFIG_KEY = "token_request_config";
@@ -41,8 +41,7 @@ import {
41
41
  ERROR_DESCRIPTION,
42
42
  PROMPT_NONE_IFRAME,
43
43
  REFRESH_ACCESS_TOKEN_ERR0R,
44
- RP_IFRAME,
45
- Storage
44
+ RP_IFRAME
46
45
  } from "../constants";
47
46
  import {
48
47
  AuthorizationInfo,
@@ -57,6 +56,7 @@ import {
57
56
  WebWorkerClientConfig
58
57
  } from "../models";
59
58
  import { SPACustomGrantConfig } from "../models/request-custom-grant";
59
+ import { Storage } from "../models/storage";
60
60
  import { SPAUtils } from "../utils";
61
61
 
62
62
  export class AuthenticationHelper<
@@ -27,10 +27,10 @@ import {
27
27
  SET_SESSION_STATE_FROM_IFRAME,
28
28
  SILENT_SIGN_IN_STATE,
29
29
  STATE,
30
- STATE_QUERY,
31
- Storage
30
+ STATE_QUERY
32
31
  } from "../constants";
33
32
  import { AuthorizationInfo, Message, SessionManagementHelperInterface } from "../models";
33
+ import { Storage } from "../models/storage";
34
34
  import { SPAUtils } from "../utils";
35
35
 
36
36
  export const SessionManagementHelper = (() => {
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { AuthClientConfig } from "@asgardeo/auth-js";
20
- import { Storage } from "../constants";
20
+ import { Storage } from "../models/storage";
21
21
 
22
22
 
23
23
  export interface SPAConfig {
@@ -39,11 +39,26 @@ export interface SPAConfig {
39
39
  * SDK Client config parameters.
40
40
  */
41
41
  export interface MainThreadClientConfig extends SPAConfig {
42
- storage?: Storage.SessionStorage | Storage.LocalStorage | Storage.BrowserMemory;
42
+ /**
43
+ * The storage type to be used for storing the session information.
44
+ */
45
+ storage?:
46
+ | Storage.SessionStorage
47
+ | Storage.LocalStorage
48
+ | Storage.BrowserMemory
49
+ | "sessionStorage"
50
+ | "localStorage"
51
+ | "browserMemory";
43
52
  }
44
53
 
45
54
  export interface WebWorkerClientConfig extends SPAConfig {
46
- storage: Storage.WebWorker;
55
+ /**
56
+ * The storage type to be used for storing the session information.
57
+ */
58
+ storage: Storage.WebWorker | "webWorker";
59
+ /**
60
+ * Specifies in seconds how long a request to the web worker should wait before being timed.
61
+ */
47
62
  requestTimeout?: number;
48
63
  }
49
64
 
@@ -62,6 +62,7 @@ export interface MainThreadClientInterface {
62
62
  getBasicUserInfo(): Promise<BasicUserInfo>;
63
63
  getDecodedIDToken(): Promise<DecodedIDTokenPayload>;
64
64
  getCryptoHelper(): Promise<CryptoHelper>;
65
+ getConfigData(): Promise<AuthClientConfig<MainThreadClientConfig>>;
65
66
  getIDToken(): Promise<string>;
66
67
  getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
67
68
  getAccessToken(): Promise<string>;
@@ -94,6 +95,7 @@ export interface WebWorkerClientInterface {
94
95
  revokeAccessToken(): Promise<boolean>;
95
96
  getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
96
97
  getBasicUserInfo(): Promise<BasicUserInfo>;
98
+ getConfigData(): Promise<AuthClientConfig<WebWorkerClientConfig>>;
97
99
  getDecodedIDToken(): Promise<DecodedIDTokenPayload>;
98
100
  getDecodedIDPIDToken(): Promise<DecodedIDTokenPayload>;
99
101
  getCryptoHelper(): Promise<CryptoHelper>;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+
19
+ /**
20
+ * Enum for the different storage types.
21
+ */
22
+ export enum Storage {
23
+ /**
24
+ * Stores the session information in the local storage
25
+ */
26
+ LocalStorage = "localStorage",
27
+ /**
28
+ * Store the session information in the session storage.
29
+ */
30
+ SessionStorage = "sessionStorage",
31
+ /**
32
+ * Store the session information in the web worker.
33
+ */
34
+ WebWorker = "webWorker",
35
+ /**
36
+ * Store the session information in the browser memory.
37
+ */
38
+ BrowserMemory = "browserMemory"
39
+ }