@thunderid/browser 0.0.3 → 0.0.5

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 (111) hide show
  1. package/dist/FetchHttpClient.d.ts +1 -0
  2. package/dist/FetchHttpClient.d.ts.map +1 -1
  3. package/dist/ThunderIDBrowserClient.d.ts +66 -10
  4. package/dist/ThunderIDBrowserClient.d.ts.map +1 -1
  5. package/dist/cjs/index.js +1333 -3001
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/{__legacy__/constants/hooks.d.ts → constants/Hooks.d.ts} +5 -1
  8. package/dist/constants/Hooks.d.ts.map +1 -0
  9. package/dist/{__legacy__/constants/session-management.d.ts → constants/SPAConstants.d.ts} +11 -2
  10. package/dist/constants/SPAConstants.d.ts.map +1 -0
  11. package/dist/index.d.ts +23 -18
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1568 -3248
  14. package/dist/index.js.map +1 -1
  15. package/dist/models/BrowserConfig.d.ts +46 -0
  16. package/dist/models/BrowserConfig.d.ts.map +1 -0
  17. package/dist/{__legacy__/models/storage.d.ts → models/BrowserStorage.d.ts} +7 -16
  18. package/dist/models/BrowserStorage.d.ts.map +1 -0
  19. package/dist/{__legacy__/models/sign-in.d.ts → models/SignInConfig.d.ts} +9 -1
  20. package/dist/models/SignInConfig.d.ts.map +1 -0
  21. package/dist/{__legacy__/models/sign-out-error.d.ts → models/SignOutError.d.ts} +7 -1
  22. package/dist/models/SignOutError.d.ts.map +1 -0
  23. package/dist/{__legacy__/models/request-custom-grant.d.ts → models/TokenExchangeConfig.d.ts} +8 -3
  24. package/dist/models/TokenExchangeConfig.d.ts.map +1 -0
  25. package/dist/models/config.d.ts +1 -1
  26. package/dist/models/config.d.ts.map +1 -1
  27. package/dist/{__legacy__/stores/session-store.d.ts → stores/LocalStore.d.ts} +6 -2
  28. package/dist/stores/LocalStore.d.ts.map +1 -0
  29. package/dist/{__legacy__/stores/memory-store.d.ts → stores/MemoryStore.d.ts} +6 -2
  30. package/dist/stores/MemoryStore.d.ts.map +1 -0
  31. package/dist/{__legacy__/stores/local-store.d.ts → stores/SessionStore.d.ts} +6 -2
  32. package/dist/stores/SessionStore.d.ts.map +1 -0
  33. package/dist/utils/AuthenticationHelper.d.ts +192 -0
  34. package/dist/utils/AuthenticationHelper.d.ts.map +1 -0
  35. package/dist/utils/SPACryptoUtils.d.ts +68 -0
  36. package/dist/utils/SPACryptoUtils.d.ts.map +1 -0
  37. package/dist/utils/SPAHelper.d.ts +50 -0
  38. package/dist/utils/SPAHelper.d.ts.map +1 -0
  39. package/dist/utils/SPAUtils.d.ts +145 -0
  40. package/dist/utils/SPAUtils.d.ts.map +1 -0
  41. package/dist/{__legacy__/models/session-management-helper.d.ts → utils/SessionManagementHelper.d.ts} +21 -2
  42. package/dist/utils/SessionManagementHelper.d.ts.map +1 -0
  43. package/dist/utils/http.d.ts +12 -25
  44. package/dist/utils/http.d.ts.map +1 -1
  45. package/package.json +2 -2
  46. package/dist/__legacy__/client.d.ts +0 -767
  47. package/dist/__legacy__/client.d.ts.map +0 -1
  48. package/dist/__legacy__/clients/index.d.ts +0 -20
  49. package/dist/__legacy__/clients/index.d.ts.map +0 -1
  50. package/dist/__legacy__/clients/main-thread-client.d.ts +0 -23
  51. package/dist/__legacy__/clients/main-thread-client.d.ts.map +0 -1
  52. package/dist/__legacy__/clients/web-worker-client.d.ts +0 -22
  53. package/dist/__legacy__/clients/web-worker-client.d.ts.map +0 -1
  54. package/dist/__legacy__/constants/errors.d.ts +0 -19
  55. package/dist/__legacy__/constants/errors.d.ts.map +0 -1
  56. package/dist/__legacy__/constants/hooks.d.ts.map +0 -1
  57. package/dist/__legacy__/constants/index.d.ts +0 -24
  58. package/dist/__legacy__/constants/index.d.ts.map +0 -1
  59. package/dist/__legacy__/constants/messages-types.d.ts +0 -52
  60. package/dist/__legacy__/constants/messages-types.d.ts.map +0 -1
  61. package/dist/__legacy__/constants/parameters.d.ts +0 -22
  62. package/dist/__legacy__/constants/parameters.d.ts.map +0 -1
  63. package/dist/__legacy__/constants/session-management.d.ts.map +0 -1
  64. package/dist/__legacy__/constants/storage.d.ts +0 -19
  65. package/dist/__legacy__/constants/storage.d.ts.map +0 -1
  66. package/dist/__legacy__/helpers/authentication-helper.d.ts +0 -59
  67. package/dist/__legacy__/helpers/authentication-helper.d.ts.map +0 -1
  68. package/dist/__legacy__/helpers/index.d.ts +0 -21
  69. package/dist/__legacy__/helpers/index.d.ts.map +0 -1
  70. package/dist/__legacy__/helpers/session-management-helper.d.ts +0 -21
  71. package/dist/__legacy__/helpers/session-management-helper.d.ts.map +0 -1
  72. package/dist/__legacy__/helpers/spa-helper.d.ts +0 -30
  73. package/dist/__legacy__/helpers/spa-helper.d.ts.map +0 -1
  74. package/dist/__legacy__/models/client-config.d.ts +0 -55
  75. package/dist/__legacy__/models/client-config.d.ts.map +0 -1
  76. package/dist/__legacy__/models/client.d.ts +0 -85
  77. package/dist/__legacy__/models/client.d.ts.map +0 -1
  78. package/dist/__legacy__/models/http-client.d.ts +0 -30
  79. package/dist/__legacy__/models/http-client.d.ts.map +0 -1
  80. package/dist/__legacy__/models/index.d.ts +0 -27
  81. package/dist/__legacy__/models/index.d.ts.map +0 -1
  82. package/dist/__legacy__/models/message.d.ts +0 -47
  83. package/dist/__legacy__/models/message.d.ts.map +0 -1
  84. package/dist/__legacy__/models/request-custom-grant.d.ts.map +0 -1
  85. package/dist/__legacy__/models/session-management-helper.d.ts.map +0 -1
  86. package/dist/__legacy__/models/sign-in.d.ts.map +0 -1
  87. package/dist/__legacy__/models/sign-out-error.d.ts.map +0 -1
  88. package/dist/__legacy__/models/storage.d.ts.map +0 -1
  89. package/dist/__legacy__/models/web-worker.d.ts +0 -57
  90. package/dist/__legacy__/models/web-worker.d.ts.map +0 -1
  91. package/dist/__legacy__/stores/index.d.ts +0 -21
  92. package/dist/__legacy__/stores/index.d.ts.map +0 -1
  93. package/dist/__legacy__/stores/local-store.d.ts.map +0 -1
  94. package/dist/__legacy__/stores/memory-store.d.ts.map +0 -1
  95. package/dist/__legacy__/stores/session-store.d.ts.map +0 -1
  96. package/dist/__legacy__/utils/crypto-utils.d.ts +0 -32
  97. package/dist/__legacy__/utils/crypto-utils.d.ts.map +0 -1
  98. package/dist/__legacy__/utils/index.d.ts +0 -20
  99. package/dist/__legacy__/utils/index.d.ts.map +0 -1
  100. package/dist/__legacy__/utils/message-utils.d.ts +0 -38
  101. package/dist/__legacy__/utils/message-utils.d.ts.map +0 -1
  102. package/dist/__legacy__/utils/spa-utils.d.ts +0 -108
  103. package/dist/__legacy__/utils/spa-utils.d.ts.map +0 -1
  104. package/dist/__legacy__/worker/index.d.ts +0 -20
  105. package/dist/__legacy__/worker/index.d.ts.map +0 -1
  106. package/dist/__legacy__/worker/worker-core.d.ts +0 -22
  107. package/dist/__legacy__/worker/worker-core.d.ts.map +0 -1
  108. package/dist/__legacy__/worker/worker-receiver.d.ts +0 -22
  109. package/dist/__legacy__/worker/worker-receiver.d.ts.map +0 -1
  110. package/dist/web.worker.d.ts +0 -20
  111. package/dist/web.worker.d.ts.map +0 -1
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright (c) 2026, 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
+ import { AuthClientConfig } from '@thunderid/javascript';
19
+ import { BrowserStorage } from './BrowserStorage';
20
+ /**
21
+ * Browser-specific SDK configuration that extends the base OIDC config.
22
+ */
23
+ export interface BrowserClientConfig {
24
+ /**
25
+ * Storage backend to use for session data.
26
+ * @default BrowserStorage.SessionStorage
27
+ */
28
+ storage?: BrowserStorage | 'sessionStorage' | 'localStorage' | 'browserMemory';
29
+ /** Enable OIDC Session Management via RP Iframe. Requires same-domain or third-party cookies. */
30
+ syncSession?: boolean;
31
+ /** Interval in seconds between session-check polls. @default 3 */
32
+ checkSessionInterval?: number;
33
+ /** Interval in seconds for silent token refresh. @default 300 */
34
+ sessionRefreshInterval?: number;
35
+ /** Allowed external URL prefixes for `httpRequest` calls. */
36
+ allowedExternalUrls?: string[];
37
+ /** Additional query params to append to every authorize request. */
38
+ authParams?: Record<string, string>;
39
+ /** Automatically refresh the access token before it expires. */
40
+ periodicTokenRefresh?: boolean;
41
+ /** Sign the user out when a token refresh attempt fails. @default false */
42
+ autoLogoutOnTokenRefreshError?: boolean;
43
+ }
44
+ /** Full browser SDK configuration, combining base OIDC config with browser-specific fields. */
45
+ export type BrowserAuthConfig = AuthClientConfig<BrowserClientConfig>;
46
+ //# sourceMappingURL=BrowserConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrowserConfig.d.ts","sourceRoot":"","sources":["../../src/models/BrowserConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,CAAC;IAC/E,iGAAiG;IACjG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kEAAkE;IAClE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iEAAiE;IACjE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,6DAA6D;IAC7D,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,gEAAgE;IAChE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,2EAA2E;IAC3E,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,+FAA+F;AAC/F,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
3
  *
