import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; import type { GenericError, GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; import type { CustomLogger, LogLevel } from '@forgerock/sdk-logger'; import type { StorageConfig } from '@forgerock/storage'; import type { GetTokensOptions, LogoutErrorResult, LogoutSuccessResult, RevokeErrorResult, RevokeSuccessResult, UserInfoResponse } from './client.types.js'; import type { OauthTokens, OidcConfig } from './config.types.js'; import type { AuthorizationError, AuthorizationSuccess } from './authorize.request.types.js'; import type { TokenExchangeErrorResponse } from './exchange.types.js'; import type { SessionCheckOptions, SessionCheckSuccess } from './session.types.js'; /** * @function oidc * @description Factory function to create an OIDC client with methods for authorization, token exchange, * user info retrieval, and logout. It initializes the client with the provided configuration, * request middleware, logger, and storage options. * @param param - configuration object containing the OIDC client configuration, request middleware, logger, * @param {OidcConfig} param.config - OIDC configuration including server details, client ID, redirect URI, * storage options, scope, and response type. * @param {RequestMiddleware} param.requestMiddleware - optional array of request middleware functions to process requests. * @param {{ level: LogLevel, custom: CustomLogger }} param.logger - optional logger configuration with log level and custom logger. * @param {Partial} param.storage - optional storage configuration for persisting OIDC tokens. * @returns {ReturnType} - Returns an object with methods for authorization, token exchange, user info retrieval, and logout. */ export declare function oidc({ config, requestMiddleware, logger, storage, }: { config: OidcConfig; requestMiddleware?: RequestMiddleware[]; logger?: { level: LogLevel; custom?: CustomLogger; }; storage?: Partial; }): Promise<{ error: string; type: string; subscribe?: undefined; /** * An object containing methods for the creation, and background use, of the authorization URL */ authorize?: undefined; /** * An object containing methods for token management */ token?: undefined; /** * An object containing methods for user info retrieval and logout */ user?: undefined; } | { subscribe: (listener: () => void) => import("@reduxjs/toolkit").Unsubscribe; /** * An object containing methods for the creation, and background use, of the authorization URL */ authorize: { /** * @method url * @description Creates an authorization URL with the provided options or defaults from the configuration. * @param {GetAuthorizationUrlOptions} options - Optional parameters to customize the authorization URL. * @returns {Promise} - Returns a promise that resolves to the authorization URL or an error. */ url: (options?: GetAuthorizationUrlOptions) => Promise; /** * @function background - Initiates the authorization process in the background, returning code and state or an error. * @param {GetAuthorizationUrlOptions} options - Optional parameters to customize the authorization URL. * @returns {Promise} - Returns a promise that resolves to code and state or an error response. */ background: (options?: GetAuthorizationUrlOptions) => Promise; }; /** * An object containing methods for token management */ token: { /** * @method exchange * @description Exchanges an authorization code for tokens using the token endpoint from the wellknown * configuration and stores them in the configured storage. * @param {string} code - The authorization code received from the authorization server. * @param {string} state - The state parameter from the authorization URL creation. * @param {Partial} options - Optional storage configuration for persisting tokens. * @returns {Promise} */ exchange: (code: string, state: string, options?: Partial) => Promise; /** * @method get * @description Retrieves the current OAuth tokens from storage, or auto-renew if backgroundRenew is true. * @param {GetTokensOptions} param - An object containing options for the token retrieval. * @returns {Promise} */ get: (options?: GetTokensOptions) => Promise; /** * @method revoke * @description Revokes an access token using the revocation endpoint from the wellknown configuration. * It requires an access token stored in the configured storage. * @returns {Promise} - Returns a promise that resolves to the revoke response or an error response. */ revoke: () => Promise; }; /** * An object containing methods for user info retrieval and logout */ user: { /** * @method info * @description Retrieves user information using the userinfo endpoint from the wellknown configuration. * It requires an access token stored in the configured storage. * @returns {Promise} - Returns a promise that resolves to user information or an error response. */ info: () => Promise; /** * @method logout * @description Logs out the user by revoking tokens and clearing the storage. * It uses the end session endpoint from the wellknown configuration. * @returns {Promise} - Returns a promise that resolves to the logout response or an error. */ logout: () => Promise; /** * @method session * @description Checks whether the user has an active session at the authorization server * using a hidden iframe with prompt=none. Supports response_type=none (default) * and response_type=id_token. * @param {SessionCheckOptions} options - Optional parameters for the session check. * @returns {Promise} - Never throws; returns a typed result. */ session: (options?: SessionCheckOptions) => Promise; }; error?: undefined; type?: undefined; }>; //# sourceMappingURL=client.store.d.ts.map