import type { AuthenticationConfiguration } from '@scalar/types/api-reference'; import type { WorkspaceStore } from '@scalar/workspace-store/client'; import { type Auth } from '@scalar/workspace-store/entities/auth'; import type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'; /** Generate document settings from workspace store. AsyncAPI docs are skipped — this feature is OpenAPI-native. */ export declare function createDocumentSettings(workspaceStore: WorkspaceStore, authentication?: AuthenticationConfiguration): { [k: string]: { activeServer: import("@scalar/workspace-store/schemas/v3.2/strict/server").ServerObject | null; securitySchemes: SecuritySchemeObjectSecret[]; }; }; /** * Provides an interface to store and retrieve authentication scheme * information in local storage, including both the available schemes and * the user's selected schemes. */ export declare const authStorage: () => { /** * Retrieves and coerces the authentication schemes stored in local storage. */ getAuth: (slug: string) => { secrets: { [x: string]: ({ name?: string | undefined; type: "apiKey"; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; }) | ({ type: "http"; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-username': string; 'x-scalar-secret-password': string; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; }) | ({ type: "oauth2"; } & { password?: ({ 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-username': string; 'x-scalar-secret-password': string; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; deviceAuthorization?: ({ 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; implicit?: ({ 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-redirect-uri'?: string | undefined; }) | undefined; clientCredentials?: ({ 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; authorizationCode?: ({ 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-secret-redirect-uri'?: string | undefined; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; }) | { password?: ({ refreshUrl: string; scopes: { [x: string]: string; }; } & { 'x-scalar-security-query'?: { [x: string]: string; } | undefined; } & { 'x-scalar-security-body'?: { [x: string]: string; } | undefined; } & { 'x-tokenName'?: string | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-order'?: number | undefined; } & { 'x-scalar-ignore'?: boolean | undefined; } & { tokenUrl: string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-username': string; 'x-scalar-secret-password': string; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; deviceAuthorization?: ({ refreshUrl: string; scopes: { [x: string]: string; }; } & { 'x-scalar-security-query'?: { [x: string]: string; } | undefined; } & { 'x-scalar-security-body'?: { [x: string]: string; } | undefined; } & { 'x-tokenName'?: string | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-order'?: number | undefined; } & { 'x-scalar-ignore'?: boolean | undefined; } & { deviceAuthorizationUrl: string; tokenUrl: string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; implicit?: ({ refreshUrl: string; scopes: { [x: string]: string; }; } & { 'x-scalar-security-query'?: { [x: string]: string; } | undefined; } & { 'x-scalar-security-body'?: { [x: string]: string; } | undefined; } & { 'x-tokenName'?: string | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-order'?: number | undefined; } & { 'x-scalar-ignore'?: boolean | undefined; } & { authorizationUrl: string; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-redirect-uri'?: string | undefined; }) | undefined; clientCredentials?: ({ refreshUrl: string; scopes: { [x: string]: string; }; } & { 'x-scalar-security-query'?: { [x: string]: string; } | undefined; } & { 'x-scalar-security-body'?: { [x: string]: string; } | undefined; } & { 'x-tokenName'?: string | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-order'?: number | undefined; } & { 'x-scalar-ignore'?: boolean | undefined; } & { tokenUrl: string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; authorizationCode?: ({ refreshUrl: string; scopes: { [x: string]: string; }; } & { 'x-scalar-security-query'?: { [x: string]: string; } | undefined; } & { 'x-scalar-security-body'?: { [x: string]: string; } | undefined; } & { 'x-tokenName'?: string | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-order'?: number | undefined; } & { 'x-scalar-ignore'?: boolean | undefined; } & { tokenUrl: string; authorizationUrl: string; } & { 'x-usePkce': "SHA-256" | "plain" | "no"; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; } & { 'x-scalar-secret-auth-url'?: string | undefined; } & { 'x-scalar-secret-token-url'?: string | undefined; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; } & { 'x-scalar-secret-client-id': string; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-refresh-token'?: string | undefined; } & { 'x-scalar-secret-client-secret': string; } & { 'x-scalar-secret-redirect-uri'?: string | undefined; } & { 'x-scalar-credentials-location'?: "header" | "body" | undefined; }) | undefined; type: "openIdConnect"; } | ({ type: "plain" | "userPassword" | "scramSha256" | "scramSha512"; } & { 'x-scalar-secret-username': string; 'x-scalar-secret-password': string; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; }) | ({ type: "X509"; } & { 'x-scalar-secret-client-certificate': string; } & { 'x-scalar-secret-private-key': string; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; }) | ({ type: "symmetricEncryption" | "asymmetricEncryption"; } & { 'x-scalar-secret-token': string; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; }) | ({ type: "gssapi"; } & { 'x-scalar-secret-service-name': string; } & { 'x-scalar-secret-cleared-fields'?: string[] | undefined; }); }; selected: { path?: { [x: string]: { [x: string]: { selectedIndex: number; selectedSchemes: {}[]; }; }; } | undefined; document?: { selectedIndex: number; selectedSchemes: {}[]; } | undefined; }; }; /** * Stores the authentication schemes in local storage. * @param value The Auth object to stringify and store. */ setAuth: (slug: string, value: Auth) => void; }; /** * Restores authentication secrets from local storage to the workspace store. * * This function iterates through stored authentication schemes and restores * any secret values (keys starting with x-scalar-secret-) to the active * document's security schemes. It uses the current security schemes as the * source of truth, only restoring secrets for structures that exist in the * current document. */ export declare const restoreAuthSecretsFromStorage: ({ documentName, workspaceStore, }: { documentName: string; workspaceStore: WorkspaceStore; }) => void; export declare function safeParseJson(value: string): any; //# sourceMappingURL=helpers.d.ts.map