4
4
  * WSO2 LLC. licenses this file to you under the Apache License,
5
5
  * Version 2.0 (the "License"); you may not use this file except
@@ -16,24 +16,15 @@
16
16
  * under the License.
17
17
  */
18
18
  /**
19
- * Enum for the different storage types.
19
+ * Supported browser storage backends for auth session data.
20
20
  */
21
21
  export declare enum BrowserStorage {
22
- /**
23
- * Stores the session information in the local storage
24
- */
22
+ /** Store session data in `localStorage` (persists across tabs and sessions). */
25
23
  LocalStorage = "localStorage",
26
- /**
27
- * Store the session information in the session storage.
28
- */
24
+ /** Store session data in `sessionStorage` (cleared when the tab is closed). */
29
25
  SessionStorage = "sessionStorage",
30
- /**
31
- * Store the session information in the web worker.
32
- */
33
- WebWorker = "webWorker",
34
- /**
35
- * Store the session information in the browser memory.
36
- */
26
+ /** Store session data in in-memory (cleared on page reload). */
37
27
  BrowserMemory = "browserMemory"
38
28
  }
39
- //# sourceMappingURL=storage.d.ts.map
29
+ export default BrowserStorage;
30
+ //# sourceMappingURL=BrowserStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrowserStorage.d.ts","sourceRoot":"","sources":["../../src/models/BrowserStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AACH,oBAAY,cAAc;IACxB,gFAAgF;IAChF,YAAY,iBAAiB;IAC7B,+EAA+E;IAC/E,cAAc,mBAAmB;IACjC,gEAAgE;IAChE,aAAa,kBAAkB;CAChC;AAED,eAAe,cAAc,CAAC"}
@@ -16,7 +16,15 @@
16
16
  * under the License.
