import { UserMFADevicesResponse, WebAuthnDeviceType } from '@frontegg/rest-api'; import { MFAStep } from '../MfaState/interfaces'; export type PreferredMfaMethod = 'sms' | 'email' | 'authenticatorApp' | 'webauthnPlatform' | 'webauthnCrossPlatform'; export type PreferredMfaResolution = { type: 'step'; step: MFAStep; } | { type: 'webauthn'; deviceType: WebAuthnDeviceType; } | { type: 'none'; }; export declare const getPreferredMfaStorageKey: (appKey: string) => string; export declare const isPreferredMfaMethod: (value: unknown) => value is PreferredMfaMethod; /** * Persist the last successful MFA method for this browser session, keyed by application. */ export declare const setPreferredMfaMethod: (appKey: string, method: PreferredMfaMethod) => void; /** * Read the remembered MFA method for this browser session, if any. */ export declare const getPreferredMfaMethod: (appKey: string) => PreferredMfaMethod | null; export declare const clearPreferredMfaMethod: (appKey: string) => void; /** * Map a stored preferred MFA method to a concrete MFA step / WebAuthn action, * only when that method is still enrolled and available. */ export declare const resolvePreferredMfa: (preferred: PreferredMfaMethod | null | undefined, mfaDevices?: UserMFADevicesResponse) => PreferredMfaResolution; export declare const getPreferredMfaMethodFromWebAuthnDeviceType: (deviceType: WebAuthnDeviceType) => PreferredMfaMethod; export declare const findWebAuthnDeviceTypeById: (mfaDevices: UserMFADevicesResponse | undefined, deviceId: string) => WebAuthnDeviceType | undefined; export type PreferredMfaApplyAction = { action: 'setStep'; step: MFAStep; } | { action: 'webauthn'; deviceId: string; } | { action: 'none'; }; export interface ApplyPreferredMfaFactorInput { rememberLastMfaFactor: boolean; alreadyApplied: boolean; step: MFAStep; preferred: PreferredMfaMethod | null; mfaDevices: UserMFADevicesResponse | undefined; mfaWebAuthnPlatformDeviceId?: string; mfaWebAuthnCrossPlatformDeviceId?: string; } /** * Pure decision for whether / how to apply a stored preferred MFA factor. * Used by the login-box MFAFlow when themeOptions.rememberLastMfaFactor is on. */ export declare const getPreferredMfaApplyAction: ({ rememberLastMfaFactor, alreadyApplied, step, preferred, mfaDevices, mfaWebAuthnPlatformDeviceId, mfaWebAuthnCrossPlatformDeviceId, }: ApplyPreferredMfaFactorInput) => PreferredMfaApplyAction;