/** * Provider-neutral auth method identifiers for UI composition. */ export type AuthMethod = "password" | "email_otp" | "magic_link" | "passkey" | "oauth" | "sso"; /** * Discriminated challenge union. Prefer this over a single interface with * many optional provider fields. */ export type AuthChallenge = { type: "email_otp"; challengeId: string; expiresAt: string; } | { type: "passkey"; options: Record; } | { type: "oauth_redirect"; provider: string; redirectUrl: string; } | { type: "magic_link_sent"; email: string; expiresAt?: string; }; /** * Verification payloads submitted after a challenge. */ export type AuthVerificationInput = { type: "email_otp"; challengeId: string; code: string; } | { type: "passkey"; challengeId?: string; credential: Record; } | { type: "oauth_callback"; provider: string; code?: string; state?: string; }; /** * Provider-level error surface (distinct from {@link AuthErrorView} transport codes). */ export interface AuthProviderError { code: string; message: string; provider: string; retryable: boolean; }