17
17
  */
18
18
  import { ExtendedAuthorizeRequestUrlParams } from '@thunderid/javascript';
19
+ /**
20
+ * Options accepted by `ThunderIDBrowserClient.signIn()`.
21
+ */
19
22
  export type SignInConfig = ExtendedAuthorizeRequestUrlParams & {
23
+ /**
24
+ * When `true`, the `signIn` call is a no-op unless the current URL already contains
25
+ * an authorization code (i.e., the page is the redirect landing page).
26
+ */
20
27
  callOnlyOnRedirect?: boolean;
21
28
  };
22
- //# sourceMappingURL=sign-in.d.ts.map
29
+ export default SignInConfig;
30
+ //# sourceMappingURL=SignInConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignInConfig.d.ts","sourceRoot":"","sources":["../../src/models/SignInConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,iCAAiC,EAAC,MAAM,uBAAuB,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iCAAiC,GAAG;IAC7D;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -15,8 +15,14 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
+ /**
19
+ * Error information returned when a sign-out redirect fails.
20
+ */
18
21
  export interface SignOutError {
22
+ /** OAuth2/OIDC error code from the redirect URL. */
19
23
  error: string;
24
+ /** Human-readable error description from the redirect URL. */
20
25
  description: string;
21
26
  }
