@thunderid/browser 0.0.5 → 0.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.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
- ![ThunderID Browser SDK](https://raw.githubusercontent.com/thunder-id/thunderid/refs/heads/main/docs/content/sdks/assets/images/%40thunderid%3Abrowser_sdk_banner.png)
1
+ ![ThunderID Browser SDK](https://raw.githubusercontent.com/thunder-id/thunderid/refs/heads/main/docs/static/assets/images/readme/repo-banner-browser-sdk.png)
2
2
 
3
- Browser runtime SDK for ThunderID. Provides authentication and session management for single-page applications running in the browser.
3
+ Browser runtime SDK for ThunderID. Provides authentication and session management for single-page applications running
4
+ in the browser.
4
5
 
5
6
  ## Installation
6
7
 
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ThunderIDJavaScriptClient, User, IsomorphicCrypto, IdToken, OIDCEndpoints, Storage, HttpRequestConfig, HttpResponse } from '@thunderid/javascript';
18
+ import { ThunderIDJavaScriptClient, User, IsomorphicCrypto, IdToken, OIDCEndpoints, Storage, TokenResponse, HttpRequestConfig, HttpResponse } from '@thunderid/javascript';
19
19
  import FetchHttpClient from './FetchHttpClient';
20
20
  import { BrowserAuthConfig } from './models/BrowserConfig';
21
21
  import SignInConfig from './models/SignInConfig';
@@ -55,24 +55,24 @@ declare class ThunderIDBrowserClient<T = BrowserAuthConfig> extends ThunderIDJav
55
55
  signOut(_options?: any, sessionIdOrAfterSignOut?: string | ((url: string) => void), afterSignOutParam?: (url: string) => void): Promise<string>;
56
56
  httpRequest(requestConfig: HttpRequestConfig): Promise<HttpResponse | undefined>;
57
57
  httpRequestAll(configs: HttpRequestConfig[]): Promise<HttpResponse[] | undefined>;
58
- getUser(userId?: string): Promise<User | undefined>;
58
+ getUser(userId?: string): Promise<User>;
59
59
  getAccessToken(sessionId?: string): Promise<string>;
60
- getDecodedIdToken(userId?: string, idToken?: string): Promise<IdToken | undefined>;
61
- getIdToken(userId?: string): Promise<string | undefined>;
60
+ getDecodedIdToken(userId?: string, idToken?: string): Promise<IdToken>;
61
+ getIdToken(userId?: string): Promise<string>;
62
62
  getOpenIDProviderEndpoints(): Promise<Partial<OIDCEndpoints>>;
63
63
  getCrypto(): Promise<IsomorphicCrypto | undefined>;
64
64
  getHttpClient(): FetchHttpClient;
65
- isSignedIn(userId?: string): Promise<boolean | undefined>;
65
+ isSignedIn(userId?: string): Promise<boolean>;
66
66
  protected notifySignIn(user: User): void;
67
67
  isSessionActive(): Promise<boolean | undefined>;
68
- refreshAccessToken(userId?: string): Promise<User | undefined>;
69
- revokeAccessToken(userId?: string): Promise<boolean | undefined>;
68
+ refreshAccessToken(userId?: string): Promise<User | TokenResponse>;
69
+ revokeAccessToken(userId?: string): Promise<boolean | Response>;
70
70
  exchangeToken(config: SPATokenExchangeConfig): Promise<Response | User>;
71
71
  reInitialize(config: Partial<T>): Promise<boolean>;
72
72
  startAutoRefreshToken(): Promise<void>;
73
73
  enableHttpHandler(): Promise<boolean | undefined>;
74
74
  disableHttpHandler(): Promise<boolean | undefined>;
75
- decodeJwtToken<R = Record<string, unknown>>(token?: string): Promise<R | undefined>;
75
+ decodeJwtToken<R = Record<string, unknown>>(token: string): Promise<R>;
76
76
  on(hook: string, callback: (response?: any) => void | Promise<void>, id?: string): Promise<void>;
77
77
  private _checkSession;
78
78
  private _shouldStopAuthn;
@@ -1 +1 @@
1
- {"version":3,"file":"ThunderIDBrowserClient.d.ts","sourceRoot":"","sources":["../src/ThunderIDBrowserClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,yBAAyB,EAEzB,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,aAAa,EAGb,OAAO,EAIP,iBAAiB,EACjB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,iB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M,GAAG,OAAO,CAAC,IAAI,CAAC;YA4D/F,aAAa;YAcb,gBAAgB;IAW9B,OAAO,CAAC,sCAAsC;YAMhC,yBAAyB;IAqBvB,aAAa,IAAI,MAAM;WAInB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlD;AAED,eAAe,sBAAsB,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -35,6 +35,43 @@ fast_sha256 = __toESM(fast_sha256);
35
35
  let jose = require("jose");
36
36
  jose = __toESM(jose);
37
37
 
38
+ //#region src/constants/SPAConstants.ts
39
+ /**
40
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
41
+ *
42
+ * WSO2 LLC. licenses this file to you under the Apache License,
43
+ * Version 2.0 (the "License"); you may not use this file except
44
+ * in compliance with the License.
45
+ * You may obtain a copy of the License at
46
+ *
47
+ * http://www.apache.org/licenses/LICENSE-2.0
48
+ *
49
+ * Unless required by applicable law or agreed to in writing,
50
+ * software distributed under the License is distributed on an
51
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
52
+ * KIND, either express or implied. See the License for the
53
+ * specific language governing permissions and limitations
54
+ * under the License.
55
+ */
56
+ const ERROR = "error";
57
+ const ERROR_DESCRIPTION = "error_description";
58
+ const CUSTOM_GRANT_CONFIG = "custom_grant_config";
59
+ const STATE_QUERY = "state";
60
+ const OP_IFRAME = "opIFrame";
61
+ const RP_IFRAME = "rpIFrame";
62
+ const PROMPT_NONE_IFRAME = "promptNoneIFrame";
63
+ const STATE = "Y2hlY2tTZXNzaW9u";
64
+ const SILENT_SIGN_IN_STATE = "sign-in-silently";
65
+ const INITIALIZED_SILENT_SIGN_IN = "initialized-silent-sign-in";
66
+ const PROMPT_NONE_REQUEST_SENT = "promptNoneRequestSent";
67
+ const ACCESS_TOKEN_INVALID = "Access token is invalid";
68
+ const REFRESH_ACCESS_TOKEN_ERR0R = "refresh-access-token-error";
69
+ const TOKEN_REQUEST_CONFIG_KEY = "token_request_config";
70
+ const CHECK_SESSION_SIGNED_IN = "check_session_signed_in";
71
+ const CHECK_SESSION_SIGNED_OUT = "check_session_signed_out";
72
+ const SET_SESSION_STATE_FROM_IFRAME = "set_session_state_from_iframe";
73
+
74
+ //#endregion
38
75
  //#region src/FetchHttpClient.ts
39
76
  /**
40
77
  * Fetch-based HTTP client. Extends `HttpClient` and implements `transport()`
@@ -107,98 +144,6 @@ var FetchHttpClient = class FetchHttpClient extends __thunderid_javascript.HttpC
107
144
  };
108
145
  var FetchHttpClient_default = FetchHttpClient;
109
146
 
110
- //#endregion
111
- //#region src/constants/SPAConstants.ts
112
- /**
113
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
114
- *
115
- * WSO2 LLC. licenses this file to you under the Apache License,
116
- * Version 2.0 (the "License"); you may not use this file except
117
- * in compliance with the License.
118
- * You may obtain a copy of the License at
119
- *
120
- * http://www.apache.org/licenses/LICENSE-2.0
121
- *
122
- * Unless required by applicable law or agreed to in writing,
123
- * software distributed under the License is distributed on an
124
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
125
- * KIND, either express or implied. See the License for the
126
- * specific language governing permissions and limitations
127
- * under the License.
128
- */
129
- const ERROR = "error";
130
- const ERROR_DESCRIPTION = "error_description";
131
- const CUSTOM_GRANT_CONFIG = "custom_grant_config";
132
- const STATE_QUERY = "state";
133
- const OP_IFRAME = "opIFrame";
134
- const RP_IFRAME = "rpIFrame";
135
- const PROMPT_NONE_IFRAME = "promptNoneIFrame";
136
- const STATE = "Y2hlY2tTZXNzaW9u";
137
- const SILENT_SIGN_IN_STATE = "sign-in-silently";
138
- const INITIALIZED_SILENT_SIGN_IN = "initialized-silent-sign-in";
139
- const PROMPT_NONE_REQUEST_SENT = "promptNoneRequestSent";
140
- const ACCESS_TOKEN_INVALID = "Access token is invalid";
141
- const REFRESH_ACCESS_TOKEN_ERR0R = "refresh-access-token-error";
142
- const TOKEN_REQUEST_CONFIG_KEY = "token_request_config";
143
- const CHECK_SESSION_SIGNED_IN = "check_session_signed_in";
144
- const CHECK_SESSION_SIGNED_OUT = "check_session_signed_out";
145
- const SET_SESSION_STATE_FROM_IFRAME = "set_session_state_from_iframe";
146
-
147
- //#endregion
148
- //#region src/utils/navigate.ts
149
- /**
150
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
151
- *
152
- * WSO2 LLC. licenses this file to you under the Apache License,
153
- * Version 2.0 (the "License"); you may not use this file except
154
- * in compliance with the License.
155
- * You may obtain a copy of the License at
156
- *
157
- * http://www.apache.org/licenses/LICENSE-2.0
158
- *
159
- * Unless required by applicable law or agreed to in writing,
160
- * software distributed under the License is distributed on an
161
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162
- * KIND, either express or implied. See the License for the
163
- * specific language governing permissions and limitations
164
- * under the License.
165
- */
166
- /**
167
- * Navigates to a new URL within the browser.
168
- *
169
- * - For same-origin URLs (relative paths or absolute URLs with the same origin),
170
- * uses the History API and dispatches a `popstate` event (SPA navigation).
171
- * - For cross-origin URLs, performs a full page load using `window.location.assign`.
172
- *
173
- * This allows seamless navigation for both SPA routes and external links.
174
- *
175
- * @param url - The target URL to navigate to. Can be a path, query, or absolute URL.
176
- *
177
- * @example
178
- * ```typescript
179
- * // SPA navigation (same origin)
180
- * navigate('/dashboard');
181
- *
182
- * // SPA navigation with query
183
- * navigate('/search?q=thunderid');
184
- *
185
- * // Cross-origin navigation (full page load)
186
- * navigate('https://accounts.asgardeo.io/t/dxlab/accountrecoveryendpoint/register.do');
187
- * ```
188
- */
189
- const navigate = (url) => {
190
- try {
191
- const targetUrl = new URL(url, window.location.origin);
192
- if (targetUrl.origin === window.location.origin) {
193
- window.history.pushState(null, "", targetUrl.pathname + targetUrl.search + targetUrl.hash);
194
- window.dispatchEvent(new PopStateEvent("popstate", { state: null }));
195
- } else window.location.assign(targetUrl.href);
196
- } catch {
197
- window.location.assign(url);
198
- }
199
- };
200
- var navigate_default = navigate;
201
-
202
147
  //#endregion
203
148
  //#region src/models/BrowserStorage.ts
204
149
  /**
@@ -306,22 +251,22 @@ var SPAUtils = class SPAUtils {
306
251
  history.pushState({}, document.title, url.replace(/\?code=.*$/, ""));
307
252
  }
308
253
  /**
309
- * Retrieves a PKCE verifier from sessionStorage.
254
+ * Retrieves a PKCE verifier from storage.
310
255
  *
311
256
  * @param pkceKey - The storage key for the PKCE verifier.
312
257
  * @returns The stored verifier string, or an empty string if not found.
313
258
  */
314
259
  static getPKCE(pkceKey) {
315
- return sessionStorage.getItem(pkceKey) ?? "";
260
+ return localStorage.getItem(pkceKey) ?? "";
316
261
  }
317
262
  /**
318
- * Persists a PKCE verifier in sessionStorage.
263
+ * Persists a PKCE verifier in storage.
319
264
  *
320
265
  * @param pkceKey - The storage key.
321
266
  * @param pkce - The PKCE verifier value.
322
267
  */
323
268
  static setPKCE(pkceKey, pkce) {
324
- sessionStorage.setItem(pkceKey, pkce);
269
+ localStorage.setItem(pkceKey, pkce);
325
270
  }
326
271
  /**
327
272
  * Persists the post-sign-out redirect URL for the given client and instance.
@@ -344,12 +289,12 @@ var SPAUtils = class SPAUtils {
344
289
  return sessionStorage.getItem(`${__thunderid_javascript.OIDCRequestConstants.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${instanceId}-${clientId}`) ?? "";
345
290
  }
346
291
  /**
347
- * Removes a PKCE verifier from sessionStorage.
292
+ * Removes a PKCE verifier from storage.
348
293
  *
349
294
  * @param pkceKey - The storage key to remove.
350
295
  */
351
296
  static removePKCE(pkceKey) {
352
- sessionStorage.removeItem(pkceKey);
297
+ localStorage.removeItem(pkceKey);
353
298
  }
354
299
  /**
355
300
  * Determines whether the `signIn` method should continue based on the `callOnlyOnRedirect` flag.
@@ -889,6 +834,61 @@ var AuthenticationHelper = class {
889
834
  };
890
835
  var AuthenticationHelper_default = AuthenticationHelper;
891
836
 
837
+ //#endregion
838
+ //#region src/utils/navigate.ts
839
+ /**
840
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
841
+ *
842
+ * WSO2 LLC. licenses this file to you under the Apache License,
843
+ * Version 2.0 (the "License"); you may not use this file except
844
+ * in compliance with the License.
845
+ * You may obtain a copy of the License at
846
+ *
847
+ * http://www.apache.org/licenses/LICENSE-2.0
848
+ *
849
+ * Unless required by applicable law or agreed to in writing,
850
+ * software distributed under the License is distributed on an
851
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
852
+ * KIND, either express or implied. See the License for the
853
+ * specific language governing permissions and limitations
854
+ * under the License.
855
+ */
856
+ /**
857
+ * Navigates to a new URL within the browser.
858
+ *
859
+ * - For same-origin URLs (relative paths or absolute URLs with the same origin),
860
+ * uses the History API and dispatches a `popstate` event (SPA navigation).
861
+ * - For cross-origin URLs, performs a full page load using `window.location.assign`.
862
+ *
863
+ * This allows seamless navigation for both SPA routes and external links.
864
+ *
865
+ * @param url - The target URL to navigate to. Can be a path, query, or absolute URL.
866
+ *
867
+ * @example
868
+ * ```typescript
869
+ * // SPA navigation (same origin)
870
+ * navigate('/dashboard');
871
+ *
872
+ * // SPA navigation with query
873
+ * navigate('/search?q=thunderid');
874
+ *
875
+ * // Cross-origin navigation (full page load)
876
+ * navigate('https://localhost:8090/accountrecoveryendpoint/register.do');
877
+ * ```
878
+ */
879
+ const navigate = (url) => {
880
+ try {
881
+ const targetUrl = new URL(url, window.location.origin);
882
+ if (targetUrl.origin === window.location.origin) {
883
+ window.history.pushState(null, "", targetUrl.pathname + targetUrl.search + targetUrl.hash);
884
+ window.dispatchEvent(new PopStateEvent("popstate", { state: null }));
885
+ } else window.location.assign(targetUrl.href);
886
+ } catch {
887
+ window.location.assign(url);
888
+ }
889
+ };
890
+ var navigate_default = navigate;
891
+
892
892
  //#endregion
893
893
  //#region src/utils/SessionManagementHelper.ts
894
894
  /**
@@ -2849,7 +2849,7 @@ var ThunderIDBrowserClient = class ThunderIDBrowserClient extends __thunderid_ja
2849
2849
  SPAUtils_default.setPKCE(pkceKey, await this.getPKCECode(resolvedState));
2850
2850
  }
2851
2851
  if (tokenRequestConfig) sm.setTemporaryDataParameter(TOKEN_REQUEST_CONFIG_KEY, JSON.stringify(tokenRequestConfig));
2852
- if (signInConfig?.["response_mode"] === "direct") {
2852
+ if (signInConfig?.response_mode === "direct") {
2853
2853
  const authorizeUrl = new URL(url);
2854
2854
  return (0, __thunderid_javascript.initializeEmbeddedSignInFlow)({
2855
2855
  url: `${authorizeUrl.origin}${authorizeUrl.pathname}`,
@@ -2971,8 +2971,7 @@ var ThunderIDBrowserClient = class ThunderIDBrowserClient extends __thunderid_ja
2971
2971
  if (config.signInRequired) await this._validateMethod();
2972
2972
  if (!config.id) return Promise.reject(new __thunderid_javascript.ThunderIDAuthException("SPA-AUTH_CLIENT-RCG-NF01", "The custom grant request id not found.", "Set the `id` attribute on the token exchange config."));
2973
2973
  const response = await this._authHelper.exchangeToken(config, (cfg) => this._enableRetrievingSignOutURLFromSession(cfg));
2974
- const cb = this._onCustomGrant.get(config.id);
2975
- cb && cb(response);
2974
+ this._onCustomGrant.get(config.id)?.(response);
2976
2975
  return response;
2977
2976
  }
2978
2977
  async reInitialize(config) {
@@ -3007,8 +3006,7 @@ var ThunderIDBrowserClient = class ThunderIDBrowserClient extends __thunderid_ja
3007
3006
  return true;
3008
3007
  }
3009
3008
  async decodeJwtToken(token) {
3010
- if (!token) return void 0;
3011
- return this.getCryptoHelper()?.decodeJwtToken(token);
3009
+ return this.getCryptoHelper().decodeJwtToken(token);
3012
3010
  }
3013
3011
  async on(hook, callback, id) {
3014
3012
  await this.isInitialized();
@@ -3034,10 +3032,10 @@ var ThunderIDBrowserClient = class ThunderIDBrowserClient extends __thunderid_ja
3034
3032
  this._httpFinishCallback = callback;
3035
3033
  break;
3036
3034
  case "http-request-start":
3037
- this._httpClient?.setHttpRequestStartCallback && this._httpClient.setHttpRequestStartCallback(callback);
3035
+ this._httpClient?.setHttpRequestStartCallback?.(callback);
3038
3036
  break;
3039
3037
  case "http-request-success":
3040
- this._httpClient?.setHttpRequestSuccessCallback && this._httpClient.setHttpRequestSuccessCallback(callback);
3038
+ this._httpClient?.setHttpRequestSuccessCallback?.(callback);
3041
3039
  break;
3042
3040
  case "custom-grant":
3043
3041
  id && this._onCustomGrant.set(id, callback);