@asgardeo/javascript 0.7.3 → 0.8.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/dist/AsgardeoJavaScriptClient.d.ts +36 -33
- package/dist/DefaultCacheStore.d.ts +30 -0
- package/dist/DefaultCrypto.d.ts +29 -0
- package/dist/IsomorphicCrypto.d.ts +1 -1
- package/dist/api/v2/getFlowMetaV2.d.ts +55 -0
- package/dist/cjs/index.js +391 -33
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +8 -0
- package/dist/index.js +376 -33
- package/dist/index.js.map +4 -4
- package/dist/models/agent.d.ts +44 -0
- package/dist/models/auth-code-response.d.ts +34 -0
- package/dist/models/config.d.ts +5 -0
- package/dist/models/crypto.d.ts +1 -1
- package/dist/models/v2/embedded-flow-v2.d.ts +67 -1
- package/dist/models/v2/flow-meta-v2.d.ts +290 -0
- package/dist/models/v2/translation.d.ts +34 -0
- package/dist/models/v2/vars.d.ts +35 -0
- package/dist/utils/v2/resolveMeta.d.ts +34 -0
- package/dist/utils/v2/resolveVars.d.ts +41 -0
- package/package.json +4 -3
|
@@ -15,45 +15,48 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
import { AuthClientConfig } from './__legacy__/models/client-config';
|
|
19
|
+
import { AgentConfig } from './models/agent';
|
|
20
|
+
import { AuthCodeResponse } from './models/auth-code-response';
|
|
18
21
|
import { AsgardeoClient } from './models/client';
|
|
19
22
|
import { Config, SignInOptions, SignOutOptions, SignUpOptions } from './models/config';
|
|
23
|
+
import { Crypto } from './models/crypto';
|
|
20
24
|
import { EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse } from './models/embedded-flow';
|
|
21
|
-
import { EmbeddedSignInFlowHandleRequestPayload } from './models/embedded-signin-flow';
|
|
22
25
|
import { AllOrganizationsApiResponse, Organization } from './models/organization';
|
|
23
26
|
import { Storage } from './models/store';
|
|
24
27
|
import { TokenExchangeRequestConfig, TokenResponse } from './models/token';
|
|
25
28
|
import { User, UserProfile } from './models/user';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
declare class AsgardeoJavaScriptClient<T = Config> implements AsgardeoClient<T> {
|
|
30
|
+
private cacheStore;
|
|
31
|
+
private cryptoUtils;
|
|
32
|
+
private auth;
|
|
33
|
+
private storageManager;
|
|
34
|
+
private baseURL;
|
|
35
|
+
constructor(config?: AuthClientConfig<T>, cacheStore?: Storage, cryptoUtils?: Crypto);
|
|
36
|
+
switchOrganization(_organization: Organization, _sessionId?: string): Promise<TokenResponse | Response>;
|
|
37
|
+
initialize(_config: T, _storage?: Storage): Promise<boolean>;
|
|
38
|
+
reInitialize(_config: Partial<T>): Promise<boolean>;
|
|
39
|
+
getUser(_options?: any): Promise<User>;
|
|
40
|
+
getAllOrganizations(_options?: any, _sessionId?: string): Promise<AllOrganizationsApiResponse>;
|
|
41
|
+
getMyOrganizations(_options?: any, _sessionId?: string): Promise<Organization[]>;
|
|
42
|
+
getCurrentOrganization(_sessionId?: string): Promise<Organization | null>;
|
|
43
|
+
getUserProfile(_options?: any): Promise<UserProfile>;
|
|
44
|
+
isLoading(): boolean;
|
|
45
|
+
isSignedIn(): Promise<boolean>;
|
|
46
|
+
updateUserProfile(_payload: any, _userId?: string): Promise<User>;
|
|
47
|
+
getConfiguration(): T;
|
|
48
|
+
exchangeToken(_config: TokenExchangeRequestConfig, _sessionId?: string): Promise<TokenResponse | Response>;
|
|
49
|
+
signInSilently(_options?: SignInOptions): Promise<User | boolean>;
|
|
50
|
+
getAccessToken(_sessionId?: string): Promise<string>;
|
|
51
|
+
clearSession(_sessionId?: string): void;
|
|
52
|
+
setSession(_sessionData: Record<string, unknown>, _sessionId?: string): Promise<void>;
|
|
53
|
+
decodeJwtToken<R = Record<string, unknown>>(_token: string): Promise<R>;
|
|
54
|
+
signIn(_options?: SignInOptions): Promise<User>;
|
|
55
|
+
signOut(_options?: SignOutOptions, _sessionIdOrAfterSignOut?: string | ((afterSignOutUrl: string) => void), _afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
|
|
56
|
+
signUp(options?: SignUpOptions): Promise<void>;
|
|
57
|
+
signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
58
|
+
getAgentToken(agentConfig: AgentConfig): Promise<TokenResponse>;
|
|
59
|
+
getOBOSignInURL(agentConfig: AgentConfig): Promise<string>;
|
|
60
|
+
getOBOToken(agentConfig: AgentConfig, authCodeResponse: AuthCodeResponse): Promise<TokenResponse>;
|
|
58
61
|
}
|
|
59
62
|
export default AsgardeoJavaScriptClient;
|
|
@@ -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
|
+
export declare class DefaultCacheStore implements Storage {
|
|
19
|
+
private cache;
|
|
20
|
+
constructor();
|
|
21
|
+
get length(): number;
|
|
22
|
+
getItem(key: string): string | null;
|
|
23
|
+
setItem(key: string, value: string): void;
|
|
24
|
+
removeItem(key: string): void;
|
|
25
|
+
clear(): void;
|
|
26
|
+
key(index: number): string | null;
|
|
27
|
+
setData(key: string, value: string): Promise<void>;
|
|
28
|
+
getData(key: string): Promise<string>;
|
|
29
|
+
removeData(key: string): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { Crypto, JWKInterface } from './models/crypto';
|
|
19
|
+
/**
|
|
20
|
+
* Default implementation of the Crypto interface using the 'jose' library
|
|
21
|
+
* and the native Web Crypto API.
|
|
22
|
+
*/
|
|
23
|
+
export declare class DefaultCrypto implements Crypto<Uint8Array> {
|
|
24
|
+
base64URLDecode(value: string): string;
|
|
25
|
+
base64URLEncode(value: Uint8Array): string;
|
|
26
|
+
generateRandomBytes(length: number): Uint8Array;
|
|
27
|
+
hashSha256(data: string): Promise<Uint8Array>;
|
|
28
|
+
verifyJwt(idToken: string, jwk: JWKInterface, algorithms: string[], clientId: string, issuer: string, subject: string, clockTolerance?: number, validateJwtIssuer?: boolean): Promise<boolean>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { FlowMetadataResponse, GetFlowMetaRequestConfig } from '../../models/v2/flow-meta-v2';
|
|
19
|
+
/**
|
|
20
|
+
* Fetches aggregated flow metadata from the `GET /flow/meta` endpoint.
|
|
21
|
+
*
|
|
22
|
+
* The response includes:
|
|
23
|
+
* - Application or OU details depending on the `type` parameter
|
|
24
|
+
* - Resolved design configuration (theme and layout)
|
|
25
|
+
* - i18n translations filtered by `language` and `namespace`
|
|
26
|
+
* - Registration flow enablement status
|
|
27
|
+
*
|
|
28
|
+
* @param config - Request configuration including `baseUrl`/`url`, `type`, `id`,
|
|
29
|
+
* and optional `language` / `namespace` filters.
|
|
30
|
+
* @returns A promise that resolves to the {@link FlowMetadataResponse}.
|
|
31
|
+
*
|
|
32
|
+
* @throws {AsgardeoAPIError} When required parameters are missing or the server
|
|
33
|
+
* returns a non-OK response.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import getFlowMetaV2 from './api/v2/getFlowMetaV2';
|
|
38
|
+
* import { FlowMetaType } from './models/v2/flow-meta-v2';
|
|
39
|
+
*
|
|
40
|
+
* const meta = await getFlowMetaV2({
|
|
41
|
+
* baseUrl: 'https://localhost:8090',
|
|
42
|
+
* type: FlowMetaType.App,
|
|
43
|
+
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
44
|
+
* language: 'en',
|
|
45
|
+
* namespace: 'auth',
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* console.log(meta.application?.name);
|
|
49
|
+
* console.log(meta.i18n.translations);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @experimental This function targets the Asgardeo V2 platform API
|
|
53
|
+
*/
|
|
54
|
+
declare const getFlowMetaV2: ({ url, baseUrl, type, id, language, namespace, ...requestConfig }: GetFlowMetaRequestConfig) => Promise<FlowMetadataResponse>;
|
|
55
|
+
export default getFlowMetaV2;
|