22
- //# sourceMappingURL=sign-out-error.d.ts.map
27
+ export default SignOutError;
28
+ //# sourceMappingURL=SignOutError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignOutError.d.ts","sourceRoot":"","sources":["../../src/models/SignOutError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,YAAY,CAAC"}
@@ -17,9 +17,14 @@
17
17
  */
18
18
  import { TokenExchangeRequestConfig } from '@thunderid/javascript';
19
19
  /**
20
- * SPA Custom Request Grant config model
20
+ * Browser-specific token exchange configuration extending the base token exchange config.
21
21
  */
22
- export interface SPACustomGrantConfig extends TokenExchangeRequestConfig {
22
+ export interface SPATokenExchangeConfig extends TokenExchangeRequestConfig {
23
+ /**
24
+ * When `true`, the sign-out URL is not updated after this token exchange
25
+ * (preserves the original sign-out URL across org switches).
26
+ */
23
27
  preventSignOutURLUpdate?: boolean;
24
28
  }
25
- //# sourceMappingURL=request-custom-grant.d.ts.map
29
+ export default SPATokenExchangeConfig;
30
+ //# sourceMappingURL=TokenExchangeConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenExchangeConfig.d.ts","sourceRoot":"","sources":["../../src/models/TokenExchangeConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,0BAA0B,EAAC,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,0BAA0B;IACxE;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,eAAe,sBAAsB,CAAC"}
@@ -16,5 +16,5 @@
16
16
  * under the License.
17
17
  */
18
18
  import { Config } from '@thunderid/javascript';
19
- export type ThunderIDBrowserConfig = Config<'sessionStorage' | 'localStorage' | 'browserMemory' | 'webWorker'>;
19
+ export type ThunderIDBrowserConfig = Config<'sessionStorage' | 'localStorage' | 'browserMemory'>;
20
20
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/models/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAE7C,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/models/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAE7C,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,GAAG,cAAc,GAAG,eAAe,CAAC,CAAC"}
@@ -16,9 +16,13 @@
16
16
  * under the License.
17
17
  */
18
18
  import { Storage } from '@thunderid/javascript';
19
- export declare class SessionStore implements Storage {
19
+ /**
20
+ * `Storage` implementation backed by the browser's `localStorage`.
21
+ */
22
+ declare class LocalStore implements Storage {
20
23
  setData(key: string, value: string): Promise<void>;
21
24
  getData(key: string): Promise<string>;
22
25
  removeData(key: string): Promise<void>;
23
26
  }
24
- //# sourceMappingURL=session-store.d.ts.map
27
+ export default LocalStore;
28
+ //# sourceMappingURL=LocalStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalStore.d.ts","sourceRoot":"","sources":["../../src/stores/LocalStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAE9C;;GAEG;AACH,cAAM,UAAW,YAAW,OAAO;IACpB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD;AAED,eAAe,UAAU,CAAC"}
@@ -16,11 +16,15 @@
16
16
  * under the License.
17
17
  */
18
18
  import { Storage } from '@thunderid/javascript';
19
- export declare class MemoryStore implements Storage {
19
+ /**
20
+ * `Storage` implementation backed by an in-memory `Map`. Data does not survive page reloads.
21
+ */
22
+ declare class MemoryStore implements Storage {
20
23
  private _data;
21
24
  constructor();
22
25
  setData(key: string, value: string): Promise<void>;
23
26
  getData(key: string): Promise<string>;
24
27
  removeData(key: string): Promise<void>;
25
28
  }
26
- //# sourceMappingURL=memory-store.d.ts.map
29
+ export default MemoryStore;
30
+ //# sourceMappingURL=MemoryStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MemoryStore.d.ts","sourceRoot":"","sources":["../../src/stores/MemoryStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAE9C;;GAEG;AACH,cAAM,WAAY,YAAW,OAAO;IAClC,OAAO,CAAC,KAAK,CAAsB;;IAMtB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD;AAED,eAAe,WAAW,CAAC"}
@@ -16,9 +16,13 @@
16
16
  * under the License.
17
17
  */
18
18
  import { Storage } from '@thunderid/javascript';
19
- export declare class LocalStore implements Storage {
19
+ /**
20
+ * `Storage` implementation backed by the browser's `sessionStorage`.
21
+ */
22
+ declare class SessionStore implements Storage {
20
23
  setData(key: string, value: string): Promise<void>;
21
24
  getData(key: string): Promise<string>;
22
25
  removeData(key: string): Promise<void>;
23
26
  }
24
- //# sourceMappingURL=local-store.d.ts.map
27
+ export default SessionStore;
28
+ //# sourceMappingURL=SessionStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionStore.d.ts","sourceRoot":"","sources":["../../src/stores/SessionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAE9C;;GAEG;AACH,cAAM,YAAa,YAAW,OAAO;IACtB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Copyright (c) 2026, 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
+ import { User, IsomorphicCrypto, StorageManager, IdToken, ExtendedAuthorizeRequestUrlParams, OIDCEndpoints, TokenResponse, HttpClient, HttpError, HttpRequestConfig, HttpResponse } from '@thunderid/javascript';
19
+ import { SPATokenExchangeConfig } from '../models/TokenExchangeConfig';
20
+ import SPAHelper from './SPAHelper';
21
+ interface SessionManagementHelperInterface {
22
+ initialize(clientId: string, checkSessionEndpoint: string, getSessionState: () => Promise<string>, interval: number, sessionRefreshInterval: number, redirectURL: string, getSignInUrl: (params?: ExtendedAuthorizeRequestUrlParams) => Promise<string>): void;
23
+ receivePromptNoneResponse(setSessionState?: (sessionState: string | null) => Promise<void>): Promise<boolean>;
24
+ reset(): void;
25
+ }
26
+ /**
27
+ * Browser-level authentication helper that orchestrates HTTP requests with token attachment,
28
+ * automatic token refresh, session management, and the silent sign-in flow.
29
+ *
30
+ * @typeParam T - The browser client config extension type.
31
+ */
32
+ declare class AuthenticationHelper<T> {
33
+ private _storageManager;
34
+ private _spaHelper;
35
+ private _instanceId;
36
+ private _isTokenRefreshing;
37
+ private _getUser;
38
+ private _refreshAccessToken;
39
+ private _getAccessToken;
40
+ private _getIDPAccessToken;
41
+ private _isSignedIn;
42
+ private _getDecodedIdToken;
43
+ private _getCrypto;
44
+ private _getIdToken;
45
+ private _getOpenIDProviderEndpoints;
46
+ private _exchangeToken;
47
+ private _setPKCECode;
48
+ /**
49
+ * @param storageManager - Storage manager for reading config and session data.
50
+ * @param spaHelper - Helper for managing token refresh timers.
51
+ * @param instanceId - The instance ID used for signing out URL storage.
52
+ * @param operations - Client operation callbacks to avoid circular dependency.
53
+ */
54
+ constructor(storageManager: StorageManager<T>, spaHelper: SPAHelper<T>, instanceId: number, operations: {
55
+ getUser: () => Promise<User>;
56
+ refreshAccessToken: () => Promise<TokenResponse | User>;
57
+ getAccessToken: (sessionId?: string) => Promise<string>;
58
+ getIDPAccessToken: () => Promise<string>;
59
+ isSignedIn: () => Promise<boolean>;
60
+ getDecodedIdToken: (sessionId?: string) => Promise<IdToken>;
61
+ getCrypto: () => Promise<IsomorphicCrypto>;
62
+ getIdToken: () => Promise<string>;
63
+ getOpenIDProviderEndpoints: () => Promise<OIDCEndpoints>;
64
+ exchangeToken: (config: SPATokenExchangeConfig) => Promise<Response | TokenResponse | User>;
65
+ setPKCECode: (pkceKey: string, state: string) => Promise<void>;
66
+ });
67
+ /**
68
+ * Enables request interception on the HTTP client.
69
+ *
70
+ * @param httpClient - The HTTP client to enable.
71
+ */
72
+ enableHttpHandler(httpClient: HttpClient): void;
73
+ /**
74
+ * Disables request interception on the HTTP client.
75
+ *
76
+ * @param httpClient - The HTTP client to disable.
77
+ */
78
+ disableHttpHandler(httpClient: HttpClient): void;
79
+ /**
80
+ * Initializes OIDC Session Management via an RP iframe.
81
+ *
82
+ * @param config - The current auth config.
83
+ * @param oidcEndpoints - Resolved OIDC provider endpoints.
84
+ * @param getSessionState - Returns the current session state from storage.
85
+ * @param getAuthzURL - Builds an authorization URL with optional params.
86
+ * @param sessionManagementHelper - The session management helper instance.
87
+ */
88
+ initializeSessionManger(config: any, oidcEndpoints: OIDCEndpoints, getSessionState: () => Promise<string>, getAuthzURL: (params?: ExtendedAuthorizeRequestUrlParams) => Promise<string>, sessionManagementHelper: SessionManagementHelperInterface): void;
89
+ /**
90
+ * Executes a custom token exchange grant, enforcing `allowedExternalUrls` rules when applicable.
91
+ *
92
+ * @param config - The token exchange configuration.
93
+ * @param enableRetrievingSignOutURLFromSession - Callback invoked when `preventSignOutURLUpdate` is set.
94
+ * @returns The user session or raw response.
95
+ */
96
+ exchangeToken(config: SPATokenExchangeConfig, enableRetrievingSignOutURLFromSession?: (config: SPATokenExchangeConfig) => void): Promise<User | Response>;
97
+ /**
98
+ * Returns the stored custom grant config if a replay-after-refresh was scheduled, or `null`.
99
+ */
100
+ getCustomGrantConfigData(): Promise<SPATokenExchangeConfig | null>;
101
+ /**
102
+ * Refreshes the access token, replays any scheduled custom grant, and reschedules auto-refresh.
103
+ *
104
+ * @param enableRetrievingSignOutURLFromSession - Callback for custom grant sign-out URL handling.
105
+ * @returns The updated user session.
106
+ */
107
+ refreshAccessToken(enableRetrievingSignOutURLFromSession?: (config: SPATokenExchangeConfig) => void): Promise<User>;
108
+ private retryFailedRequests;
109
+ /**
110
+ * Sends an HTTP request via the provided client, automatically attaching the token,
111
+ * and retries once after a token refresh on a 401 response.
112
+ *
113
+ * @param httpClient - The HTTP client to use.
114
+ * @param requestConfig - The request configuration.
115
+ * @param isHttpHandlerEnabled - Whether request callbacks are active.
116
+ * @param httpErrorCallback - Called when a request fails.
117
+ * @param httpFinishCallback - Called when a request finishes.
118
+ * @param enableRetrievingSignOutURLFromSession - Callback for custom grant sign-out handling.
119
+ * @returns The HTTP response.
120
+ */
121
+ httpRequest(httpClient: HttpClient, requestConfig: HttpRequestConfig, isHttpHandlerEnabled?: boolean, httpErrorCallback?: (error: HttpError) => void | Promise<void>, httpFinishCallback?: () => void, enableRetrievingSignOutURLFromSession?: (config: SPATokenExchangeConfig) => void): Promise<HttpResponse>;
122
+ /**
123
+ * Sends multiple HTTP requests in parallel via the provided client,
124
+ * retrying all on a 401 after a token refresh.
125
+ *
126
+ * @param requestConfigs - Array of request configurations.
127
+ * @param httpClient - The HTTP client to use.
128
+ * @param isHttpHandlerEnabled - Whether request callbacks are active.
129
+ * @param httpErrorCallback - Called when a batch fails.
130
+ * @param httpFinishCallback - Called when the batch finishes.
131
+ * @returns Array of responses.
132
+ */
133
+ httpRequestAll(requestConfigs: HttpRequestConfig[], httpClient: HttpClient, isHttpHandlerEnabled?: boolean, httpErrorCallback?: (error: HttpError) => void | Promise<void>, httpFinishCallback?: () => void): Promise<HttpResponse[] | undefined>;
134
+ /**
135
+ * Executes the silent sign-in flow using a prompt-none request via an iFrame.
136
+ *
137
+ * @param constructSilentSignInUrl - Builds the prompt-none authorize URL.
138
+ * @param requestAccessToken - Exchanges the returned code for tokens.
139
+ * @param sessionManagementHelper - Handles the iFrame prompt-none response.
140
+ * @param additionalParams - Extra authorize request params.
141
+ * @param tokenRequestConfig - Additional params for the token request.
142
+ * @returns The user session, or `false` if the user is not signed in.
143
+ */
144
+ signInSilently(constructSilentSignInUrl: (additionalParams?: Record<string, string | boolean>) => Promise<string>, requestAccessToken: (authzCode: string, sessionState: string, state: string, tokenRequestConfig?: {
145
+ params: Record<string, unknown>;
146
+ }) => Promise<User>, sessionManagementHelper: SessionManagementHelperInterface, additionalParams?: Record<string, string | boolean>, tokenRequestConfig?: {
147
+ params: Record<string, unknown>;
148
+ }): Promise<User | boolean>;
149
+ /**
150
+ * Handles the early-return path of `signIn()` when a session already exists
151
+ * or the page is handling a prompt-none response.
152
+ *
153
+ * @param shouldStopAuthn - Returns `true` if we should short-circuit and return early.
154
+ * @param checkSession - Callback to initialize OIDC session management.
155
+ * @returns The current user if already signed in, or `undefined` to continue normal sign-in.
156
+ */
157
+ handleSignIn(shouldStopAuthn: () => Promise<boolean>, checkSession: () => Promise<void>): Promise<User | undefined>;
158
+ /**
159
+ * Attaches the access token (or IDP token) to an HTTP request config's `Authorization` header.
160
+ *
161
+ * @param request - The request config to mutate.
162
+ */
163
+ attachTokenToRequestConfig(request: HttpRequestConfig): Promise<void>;
164
+ /** Returns the current authenticated user from the ID token. */
165
+ getUser(): Promise<User>;
166
+ /**
167
+ * Returns the decoded ID token payload.
168
+ *
169
+ * @param sessionId - Optional session ID.
170
+ */
171
+ getDecodedIdToken(sessionId?: string): Promise<IdToken>;
172
+ /** Returns the IsomorphicCrypto instance used by the client. */
173
+ getCrypto(): Promise<IsomorphicCrypto>;
174
+ /** Returns the raw ID token string. */
175
+ getIdToken(): Promise<string>;
176
+ /** Returns the resolved OIDC provider endpoints. */
177
+ getOpenIDProviderEndpoints(): Promise<OIDCEndpoints>;
178
+ /**
179
+ * Returns the current access token.
180
+ *
181
+ * @param sessionId - Optional session ID.
182
+ */
183
+ getAccessToken(sessionId?: string): Promise<string>;
184
+ /** Returns the IDP access token from the session. */
185
+ getIDPAccessToken(): Promise<string>;
186
+ /** Returns the storage manager. */
187
+ getStorageManager(): StorageManager<T>;
188
+ /** Returns whether the user is currently signed in. */
189
+ isSignedIn(): Promise<boolean>;
190
+ }
191
+ export default AuthenticationHelper;
192
+ //# sourceMappingURL=AuthenticationHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationHelper.d.ts","sourceRoot":"","sources":["../../src/utils/AuthenticationHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEL,IAA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AAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjD,mCAAmC;IAC5B,iBAAiB,IAAI,cAAc,CAAC,CAAC,CAAC;IAI7C,uDAAuD;IAC1C,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;CAG5C;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Copyright (c) 2026, 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
+ import { Buffer } from 'buffer';
19
+ import { Crypto, JWKInterface } from '@thunderid/javascript';
20
+ /**
21
+ * Browser-side `Crypto` implementation using native Web Crypto APIs and `jose` for JWT verification.
22
+ */
23
+ declare class SPACryptoUtils implements Crypto<Buffer | string> {
24
+ /**
25
+ * Base64URL-encodes a buffer or string value.
26
+ *
27
+ * @param value - The value to encode.
28
+ * @returns The base64url-encoded string with padding stripped.
29
+ */
30
+ base64URLEncode(value: Buffer | string): string;
31
+ /**
32
+ * Decodes a base64url-encoded string.
33
+ *
34
+ * @param value - The base64url string to decode.
35
+ * @returns The decoded UTF-8 string.
36
+ */
37
+ base64URLDecode(value: string): string;
38
+ /**
39
+ * Computes the SHA-256 hash of a string.
40
+ *
41
+ * @param data - The input string to hash.
42
+ * @returns A `Buffer` containing the raw hash bytes.
43
+ */
44
+ hashSha256(data: string): string | Buffer;
45
+ /**
46
+ * Generates a buffer of cryptographically random bytes.
47
+ *
48
+ * @param length - Number of bytes to generate.
49
+ * @returns A `Buffer` of random bytes.
50
+ */
51
+ generateRandomBytes(length: number): string | Buffer;
52
+ /**
53
+ * Verifies a JWT against a JWK using `jose`.
54
+ *
55
+ * @param idToken - The raw JWT string.
56
+ * @param jwk - The JSON Web Key to verify against.
57
+ * @param algorithms - Allowed signature algorithms (e.g., `['RS256']`).
58
+ * @param clientId - Expected audience claim value.
59
+ * @param issuer - Expected issuer claim value.
60
+ * @param subject - Expected subject claim value.
61
+ * @param clockTolerance - Allowed clock skew in seconds.
62
+ * @param validateJwtIssuer - Whether to validate the issuer claim.
63
+ * @returns `true` if the token is valid.
64
+ */
65
+ verifyJwt(idToken: string, jwk: Partial<JWKInterface>, algorithms: string[], clientId: string, issuer: string, subject: string, clockTolerance?: number, validateJwtIssuer?: boolean): Promise<boolean>;
66
+ }
67
+ export default SPACryptoUtils;
68
+ //# sourceMappingURL=SPACryptoUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SPACryptoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/SPACryptoUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAyB,MAAM,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAMnF;;GAEG;AACH,cAAM,cAAe,YAAW,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACrD;;;;;OAKG;IACI,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAItD;;;;;OAKG;IACI,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAIhD;;;;;OAKG;IACI,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAI3D;;;;;;;;;;;;OAYG;IACI,SAAS,CACd,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,EAC1B,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,OAAO,CAAC;CAgCpB;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copyright (c) 2026, 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
+ import { StorageManager } from '@thunderid/javascript';
19
+ /**
20
+ * Helper that manages automatic access-token refresh scheduling via `setTimeout`.
21
+ *
22
+ * @typeParam T - Browser client config type.
23
+ */
24
+ declare class SPAHelper<T> {
25
+ private _storageManager;
26
+ private _isTokenRefreshLoading;
27
+ /**
28
+ * @param storageManager - The storage manager instance used to read config and session data.
29
+ */
30
+ constructor(storageManager: StorageManager<T>);
31
+ /**
32
+ * Schedules an automatic access-token refresh if `periodicTokenRefresh` is enabled in config.
33
+ * No-op if the feature is disabled or there is no refresh token.
34
+ *
35
+ * @param refreshAccessToken - Async callback that performs the refresh.
36
+ */
37
+ refreshAccessTokenAutomatically(refreshAccessToken: () => Promise<any>): Promise<void>;
38
+ /**
39
+ * Returns the current refresh timer ID from storage, or `-1` if none is set.
40
+ */
41
+ getRefreshTimeoutTimer(): Promise<number>;
42
+ /**
43
+ * Clears the automatic-refresh timer.
44
+ *
45
+ * @param timer - Timer ID to clear. If omitted, the stored timer ID is used.
46
+ */
47
+ clearRefreshTokenTimeout(timer?: number): Promise<void>;
48
+ }
49
+ export default SPAHelper;
50
+ //# sourceMappingURL=SPAHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SPAHelper.d.ts","sourceRoot":"","sources":["../../src/utils/SPAHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,cAAc,EAAiB,MAAM,uBAAuB,CAAC;AAErE;;;;GAIG;AACH,cAAM,SAAS,CAAC,CAAC;IACf,OAAO,CAAC,eAAe,CAAoB;IAC3C,OAAO,CAAC,sBAAsB,CAAS;IAEvC;;OAEG;gBACgB,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IAIpD;;;;;OAKG;IACU,+BAA+B,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAkDnG;;OAEG;IACU,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC;IAYtD;;;;OAIG;IACU,wBAAwB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAarE;AAED,eAAe,SAAS,CAAC"}