@asgardeo/javascript 0.0.1 → 0.1.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 (56) hide show
  1. package/README.md +3 -3
  2. package/dist/AsgardeoJavaScriptClient.d.ts +2 -1
  3. package/dist/IsomorphicCrypto.d.ts +4 -4
  4. package/dist/{__legacy__/data/data-layer.d.ts → StorageManager.d.ts} +26 -25
  5. package/dist/__legacy__/client.d.ts +82 -98
  6. package/dist/__legacy__/helpers/authentication-helper.d.ts +8 -8
  7. package/dist/__legacy__/models/client-config.d.ts +6 -6
  8. package/dist/__legacy__/models/index.d.ts +0 -5
  9. package/dist/api/{oidc/getUserInfo.d.ts → getUserInfo.d.ts} +1 -1
  10. package/dist/api/handleApplicationNativeAuthentication.d.ts +33 -0
  11. package/dist/api/initializeApplicationNativeAuthentication.d.ts +117 -0
  12. package/dist/cjs/index.js +1581 -1188
  13. package/dist/cjs/index.js.map +4 -4
  14. package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts +39 -0
  15. package/dist/constants/OIDCRequestConstants.d.ts +14 -0
  16. package/dist/constants/PKCEConstants.d.ts +1 -0
  17. package/dist/constants/TokenExchangeConstants.d.ts +1 -1
  18. package/dist/{__legacy__/exception → errors}/exception.d.ts +3 -0
  19. package/dist/{__legacy__/data/index.d.ts → i18n/en-US.d.ts} +4 -2
  20. package/dist/{__legacy__/exception → i18n}/index.d.ts +2 -2
  21. package/dist/index.d.ts +28 -10
  22. package/dist/index.js +1562 -1184
  23. package/dist/index.js.map +4 -4
  24. package/dist/models/application-native-authentication.d.ts +82 -0
  25. package/dist/models/client.d.ts +8 -2
  26. package/dist/models/config.d.ts +26 -1
  27. package/dist/models/crypto.d.ts +2 -2
  28. package/dist/{__legacy__/models/custom-grant.d.ts → models/field.d.ts} +13 -9
  29. package/dist/models/i18n.d.ts +66 -0
  30. package/dist/{__legacy__/models/authorization-url.d.ts → models/oauth-request.d.ts} +3 -3
  31. package/dist/models/oauth-response.d.ts +1 -17
  32. package/dist/models/scim2-schema.d.ts +3 -0
  33. package/dist/{__legacy__/models/data.d.ts → models/session.d.ts} +4 -0
  34. package/dist/models/store.d.ts +1 -1
  35. package/dist/models/token.d.ts +47 -0
  36. package/dist/models/user.d.ts +11 -84
  37. package/dist/theme/types.d.ts +0 -1
  38. package/dist/utils/deepMerge.d.ts +44 -0
  39. package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +1 -1
  40. package/dist/utils/extractUserClaimsFromIdToken.d.ts +1 -1
  41. package/dist/utils/flattenUserSchema.d.ts +64 -0
  42. package/dist/utils/generateFlattenedUserProfile.d.ts +46 -0
  43. package/dist/utils/generateUserProfile.d.ts +55 -0
  44. package/dist/utils/get.d.ts +29 -0
  45. package/dist/utils/getAuthorizeRequestUrlParams.d.ts +59 -0
  46. package/dist/utils/getI18nBundles.d.ts +26 -0
  47. package/dist/utils/getLatestStateParam.d.ts +40 -0
  48. package/dist/utils/processOpenIDScopes.d.ts +36 -0
  49. package/dist/{__legacy__/core/index.d.ts → utils/resolveFieldName.d.ts} +3 -2
  50. package/dist/utils/resolveFieldType.d.ts +20 -0
  51. package/dist/utils/set.d.ts +30 -0
  52. package/package.json +4 -4
  53. package/dist/__legacy__/core/authentication-core.d.ts +0 -51
  54. package/dist/__legacy__/models/fetch.d.ts +0 -55
  55. package/dist/__legacy__/models/user.d.ts +0 -85
  56. package/dist/models/id-token.d.ts +0 -55
