@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
20 lines (19 loc) • 1.07 kB
TypeScript
import { MutationOptions } from '@tanstack/query-core';
import { BetterFetchError } from 'better-auth/client';
import { TwoFactorAuthClient } from './two-factor-auth-client';
export type EnableTwoFactorParams<TAuthClient extends TwoFactorAuthClient> = Parameters<TAuthClient["twoFactor"]["enable"]>[0];
export type EnableTwoFactorOptions<TAuthClient extends TwoFactorAuthClient> = Omit<ReturnType<typeof enableTwoFactorOptions<TAuthClient>>, "mutationKey" | "mutationFn" | "meta">;
/** Mutation options factory for enabling two-factor authentication. */
export declare function enableTwoFactorOptions<TAuthClient extends TwoFactorAuthClient>(authClient: TAuthClient): MutationOptions<Awaited<ReturnType<(params: EnableTwoFactorParams<TAuthClient>) => Promise<NonNullable<{
method: "otp";
} | {
method: "totp";
totpURI: string;
backupCodes: string[];
}>>>>, BetterFetchError, Parameters<(params: EnableTwoFactorParams<TAuthClient>) => Promise<NonNullable<{
method: "otp";
} | {
method: "totp";
totpURI: string;
backupCodes: string[];
}>>>[0]>;