import { ServiceWorkerSignalMessage, ServiceWorkerSignalOptions } from './initWorker.js'; import { ILOidcLocation } from './location'; import { LoginCallback, Oidc } from './oidc.js'; import { Tokens, ValidToken } from './parseTokens.js'; import { Fetch, OidcConfiguration, StringMap } from './types.js'; export interface EventSubscriber { (name: string, data: any): any; } export declare class OidcClient { private readonly _oidc; constructor(oidc: Oidc); subscribeEvents(func: EventSubscriber): string; removeEventSubscription(id: string): void; publishEvent(eventName: string, data: any): void; static getOrCreate: (getFetch: () => Fetch, location?: ILOidcLocation) => (configuration: OidcConfiguration, name?: string) => OidcClient; /** * Retrieve an existing {@link OidcClient} by configuration name. * * Since issue #1679, this method returns `null` when the requested * configuration has not been initialized, instead of throwing. This * allows React hooks to be used safely outside of ``. * * Use {@link OidcClient.getOrThrow} to preserve the previous fail-fast * behaviour. */ static get(name?: string): OidcClient | null; /** * Retrieve an existing {@link OidcClient}, throwing if it has not been * initialized. Equivalent to the pre-#1679 behaviour of * {@link OidcClient.get}. */ static getOrThrow(name?: string): OidcClient; static eventNames: { service_worker_not_supported_by_browser: string; token_acquired: string; logout_from_another_tab: string; logout_from_same_tab: string; token_renewed: string; token_timer: string; loginAsync_begin: string; loginAsync_error: string; loginCallbackAsync_begin: string; loginCallbackAsync_end: string; loginCallbackAsync_error: string; loginCallbackAsync_navigated: string; loginCallbackAsync_navigation_error: string; refreshTokensAsync_begin: string; refreshTokensAsync: string; refreshTokensAsync_end: string; refreshTokensAsync_error: string; refreshTokensAsync_silent_error: string; tryKeepExistingSessionAsync_begin: string; tryKeepExistingSessionAsync_end: string; tryKeepExistingSessionAsync_error: string; silentLoginAsync_begin: string; silentLoginAsync: string; silentLoginAsync_end: string; silentLoginAsync_error: string; syncTokensAsync_begin: string; syncTokensAsync_lock_not_available: string; syncTokensAsync_end: string; syncTokensAsync_error: string; tokensInvalidAndWaitingActionsToRefresh: string; loadingTimeout_error: string; }; tryKeepExistingSessionAsync(): Promise; loginAsync(callbackPath?: string, extras?: StringMap, isSilentSignin?: boolean, scope?: string, silentLoginOnly?: boolean): Promise; logoutAsync(callbackPathOrUrl?: string | null | undefined, extras?: StringMap): Promise; /** * Drops the local OIDC session (tokens, user info, service-worker storage) * and notifies same-tab listeners via the `logout_from_same_tab` event, * without contacting the identity provider's `end_session_endpoint` and * without revoking tokens. * * Use this for SPA-only logouts, service-worker-only flows, or * error-recovery paths. For a standard OIDC RP-initiated logout (with * token revocation and navigation to the IdP's end-session endpoint) use * {@link logoutAsync} instead. */ clearSessionAsync(): Promise; /** * `true` while a logout flow is in progress: between the moment * {@link logoutAsync} starts and the moment the browser navigates away to * the identity provider's end-session endpoint. UI guards and silent-renew * handlers should check this flag to avoid kicking off a new auth flow * during that window. */ get isLoggingOut(): boolean; silentLoginCallbackAsync(): Promise; renewTokensAsync(extras?: StringMap, scope?: string): Promise; loginCallbackAsync(): Promise; get tokens(): Tokens; get configuration(): OidcConfiguration; generateDemonstrationOfProofOfPossessionAsync(accessToken: string, url: string, method: string, extras?: StringMap): Promise; getValidTokenAsync(waitMs?: number, numberWait?: number): Promise; fetchWithTokens(fetch: Fetch, demonstratingProofOfPossession?: boolean): Fetch; userInfoAsync(noCache?: boolean, demonstratingProofOfPossession?: boolean): Promise; userInfo(): T; /** * High-level helper to send a message to the OIDC service worker. * * Wraps the low-level `postMessage` + `MessageChannel` plumbing and * returns the response posted back by the worker. Use the typed message * symbols exported from `@axa-fr/oidc-client-service-worker/protocol` * (`ServiceWorkerMessageType`) to build messages. * * @throws if no service worker is registered for the current * configuration, or if the worker does not respond before the timeout * elapses. */ signalServiceWorker(message: ServiceWorkerSignalMessage, options?: ServiceWorkerSignalOptions): Promise; } export interface OidcUserInfo { sub: string; name?: string; given_name?: string; family_name?: string; middle_name?: string; nickname?: string; preferred_username?: string; profile?: string; picture?: string; website?: string; email?: string; email_verified?: boolean; gender?: string; birthdate?: string; zoneinfo?: string; locale?: string; phone_number?: string; phone_number_verified?: boolean; address?: OidcAddressClaim; updated_at?: number; groups?: string[]; } export interface OidcAddressClaim { formatted?: string; street_address?: string; locality?: string; region?: string; postal_code?: string; country?: string; } //# sourceMappingURL=oidcClient.d.ts.map