import type { CustomScheme } from 'electron'; type Awaitable = T | Promise; export type TokenStorage = { getItem: (key: string) => Awaitable; setItem: (key: string, value: string) => Awaitable; removeItem: (key: string) => Awaitable; }; export type CreateClerkBridgeOptions = { /** * Storage adapter used by the main process to persist Clerk tokens. */ storage: TokenStorage; /** * Registers the custom scheme used to serve the Electron renderer from a stable origin. */ renderer?: RendererSchemeOptions; /** * Whether Clerk should acquire and release Electron's process-wide single-instance lock for OAuth * deep links. Set this to `false` when the application manages the lock itself. Ignored on macOS, * where deep links reach the running instance through `open-url`. * * @default true */ manageSingleInstanceLock?: boolean; /** * Registers the IPC handlers for native passkey ceremonies. Native support also requires * the optional `@clerk/electron-passkeys` package and `exposeClerkBridge({ passkeys: true })`. */ passkeys?: boolean; /** * Product token to use in Electron's user-agent fallback. Clerk uses the resulting * user-agent for UserProfile session activity attribution when no webContents or * session-level user-agent is set. The Electron platform comment is preserved so * device details such as macOS or Windows can still be detected. */ userAgent?: string; }; export type ExposeClerkBridgeOptions = { /** * Exposes the native passkey bridge to the renderer. Requires `createClerkBridge({ passkeys: true })`. */ passkeys?: boolean; }; export type ClerkBridge = { /** * Removes IPC handlers and listeners registered by `createClerkBridge`. */ cleanup: () => void; /** * Whether this process is the one the application should keep booting. `false` only when Clerk * detected a secondary instance, forwarded its deep-link arguments to the primary, and called * `app.quit()`. Because `app.quit()` is asynchronous, skip window creation and the rest of the * bootstrap when this is `false`. */ isPrimaryInstance: boolean; }; export type RendererSchemeOptions = CustomScheme & { /** * Custom scheme used for the renderer origin. */ scheme: string; /** * Custom host used for the renderer origin. */ host: string; }; export type TokenCache = { getToken: (key: string) => Promise; saveToken: (key: string, value: string) => Promise; clearToken: (key: string) => Promise; }; export type OAuthTransport = { getRedirectUrl: () => Promise; open: (url: string) => Promise<{ callbackUrl: string; }>; }; type Base64UrlString = string; export type AuthenticatorTransport = 'ble' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb'; export type PublicKeyCredentialDescriptorJSON = { type: 'public-key'; id: Base64UrlString; transports?: AuthenticatorTransport[]; }; export type SerializedPublicKeyCredentialCreationOptions = { rp: { id: string; name: string; }; user: { id: Base64UrlString; displayName: string; name: string; }; challenge: Base64UrlString; pubKeyCredParams: { type: 'public-key'; alg: number; }[]; timeout?: number; authenticatorSelection?: { authenticatorAttachment?: 'cross-platform' | 'platform'; requireResidentKey?: boolean; residentKey?: 'discouraged' | 'preferred' | 'required'; userVerification?: 'discouraged' | 'preferred' | 'required'; }; attestation?: 'direct' | 'enterprise' | 'indirect' | 'none'; excludeCredentials?: PublicKeyCredentialDescriptorJSON[]; }; export type SerializedPublicKeyCredentialRequestOptions = { challenge: Base64UrlString; rpId: string; timeout?: number; userVerification?: 'discouraged' | 'preferred' | 'required'; allowCredentials?: PublicKeyCredentialDescriptorJSON[]; }; export type RegistrationResponseJSON = { id: Base64UrlString; rawId: Base64UrlString; response: { clientDataJSON: Base64UrlString; attestationObject: Base64UrlString; transports?: AuthenticatorTransport[]; }; authenticatorAttachment?: 'cross-platform' | 'platform'; type: 'public-key'; }; export type AuthenticationResponseJSON = { id: Base64UrlString; rawId: Base64UrlString; response: { clientDataJSON: Base64UrlString; authenticatorData: Base64UrlString; signature: Base64UrlString; userHandle?: Base64UrlString; }; authenticatorAttachment?: 'cross-platform' | 'platform'; type: 'public-key'; }; export type PasskeyNativeErrorCode = 'cancelled' | 'invalid_rp' | 'not_supported' | 'timeout' | 'unknown'; export type PasskeyIpcResult = { ok: true; credential: T; } | { ok: false; error: { code: PasskeyNativeErrorCode; message: string; }; }; export type PasskeyCapabilities = { available: boolean; platformAuthenticator: boolean; securityKeys: boolean; }; export type PasskeyBridge = { create: (options: SerializedPublicKeyCredentialCreationOptions) => Promise>; get: (options: SerializedPublicKeyCredentialRequestOptions) => Promise>; capabilities: () => Promise; electronMajor: number; platform: string; }; export type SetupPasskeysMainReturn = { cleanup: () => void; }; export {}; //# sourceMappingURL=types.d.ts.map