@thunderid/browser 0.0.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/LICENSE +201 -0
- package/dist/FetchHttpClient.d.ts +33 -0
- package/dist/FetchHttpClient.d.ts.map +1 -0
- package/dist/ThunderIDBrowserClient.d.ts +29 -0
- package/dist/ThunderIDBrowserClient.d.ts.map +1 -0
- package/dist/__legacy__/client.d.ts +767 -0
- package/dist/__legacy__/client.d.ts.map +1 -0
- package/dist/__legacy__/clients/index.d.ts +20 -0
- package/dist/__legacy__/clients/index.d.ts.map +1 -0
- package/dist/__legacy__/clients/main-thread-client.d.ts +23 -0
- package/dist/__legacy__/clients/main-thread-client.d.ts.map +1 -0
- package/dist/__legacy__/clients/web-worker-client.d.ts +22 -0
- package/dist/__legacy__/clients/web-worker-client.d.ts.map +1 -0
- package/dist/__legacy__/constants/errors.d.ts +19 -0
- package/dist/__legacy__/constants/errors.d.ts.map +1 -0
- package/dist/__legacy__/constants/hooks.d.ts +30 -0
- package/dist/__legacy__/constants/hooks.d.ts.map +1 -0
- package/dist/__legacy__/constants/index.d.ts +24 -0
- package/dist/__legacy__/constants/index.d.ts.map +1 -0
- package/dist/__legacy__/constants/messages-types.d.ts +52 -0
- package/dist/__legacy__/constants/messages-types.d.ts.map +1 -0
- package/dist/__legacy__/constants/parameters.d.ts +22 -0
- package/dist/__legacy__/constants/parameters.d.ts.map +1 -0
- package/dist/__legacy__/constants/session-management.d.ts +26 -0
- package/dist/__legacy__/constants/session-management.d.ts.map +1 -0
- package/dist/__legacy__/constants/storage.d.ts +19 -0
- package/dist/__legacy__/constants/storage.d.ts.map +1 -0
- package/dist/__legacy__/helpers/authentication-helper.d.ts +59 -0
- package/dist/__legacy__/helpers/authentication-helper.d.ts.map +1 -0
- package/dist/__legacy__/helpers/index.d.ts +21 -0
- package/dist/__legacy__/helpers/index.d.ts.map +1 -0
- package/dist/__legacy__/helpers/session-management-helper.d.ts +21 -0
- package/dist/__legacy__/helpers/session-management-helper.d.ts.map +1 -0
- package/dist/__legacy__/helpers/spa-helper.d.ts +30 -0
- package/dist/__legacy__/helpers/spa-helper.d.ts.map +1 -0
- package/dist/__legacy__/models/client-config.d.ts +55 -0
- package/dist/__legacy__/models/client-config.d.ts.map +1 -0
- package/dist/__legacy__/models/client.d.ts +85 -0
- package/dist/__legacy__/models/client.d.ts.map +1 -0
- package/dist/__legacy__/models/http-client.d.ts +30 -0
- package/dist/__legacy__/models/http-client.d.ts.map +1 -0
- package/dist/__legacy__/models/index.d.ts +27 -0
- package/dist/__legacy__/models/index.d.ts.map +1 -0
- package/dist/__legacy__/models/message.d.ts +47 -0
- package/dist/__legacy__/models/message.d.ts.map +1 -0
- package/dist/__legacy__/models/request-custom-grant.d.ts +25 -0
- package/dist/__legacy__/models/request-custom-grant.d.ts.map +1 -0
- package/dist/__legacy__/models/session-management-helper.d.ts +24 -0
- package/dist/__legacy__/models/session-management-helper.d.ts.map +1 -0
- package/dist/__legacy__/models/sign-in.d.ts +22 -0
- package/dist/__legacy__/models/sign-in.d.ts.map +1 -0
- package/dist/__legacy__/models/sign-out-error.d.ts +22 -0
- package/dist/__legacy__/models/sign-out-error.d.ts.map +1 -0
- package/dist/__legacy__/models/storage.d.ts +39 -0
- package/dist/__legacy__/models/storage.d.ts.map +1 -0
- package/dist/__legacy__/models/web-worker.d.ts +57 -0
- package/dist/__legacy__/models/web-worker.d.ts.map +1 -0
- package/dist/__legacy__/stores/index.d.ts +21 -0
- package/dist/__legacy__/stores/index.d.ts.map +1 -0
- package/dist/__legacy__/stores/local-store.d.ts +24 -0
- package/dist/__legacy__/stores/local-store.d.ts.map +1 -0
- package/dist/__legacy__/stores/memory-store.d.ts +26 -0
- package/dist/__legacy__/stores/memory-store.d.ts.map +1 -0
- package/dist/__legacy__/stores/session-store.d.ts +24 -0
- package/dist/__legacy__/stores/session-store.d.ts.map +1 -0
- package/dist/__legacy__/utils/crypto-utils.d.ts +32 -0
- package/dist/__legacy__/utils/crypto-utils.d.ts.map +1 -0
- package/dist/__legacy__/utils/index.d.ts +20 -0
- package/dist/__legacy__/utils/index.d.ts.map +1 -0
- package/dist/__legacy__/utils/message-utils.d.ts +38 -0
- package/dist/__legacy__/utils/message-utils.d.ts.map +1 -0
- package/dist/__legacy__/utils/spa-utils.d.ts +108 -0
- package/dist/__legacy__/utils/spa-utils.d.ts.map +1 -0
- package/dist/__legacy__/worker/index.d.ts +20 -0
- package/dist/__legacy__/worker/index.d.ts.map +1 -0
- package/dist/__legacy__/worker/worker-core.d.ts +22 -0
- package/dist/__legacy__/worker/worker-core.d.ts.map +1 -0
- package/dist/__legacy__/worker/worker-receiver.d.ts +22 -0
- package/dist/__legacy__/worker/worker-receiver.d.ts.map +1 -0
- package/dist/cjs/index.js +5172 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5136 -0
- package/dist/index.js.map +1 -0
- package/dist/models/config.d.ts +20 -0
- package/dist/models/config.d.ts.map +1 -0
- package/dist/theme/getActiveTheme.d.ts +28 -0
- package/dist/theme/getActiveTheme.d.ts.map +1 -0
- package/dist/theme/themeDetection.d.ts +41 -0
- package/dist/theme/themeDetection.d.ts.map +1 -0
- package/dist/utils/handleWebAuthnAuthentication.d.ts +98 -0
- package/dist/utils/handleWebAuthnAuthentication.d.ts.map +1 -0
- package/dist/utils/hasAuthParamsInUrl.d.ts +26 -0
- package/dist/utils/hasAuthParamsInUrl.d.ts.map +1 -0
- package/dist/utils/hasCalledForThisInstanceInUrl.d.ts +27 -0
- package/dist/utils/hasCalledForThisInstanceInUrl.d.ts.map +1 -0
- package/dist/utils/http.d.ts +51 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/navigate.d.ts +43 -0
- package/dist/utils/navigate.d.ts.map +1 -0
- package/dist/utils/v2/resolveEmojiUrisInHtml.d.ts +30 -0
- package/dist/utils/v2/resolveEmojiUrisInHtml.d.ts.map +1 -0
- package/dist/web.worker.d.ts +20 -0
- package/dist/web.worker.d.ts.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import { Config } from '@thunderid/javascript';
|
|
19
|
+
export type ThunderIDBrowserConfig = Config<'sessionStorage' | 'localStorage' | 'browserMemory' | 'webWorker'>;
|
|
20
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import { ThemeMode } from '@thunderid/javascript';
|
|
19
|
+
import { BrowserThemeDetection } from './themeDetection';
|
|
20
|
+
/**
|
|
21
|
+
* Gets the active theme based on the theme mode preference
|
|
22
|
+
* @param mode - The theme mode preference ('light', 'dark', 'system', or 'class')
|
|
23
|
+
* @param config - Additional configuration for theme detection
|
|
24
|
+
* @returns 'light' or 'dark' based on the resolved theme
|
|
25
|
+
*/
|
|
26
|
+
declare const getActiveTheme: (mode: ThemeMode, config?: BrowserThemeDetection) => ThemeMode;
|
|
27
|
+
export default getActiveTheme;
|
|
28
|
+
//# sourceMappingURL=getActiveTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getActiveTheme.d.ts","sourceRoot":"","sources":["../../src/theme/getActiveTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAgB,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAExE;;;;;GAKG;AACH,QAAA,MAAM,cAAc,GAAI,MAAM,SAAS,EAAE,SAAQ,qBAA0B,KAAG,SAwB7E,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
import { ThemeDetection, ThemeMode } from '@thunderid/javascript';
|
|
19
|
+
/**
|
|
20
|
+
* Extended theme detection config that includes DOM-specific options
|
|
21
|
+
*/
|
|
22
|
+
export interface BrowserThemeDetection extends ThemeDetection {
|
|
23
|
+
/**
|
|
24
|
+
* The element to observe for class changes
|
|
25
|
+
* @default document.documentElement (html element)
|
|
26
|
+
*/
|
|
27
|
+
targetElement?: HTMLElement;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Detects the current theme mode based on the specified method
|
|
31
|
+
*/
|
|
32
|
+
export declare const detectThemeMode: (mode: ThemeMode, config?: BrowserThemeDetection) => "light" | "dark";
|
|
33
|
+
/**
|
|
34
|
+
* Creates a MutationObserver to watch for class changes on the target element
|
|
35
|
+
*/
|
|
36
|
+
export declare const createClassObserver: (targetElement: HTMLElement, callback: (isDark: boolean) => void, config?: BrowserThemeDetection) => MutationObserver;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a media query listener for system theme changes
|
|
39
|
+
*/
|
|
40
|
+
export declare const createMediaQueryListener: (callback: (isDark: boolean) => void) => MediaQueryList | null;
|
|
41
|
+
//# sourceMappingURL=themeDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeDetection.d.ts","sourceRoot":"","sources":["../../src/theme/themeDetection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,cAAc,EAAE,SAAS,EAA+B,MAAM,uBAAuB,CAAC;AAO9F;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D;;;OAGG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC;CAC7B;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,SAAS,EAAE,SAAQ,qBAA0B,KAAG,OAAO,GAAG,MAwC/F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,eAAe,WAAW,EAC1B,UAAU,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,EACnC,SAAQ,qBAA0B,KACjC,gBAyBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,KAAG,cAAc,GAAG,IAoB/F,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
* Handles WebAuthn/Passkey authentication flow for browser environments.
|
|
20
|
+
*
|
|
21
|
+
* This function processes a WebAuthn challenge, performs the authentication ceremony,
|
|
22
|
+
* and returns the authentication response that can be sent to the server for verification.
|
|
23
|
+
*
|
|
24
|
+
* The function handles various aspects of WebAuthn authentication including:
|
|
25
|
+
* - Browser compatibility checks for WebAuthn support
|
|
26
|
+
* - HTTPS requirement validation (except for localhost development)
|
|
27
|
+
* - Relying Party ID validation and domain compatibility
|
|
28
|
+
* - Challenge data decoding and credential request options processing
|
|
29
|
+
* - User authentication ceremony via navigator.credentials.get()
|
|
30
|
+
* - Response formatting for server consumption
|
|
31
|
+
*
|
|
32
|
+
* @param challengeData - Base64-encoded challenge data containing WebAuthn request options.
|
|
33
|
+
* This data typically includes the challenge, RP ID, allowed credentials,
|
|
34
|
+
* user verification requirements, and other authentication parameters.
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise that resolves to a JSON string containing the WebAuthn authentication response.
|
|
37
|
+
* The response includes the credential ID, authenticator data, client data JSON,
|
|
38
|
+
* signature, and optional user handle that can be verified by the server.
|
|
39
|
+
*
|
|
40
|
+
* @throws {ThunderIDRuntimeError} When WebAuthn is not supported in the current browser
|
|
41
|
+
* @throws {ThunderIDRuntimeError} When the page is not served over HTTPS (except localhost)
|
|
42
|
+
* @throws {ThunderIDRuntimeError} When the user cancels or times out the authentication
|
|
43
|
+
* @throws {ThunderIDRuntimeError} When there's a domain/RP ID mismatch
|
|
44
|
+
* @throws {ThunderIDRuntimeError} When no valid passkey is found for the account
|
|
45
|
+
* @throws {ThunderIDRuntimeError} When WebAuthn is not supported on the device/browser
|
|
46
|
+
* @throws {ThunderIDRuntimeError} When there's a network error during authentication
|
|
47
|
+
* @throws {ThunderIDRuntimeError} For any other authentication failures
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* try {
|
|
52
|
+
* const challengeData = 'eyJwdWJsaWNLZXlDcmVkZW50aWFsUmVxdWVzdE9wdGlvbnMiOi4uLn0=';
|
|
53
|
+
* const authResponse = await handleWebAuthnAuthentication(challengeData);
|
|
54
|
+
*
|
|
55
|
+
* // Send the response to your server for verification
|
|
56
|
+
* const result = await fetch('/api/verify-webauthn', {
|
|
57
|
+
* method: 'POST',
|
|
58
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
59
|
+
* body: authResponse
|
|
60
|
+
* });
|
|
61
|
+
* } catch (error) {
|
|
62
|
+
* if (error instanceof ThunderIDRuntimeError) {
|
|
63
|
+
* console.error('WebAuthn authentication failed:', error.message);
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* // Usage in an authentication flow
|
|
71
|
+
* const authenticateWithPasskey = async (challengeFromServer: string) => {
|
|
72
|
+
* try {
|
|
73
|
+
* const response = await handleWebAuthnAuthentication(challengeFromServer);
|
|
74
|
+
* return JSON.parse(response);
|
|
75
|
+
* } catch (error) {
|
|
76
|
+
* // Handle specific error cases
|
|
77
|
+
* if (error instanceof ThunderIDRuntimeError) {
|
|
78
|
+
* switch (error.code) {
|
|
79
|
+
* case 'browser-webauthn-not-supported':
|
|
80
|
+
* showFallbackAuth();
|
|
81
|
+
* break;
|
|
82
|
+
* case 'browser-webauthn-user-cancelled':
|
|
83
|
+
* showRetryOption();
|
|
84
|
+
* break;
|
|
85
|
+
* default:
|
|
86
|
+
* showGenericError();
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
* };
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @see {@link https://webauthn.guide/} - WebAuthn specification guide
|
|
94
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API} - MDN WebAuthn API documentation
|
|
95
|
+
*/
|
|
96
|
+
declare const handleWebAuthnAuthentication: (challengeData: string) => Promise<string>;
|
|
97
|
+
export default handleWebAuthnAuthentication;
|
|
98
|
+
//# sourceMappingURL=handleWebAuthnAuthentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleWebAuthnAuthentication.d.ts","sourceRoot":"","sources":["../../src/utils/handleWebAuthnAuthentication.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,QAAA,MAAM,4BAA4B,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,MAAM,CAmKjF,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* Utility to check if `code` and `session_state` are available in the URL as search params.
|
|
20
|
+
*
|
|
21
|
+
* @param params - The URL search params to check. Defaults to `window.location.search`.
|
|
22
|
+
* @return `true` if the URL contains `code` and `session_state` search params, otherwise `false`.
|
|
23
|
+
*/
|
|
24
|
+
declare const hasAuthParamsInUrl: (params?: string) => boolean;
|
|
25
|
+
export default hasAuthParamsInUrl;
|
|
26
|
+
//# sourceMappingURL=hasAuthParamsInUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasAuthParamsInUrl.d.ts","sourceRoot":"","sources":["../../src/utils/hasAuthParamsInUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,GAAI,SAAQ,MAA+B,KAAG,OAIrE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
* Utility to check if `state` is available in the URL as a search param and matches the provided instance.
|
|
20
|
+
*
|
|
21
|
+
* @param params - The URL search params to check. Defaults to `window.location.search`.
|
|
22
|
+
* @param instanceId - The instance ID to match against the `state` param.
|
|
23
|
+
* @return `true` if the URL contains a matching `state` search param, otherwise `false`.
|
|
24
|
+
*/
|
|
25
|
+
declare const hasCalledForThisInstanceInUrl: (instanceId: number, params?: string) => boolean;
|
|
26
|
+
export default hasCalledForThisInstanceInUrl;
|
|
27
|
+
//# sourceMappingURL=hasCalledForThisInstanceInUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasCalledForThisInstanceInUrl.d.ts","sourceRoot":"","sources":["../../src/utils/hasCalledForThisInstanceInUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;GAMG;AACH,QAAA,MAAM,6BAA6B,GAAI,YAAY,MAAM,EAAE,SAAQ,MAA+B,KAAG,OAIpG,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
import { ThunderIDSPAClient } from '../__legacy__/client';
|
|
19
|
+
/**
|
|
20
|
+
* Creates an HTTP utility for making requests using a specific ThunderIDSPAClient instance.
|
|
21
|
+
*
|
|
22
|
+
* @param instanceId - Optional instance ID for multi-instance support. Defaults to 0.
|
|
23
|
+
* @returns An object with request and requestAll methods bound to the specified instance.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This utility provides methods to make single or multiple HTTP requests for a specific instance.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Use default instance
|
|
31
|
+
* const httpClient = http();
|
|
32
|
+
*
|
|
33
|
+
* // Use specific instance
|
|
34
|
+
* const httpInstance1 = http(1);
|
|
35
|
+
* const httpInstance2 = http(2);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const http: (instanceId?: number) => {
|
|
39
|
+
request: typeof ThunderIDSPAClient.prototype.httpRequest;
|
|
40
|
+
requestAll: typeof ThunderIDSPAClient.prototype.httpRequestAll;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Default HTTP utility using instance 0.
|
|
44
|
+
* For multi-instance support, use http(instanceId) instead.
|
|
45
|
+
*/
|
|
46
|
+
declare const _default: {
|
|
47
|
+
request: typeof ThunderIDSPAClient.prototype.httpRequest;
|
|
48
|
+
requestAll: typeof ThunderIDSPAClient.prototype.httpRequestAll;
|
|
49
|
+
};
|
|
50
|
+
export default _default;
|
|
51
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GACf,mBAAc,KACb;IACD,OAAO,EAAE,OAAO,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC;IACzD,UAAU,EAAE,OAAO,kBAAkB,CAAC,SAAS,CAAC,cAAc,CAAC;CAqBhE,CAAC;AAEF;;;GAGG;;aA3BQ,OAAO,kBAAkB,CAAC,SAAS,CAAC,WAAW;gBAC5C,OAAO,kBAAkB,CAAC,SAAS,CAAC,cAAc;;AA2BhE,wBAAsB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
* Navigates to a new URL within the browser.
|
|
20
|
+
*
|
|
21
|
+
* - For same-origin URLs (relative paths or absolute URLs with the same origin),
|
|
22
|
+
* uses the History API and dispatches a `popstate` event (SPA navigation).
|
|
23
|
+
* - For cross-origin URLs, performs a full page load using `window.location.assign`.
|
|
24
|
+
*
|
|
25
|
+
* This allows seamless navigation for both SPA routes and external links.
|
|
26
|
+
*
|
|
27
|
+
* @param url - The target URL to navigate to. Can be a path, query, or absolute URL.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // SPA navigation (same origin)
|
|
32
|
+
* navigate('/dashboard');
|
|
33
|
+
*
|
|
34
|
+
* // SPA navigation with query
|
|
35
|
+
* navigate('/search?q=thunderid');
|
|
36
|
+
*
|
|
37
|
+
* // Cross-origin navigation (full page load)
|
|
38
|
+
* navigate('https://accounts.asgardeo.io/t/dxlab/accountrecoveryendpoint/register.do');
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare const navigate: (url: string) => void;
|
|
42
|
+
export default navigate;
|
|
43
|
+
//# sourceMappingURL=navigate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigate.d.ts","sourceRoot":"","sources":["../../src/utils/navigate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,IAa/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Resolves `emoji:` URIs in an HTML string.
|
|
20
|
+
*
|
|
21
|
+
* Handles two forms:
|
|
22
|
+
* - `<img src="emoji:🐯" alt="tiger">` → `<span role="img" aria-label="tiger">🐯</span>`
|
|
23
|
+
* - Bare `emoji:🐯` text references → `🐯`
|
|
24
|
+
*
|
|
25
|
+
* @param html - The HTML string that may contain `emoji:` URIs.
|
|
26
|
+
* @returns The HTML string with all `emoji:` URIs replaced.
|
|
27
|
+
*/
|
|
28
|
+
declare const resolveEmojiUrisInHtml: (html: string) => string;
|
|
29
|
+
export default resolveEmojiUrisInHtml;
|
|
30
|
+
//# sourceMappingURL=resolveEmojiUrisInHtml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveEmojiUrisInHtml.d.ts","sourceRoot":"","sources":["../../../src/utils/v2/resolveEmojiUrisInHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;;;;;;;;GASG;AACH,QAAA,MAAM,sBAAsB,GAAI,MAAM,MAAM,KAAG,MAgB9C,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
declare const _default: typeof Worker & (new () => Worker);
|
|
19
|
+
export default _default;
|
|
20
|
+
//# sourceMappingURL=web.worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.worker.d.ts","sourceRoot":"","sources":["../src/web.worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;wBA0BkB,OAAO,MAAM,GAAG,CAAC,UAAU,MAAM,CAAC;AAAvD,wBAAwD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thunderid/browser",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Browser runtime SDK for ThunderID",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"thunderid",
|
|
7
|
+
"browser",
|
|
8
|
+
"spa"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/thunder-id/thunderid/tree/main/sdks/browser#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/thunder-id/thunderid/issues"
|
|
13
|
+
},
|
|
14
|
+
"author": "WSO2",
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "dist/cjs/index.js",
|
|
18
|
+
"module": "dist/index.js",
|
|
19
|
+
"exports": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/cjs/index.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/thunder-id/thunderid",
|
|
32
|
+
"directory": "sdks/browser"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "24.7.2",
|
|
36
|
+
"@vitest/browser-playwright": "4.1.3",
|
|
37
|
+
"eslint": "9.39.4",
|
|
38
|
+
"jsdom": "27.0.1",
|
|
39
|
+
"playwright": "1.58.1",
|
|
40
|
+
"prettier": "3.6.2",
|
|
41
|
+
"rimraf": "6.1.3",
|
|
42
|
+
"rolldown": "1.0.0-beta.45",
|
|
43
|
+
"typescript": "5.9.3",
|
|
44
|
+
"vitest": "4.1.3",
|
|
45
|
+
"@thunderid/eslint-plugin": "^0.0.0",
|
|
46
|
+
"@thunderid/prettier-config": "^0.0.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"base64url": "3.0.1",
|
|
50
|
+
"buffer": "6.0.3",
|
|
51
|
+
"core-js": "3.42.0",
|
|
52
|
+
"crypto-browserify": "3.12.1",
|
|
53
|
+
"fast-sha256": "1.3.0",
|
|
54
|
+
"jose": "5.2.0",
|
|
55
|
+
"process": "0.11.10",
|
|
56
|
+
"randombytes": "2.1.0",
|
|
57
|
+
"stream-browserify": "3.0.0",
|
|
58
|
+
"tslib": "2.8.1",
|
|
59
|
+
"@thunderid/javascript": "^0.0.0"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "pnpm clean && node rolldown.config.js && tsc -p tsconfig.lib.json --emitDeclarationOnly --outDir dist",
|
|
66
|
+
"clean": "rimraf dist",
|
|
67
|
+
"format:check": "prettier --check --cache .",
|
|
68
|
+
"format:fix": "prettier --write --cache .",
|
|
69
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
70
|
+
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
71
|
+
"test": "vitest",
|
|
72
|
+
"test:browser": "vitest --workspace=vitest.workspace.ts",
|
|
73
|
+
"typecheck": "tsc -p tsconfig.lib.json"
|
|
74
|
+
}
|
|
75
|
+
}
|