/** * * Copyright © 2026 Ping Identity Corporation. All right reserved. * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. * **/ import { z } from 'zod'; import type { CustomLogger, LogLevel, OidcClient, RequestMiddleware, StorageConfig } from '@forgerock/oidc-client/types'; import type { Readable } from 'svelte/store'; /** * Validates the OIDC client config passed to the widget. Accepts the fields from * OidcConfig that have a clear consumer use case. serverConfig is injected by the * widget from its own wellknown; log is omitted in favour of the top-level logger option. */ export declare const oidcClientConfigSchema: z.ZodObject<{ clientId: z.ZodString; redirectUri: z.ZodString; scope: z.ZodDefault; serverConfig: z.ZodObject<{ wellknown: z.ZodString; }, z.core.$strict>; par: z.ZodOptional; loginHint: z.ZodOptional; acrValues: z.ZodOptional; query: z.ZodOptional>; oauthThreshold: z.ZodOptional; }, z.core.$strict>; export type OidcClientConfig = z.infer; export type OidcClientStore = Readable & { /** * Resolves with the constructed client (or a `GenericError` if construction * failed). Awaiting this is the readiness gate — the store is already * populated by the time it resolves, so callers never see the `null` window. */ getClient: () => Promise; }; /** * @function createOidcClientStore * * Wraps the `oidc()` factory in a Svelte store. The client is constructed once; * `getClient()` shares that single construction promise so awaiting it is the * readiness gate. `subscribe` exposes the same client reactively — `null` until * construction settles, then the resolved client (or a `GenericError`). * Inject the returned store into OAuth and User stores so both share the same * client instance without module-level state. * * @param {OidcClientConfig} config — OIDC client configuration (validated by Zod). * @param {RequestMiddleware[]} [requestMiddleware] — optional request middleware forwarded to `oidc()`. * @param {{ level: LogLevel; custom?: CustomLogger }} [logger] — optional logger (level + custom sink) forwarded to `oidc()`. * @param {StorageConfig} [storage] — optional token storage config forwarded to `oidc()`. * @returns {OidcClientStore} */ export declare function createOidcClientStore(config: OidcClientConfig, requestMiddleware?: RequestMiddleware[], logger?: { level: LogLevel; custom?: CustomLogger; }, storage?: StorageConfig): OidcClientStore;