@@ -0,0 +1,46 @@
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 { User } from '../models/user';
19
+ /**
20
+ * Generates a flattened user profile from a response object and schema definitions.
21
+ *
22
+ * This function processes user data according to schema specifications, creating
23
+ * a flat object with dot notation keys instead of nested objects. Multi-valued
24
+ * properties and type-specific defaults are handled appropriately.
25
+ *
26
+ * @param meResponse - The response object containing user data
27
+ * @param processedSchemas - Array of schema objects defining field properties
28
+ * @param processedSchemas[].name - The field name/path for the property
29
+ * @param processedSchemas[].type - The data type of the field (e.g., 'STRING')
30
+ * @param processedSchemas[].multiValued - Whether the field can contain multiple values
31
+ *
32
+ * @returns A flattened user profile object with dot notation keys
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const schemas = [
37
+ * { name: 'name.givenName', type: 'STRING', multiValued: false },
38
+ * { name: 'emails', type: 'STRING', multiValued: true }
39
+ * ];
40
+ * const response = { name: { givenName: 'John' }, emails: 'john@example.com' };
41
+ * const profile = generateFlattenedUserProfile(response, schemas);
42
+ * // Result: { "name.givenName": 'John', emails: ['john@example.com'] }
43
+ * ```
44
+ */
45
+ declare const generateFlattenedUserProfile: (meResponse: any, processedSchemas: any[]) => User;
46
+ export default generateFlattenedUserProfile;
@@ -0,0 +1,55 @@
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 { User } from '../models/user';
19
+ /**
20
+ * Creates a profile structure from ME response based on processed schemas
21
+ *
22
+ * This function processes each schema attribute and populates the profile dynamically by:
23
+ * - Extracting values from the ME response using the schema attribute names
24
+ * - Handling multi-valued attributes by converting single values to arrays when needed
25
+ * - Setting appropriate default values based on schema type and multiValued properties
26
+ * - Using dynamic property setting to build the final profile object
27
+ *
28
+ * @param meResponse - The ME API response containing user data
29
+ * @param processedSchemas - The processed and flattened schemas with name, type, and multiValued properties
30
+ * @returns Flat profile object with dynamically populated user attributes
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const meResponse = {
35
+ * userName: 'john.doe',
36
+ * emails: ['john@example.com', 'john.doe@work.com'],
37
+ * name: { givenName: 'John', familyName: 'Doe' }
38
+ * };
39
+ *
40
+ * const schemas = [
41
+ * { name: 'userName', type: 'STRING', multiValued: false },
42
+ * { name: 'emails', type: 'STRING', multiValued: true },
43
+ * { name: 'name.givenName', type: 'STRING', multiValued: false }
44
+ * ];
45
+ *
46
+ * const profile = generateUserProfile(meResponse, schemas);
47
+ * // Result: {
48
+ * // userName: 'john.doe',
49
+ * // emails: ['john@example.com', 'john.doe@work.com'],
50
+ * // 'name.givenName': 'John'
51
+ * // }
52
+ * ```
53
+ */
54
+ declare const generateUserProfile: (meResponse: any, processedSchemas: any[]) => User;
55
+ export default generateUserProfile;
@@ -0,0 +1,29 @@
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
+ * Gets the value at path of object. If the resolved value is undefined,
20
+ * the defaultValue is returned in its place.
21
+ * Similar to Lodash's get() function
22
+ *
23
+ * @param object - The object to query
24
+ * @param path - The path of the property to get
25
+ * @param defaultValue - The value returned for undefined resolved values
26
+ * @returns The resolved value
27
+ */
28
+ declare const get: (object: any, path: string | string[], defaultValue?: any) => any;
29
+ export default get;
@@ -0,0 +1,59 @@
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 { ExtendedAuthorizeRequestUrlParams } from '../models/oauth-request';
19
+ /**
20
+ * Generates a map of authorization request URL parameters for OIDC authorization requests.
21
+ *
22
+ * This utility ensures the `openid` scope is always included, handles both string and array forms of the `scope` parameter,
23
+ * and supports PKCE and custom parameters. Throws if a code challenge is provided without a code challenge method.
24
+ *
25
+ * @param options - The main options for the authorization request, including redirectUri, clientId, scope, responseMode, codeChallenge, codeChallengeMethod, and prompt.
26
+ * @param pkceOptions - PKCE options, including the PKCE key for state correlation.
27
+ * @param customParams - Optional custom parameters to include in the request (excluding the `state` param, which is handled separately).
28
+ * @returns A Map of key-value pairs representing the authorization request URL parameters.
29
+ *
30
+ * @throws {AsgardeoRuntimeError} If a code challenge is provided without a code challenge method.
31
+ *
32
+ * @example
33
+ * const params = getAuthorizeRequestUrlParams({
34
+ * options: {
35
+ * redirectUri: 'https://app/callback',
36
+ * clientId: 'client123',
37
+ * scope: ['openid', 'profile'],
38
+ * responseMode: 'query',
39
+ * codeChallenge: 'abc',
40
+ * codeChallengeMethod: 'S256',
41
+ * prompt: 'login'
42
+ * },
43
+ * pkceOptions: { key: 'pkce_code_verifier_1' },
44
+ * customParams: { foo: 'bar' }
45
+ * });
46
+ * // Returns a Map with all required OIDC params, PKCE, and custom params.
47
+ */
48
+ declare const getAuthorizeRequestUrlParams: (options: {
49
+ redirectUri: string;
50
+ clientId: string;
51
+ scopes?: string;
52
+ responseMode?: string;
53
+ codeChallenge?: string;
54
+ codeChallengeMethod?: string;
55
+ prompt?: string;
56
+ } & ExtendedAuthorizeRequestUrlParams, pkceOptions: {
57
+ key: string;
58
+ }, customParams: Record<string, string | number | boolean>) => Map<string, string>;
59
+ export default getAuthorizeRequestUrlParams;
@@ -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
+ import * as i18n from '../i18n';
19
+ /**
20
+ * Get internationalization bundles for the specified locale.
21
+ *
22
+ * @param locale - The locale to get the bundle for (defaults to 'en-US')
23
+ * @returns The i18n bundle for the specified locale
24
+ */
25
+ declare const getI18nBundles: () => typeof i18n;
26
+ export default getI18nBundles;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
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 { TemporaryStore } from '../models/store';
19
+ /**
20
+ * Finds the latest state parameter based on the most recent PKCE storage key.
21
+ *
22
+ * This utility combines the functionality of finding the latest PKCE key and generating
23
+ * the corresponding state parameter for request correlation.
24
+ *
25
+ * @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).
26
+ * @param state - Optional state string to prepend to the request correlation.
27
+ * @returns The latest state parameter string or null if no PKCE keys exist.
28
+ *
29
+ * @example
30
+ * const latestState = getLatestStateParam(sessionStorage, "myState");
31
+ * // Returns: "myState_request_2" (if latest PKCE key is pkce_code_verifier_2)
32
+ *
33
+ * const latestStateNoPrefix = getLatestStateParam(sessionStorage);
34
+ * // Returns: "request_2" (if latest PKCE key is pkce_code_verifier_2)
35
+ *
36
+ * const noKeys = getLatestStateParam(emptyStorage);
37
+ * // Returns: null (if no PKCE keys exist)
38
+ */
39
+ declare const getLatestStateParam: (tempStore: TemporaryStore, state?: string) => string | null;
40
+ export default getLatestStateParam;
@@ -0,0 +1,36 @@
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
+ * Processes OpenID scopes to ensure they are in the correct format.
20
+ * If the input is a string, it returns it as is.
21
+ * If the input is an array, it joins the elements into a single string separated by spaces.
22
+ * If the input is neither, it throws an error.
23
+ *
24
+ * @param scopes - The OpenID scopes to process, which can be a string or an array of strings.
25
+ * @returns A string of OpenID scopes separated by spaces.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * processOpenIDScopes("openid profile email"); // returns "openid profile email"
30
+ * processOpenIDScopes(["openid", "profile", "email"]); // returns "openid profile email"
31
+ * processOpenIDScopes(123); // throws AsgardeoRuntimeError
32
+ * processOpenIDScopes({}); // throws AsgardeoRuntimeError
33
+ * ```
34
+ */
35
+ declare const processOpenIDScopes: (scopes: string | string[]) => string;
36
+ export default processOpenIDScopes;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
2
+ * Copyright (c) 2025, 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
@@ -15,4 +15,5 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- export * from "./authentication-core";
18
+ declare const resolveFieldName: (field: any) => string;
19
+ export default resolveFieldName;
@@ -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 { FieldType } from '../models/field';
19
+ declare const resolveFieldType: (field: any) => FieldType;
20
+ export default resolveFieldType;
@@ -0,0 +1,30 @@
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
+ * Sets the value at path of object. If a portion of path doesn't exist,
20
+ * it's created. Arrays are created for missing index properties while
21
+ * objects are created for all other missing properties.
22
+ * Similar to Lodash's set() function
23
+ *
24
+ * @param object - The object to modify
25
+ * @param path - The path of the property to set
26
+ * @param value - The value to set
27
+ * @returns The object
28
+ */
29
+ declare const set: (object: any, path: string | string[], value: any) => any;
30
+ export default set;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/javascript",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Framework agnostic JavaScript SDK for Asgardeo.",
5
5
  "keywords": [
6
6
  "asgardeo",
@@ -9,9 +9,9 @@
9
9
  "agnostic",
10
10
  "js"
11
11
  ],
12
- "homepage": "https://github.com/asgardeo/javascript/tree/main/packages/javascript#readme",
12
+ "homepage": "https://github.com/asgardeo/web-ui-sdks/tree/main/packages/javascript#readme",
13
13
  "bugs": {
14
- "url": "https://github.com/asgardeo/javascript/issues"
14
+ "url": "https://github.com/asgardeo/web-ui-sdks/issues"
15
15
  },
16
16
  "author": "WSO2",
17
17
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "types": "dist/index.d.ts",
31
31
  "repository": {
32
32
  "type": "git",
33
- "url": "https://github.com/asgardeo/javascript",
33
+ "url": "https://github.com/asgardeo/web-ui-sdks",
34
34
  "directory": "packages/javascript"
35
35
  },
36
36
  "devDependencies": {
@@ -1,51 +0,0 @@
1
- import { DataLayer } from '../data';
2
- import { AuthClientConfig, AuthorizationURLParams, BasicUserInfo, CustomGrantConfig, FetchResponse } from '../models';
3
- import { TokenResponse } from '../../models/token';
4
- import { Crypto } from '../../models/crypto';
5
- import { IdTokenPayload } from '../../models/id-token';
6
- import { OIDCEndpoints } from '../../models/oidc-endpoints';
7
- import { IsomorphicCrypto } from '../../IsomorphicCrypto';
8
- export declare class AuthenticationCore<T> {
9
- private _dataLayer;
10
- private _config;
11
- private _oidcProviderMetaData;
12
- private _authenticationHelper;
13
- private _cryptoUtils;
14
- private _cryptoHelper;
15
- constructor(dataLayer: DataLayer<T>, cryptoUtils: Crypto);
16
- getAuthorizationURLParams(config?: AuthorizationURLParams, userID?: string): Promise<Map<string, string>>;
17
- getAuthorizationURL(config?: AuthorizationURLParams, userID?: string): Promise<string>;
18
- requestAccessToken(authorizationCode: string, sessionState: string, state: string, userID?: string, tokenRequestConfig?: {
19
- params: Record<string, unknown>;
20
- }): Promise<TokenResponse>;
21
- refreshAccessToken(userID?: string): Promise<TokenResponse>;
22
- revokeAccessToken(userID?: string): Promise<FetchResponse>;
23
- requestCustomGrant(customGrantParams: CustomGrantConfig, userID?: string): Promise<TokenResponse | FetchResponse>;
24
- getBasicUserInfo(userID?: string): Promise<BasicUserInfo>;
25
- getDecodedIDToken(userID?: string): Promise<IdTokenPayload>;
26
- getCryptoHelper(): Promise<IsomorphicCrypto>;
27
- getIDToken(userID?: string): Promise<string>;
28
- getOIDCProviderMetaData(forceInit: boolean): Promise<void>;
29
- getOIDCServiceEndpoints(): Promise<Partial<OIDCEndpoints>>;
30
- getSignOutURL(userID?: string): Promise<string>;
31
- clearUserSessionData(userID?: string): Promise<void>;
32
- getAccessToken(userID?: string): Promise<string>;
33
- /**
34
- * The created timestamp of the token response in milliseconds.
35
- *
36
- * @param userID - User ID
37
- * @returns Created at timestamp of the token response in milliseconds.
38
- */
39
- getCreatedAt(userID?: string): Promise<number>;
40
- /**
41
- * The expires timestamp of the token response in seconds.
42
- *
43
- * @param userID - User ID
44
- * @returns Expires in timestamp of the token response in seconds.
45
- */
46
- getExpiresIn(userID?: string): Promise<string>;
47
- isAuthenticated(userID?: string): Promise<boolean>;
48
- getPKCECode(state: string, userID?: string): Promise<string>;
49
- setPKCECode(pkce: string, state: string, userID?: string): Promise<void>;
50
- updateConfig(config: Partial<AuthClientConfig<T>>): Promise<void>;
51
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
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
- export type Method = "get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "purge" | "PURGE" | "link" | "LINK" | "unlink" | "UNLINK";
19
- export type FetchCredentials = "omit" | "same-origin" | "include";
20
- export type FetchRedirect = "follow" | "error" | "manual";
21
- export interface FetchRequestConfig extends RequestInit {
22
- method?: Method;
23
- url?: string;
24
- credentials?: FetchCredentials;
25
- body?: any;
26
- bodyUsed?: boolean;
27
- cache?: any;
28
- destination?: string;
29
- integrity?: string;
30
- mode?: any;
31
- redirect?: FetchRedirect;
32
- referrer?: string;
33
- referrerPolicy?: any;
34
- }
35
- export interface FetchResponse<T = any> extends ResponseInit {
36
- body: T;
37
- ok: boolean;
38
- bodyUsed?: boolean;
39
- redirected?: boolean;
40
- type: any;
41
- url: string;
42
- json(): any;
43
- text(): any;
44
- formData(): any;
45
- blob(): any;
46
- arrayBuffer(): any;
47
- }
48
- export interface FetchError<T = any> extends Error {
49
- config: FetchRequestConfig;
50
- code?: string;
51
- request?: any;
52
- response?: FetchResponse<T>;
53
- isFetchError: boolean;
54
- toJSON: () => object;
55
- }
@@ -1,85 +0,0 @@
1
- /**
2
- * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
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
- * Interface containing the basic user information.
20
- */
21
- export interface BasicUserInfo {
22
- /**
23
- * The email address of the user.
24
- */
25
- email?: string | undefined;
26
- /**
27
- * The username of the user.
28
- */
29
- username?: string | undefined;
30
- /**
31
- * The display name of the user. It is the preferred_username in the id token payload or the `sub`.
32
- */
33
- displayName?: string | undefined;
34
- /**
35
- * The scopes allowed for the user.
36
- */
37
- allowedScopes: string;
38
- /**
39
- * The tenant domain to which the user belongs.
40
- */
41
- tenantDomain?: string | undefined;
42
- /**
43
- * The session state.
44
- */
45
- sessionState: string;
46
- /**
47
- * The `uid` corresponding to the user who the ID token belongs to.
48
- */
49
- sub?: string;
50
- /**
51
- * Any other attributes retrieved from teh `id_token`.
52
- */
53
- [key: string]: any;
54
- }
55
- /**
56
- * Interface of the authenticated user.
57
- */
58
- export interface AuthenticatedUserInfo {
59
- /**
60
- * Authenticated user's display name.
61
- */
62
- displayName?: string | undefined;
63
- /**
64
- * Authenticated user's display name.
65
- * @deprecated Use `displayName` instead.
66
- */
67
- display_name?: string | undefined;
68
- /**
69
- * User's email.
70
- */
71
- email?: string | undefined;
72
- /**
73
- * Available scopes.
74
- */
75
- scope?: string | undefined;
76
- /**
77
- * Authenticated user's tenant domain.
78
- */
79
- tenantDomain?: string | undefined;
80
- /**
81
- * Authenticated user's username.
82
- */
83
- username: string;
84
- [key: string]: any;
85
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
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
- * Interface for the standard (required) claims of an ID Token payload.
20
- */
21
- export interface IdTokenPayloadStandardClaims {
22
- /**
23
- * The audience for which this token is intended.
24
- */
25
- aud: string | string[];
26
- /**
27
- * The unique identifier of the user to whom the ID token belongs.
28
- */
29
- sub: string;
30
- /**
31
- * The issuer identifier for the issuer of the response.
32
- */
33
- iss: string;
34
- /**
35
- * The email of the user.
36
- */
37
- email?: string;
38
- /**
39
- * The username the user prefers to be called.
40
- */
41
- preferred_username?: string;
42
- /**
43
- * The tenant domain of the user.
44
- */
45
- tenant_domain?: string;
46
- }
47
- /**
48
- * Interface for ID Token payload including custom claims.
49
- */
50
- export interface IdTokenPayload extends IdTokenPayloadStandardClaims {
51
- /**
52
- * Other custom claims.
53
- */
54
- [claim: string]: any;
55
- }