UNPKG

@better-auth-ui/core

Version:

Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.

54 lines (53 loc) 2.18 kB
import { MutationOptions } from '@tanstack/query-core'; import { BetterFetchError } from 'better-auth/client'; import { TwoFactorAuthClient } from './two-factor-auth-client'; export type VerifyBackupCodeParams<TAuthClient extends TwoFactorAuthClient> = Parameters<TAuthClient["twoFactor"]["verifyBackupCode"]>[0]; export type VerifyBackupCodeOptions<TAuthClient extends TwoFactorAuthClient> = Omit<ReturnType<typeof verifyBackupCodeOptions<TAuthClient>>, "mutationKey" | "mutationFn" | "meta">; /** Mutation options factory for recovering with a backup code. */ export declare function verifyBackupCodeOptions<TAuthClient extends TwoFactorAuthClient>(authClient: TAuthClient): MutationOptions<Awaited<ReturnType<(params: VerifyBackupCodeParams<TAuthClient>) => Promise<Omit<{ token: string | undefined; user: (Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }) | import('better-auth/plugins').UserWithTwoFactor; }, "user"> & { user: import('better-auth').StripEmptyObjects<{ id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & { twoFactorEnabled: boolean | null | undefined; } & {}>; }>>>, BetterFetchError, Parameters<(params: VerifyBackupCodeParams<TAuthClient>) => Promise<Omit<{ token: string | undefined; user: (Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }) | import('better-auth/plugins').UserWithTwoFactor; }, "user"> & { user: import('better-auth').StripEmptyObjects<{ id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & { twoFactorEnabled: boolean | null | undefined; } & {}>; }>>[0]>;