UNPKG

@better-auth-ui/core

Version:

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

84 lines (83 loc) 2.87 kB
import { MutationOptions } from '@tanstack/query-core'; import { BetterFetchError } from 'better-auth/client'; import { TwoFactorAuthClient } from './two-factor-auth-client'; export type VerifyTotpParams<TAuthClient extends TwoFactorAuthClient> = Parameters<TAuthClient["twoFactor"]["verifyTotp"]>[0]; export type VerifyTotpOptions<TAuthClient extends TwoFactorAuthClient> = Omit<ReturnType<typeof verifyTotpOptions<TAuthClient>>, "mutationKey" | "mutationFn" | "meta">; /** Mutation options factory for verifying an authenticator code. */ export declare function verifyTotpOptions<TAuthClient extends TwoFactorAuthClient>(authClient: TAuthClient): MutationOptions<Awaited<ReturnType<(params: VerifyTotpParams<TAuthClient>) => Promise<(Omit<{ token: string; user: 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; } & {}>; }) | (Omit<{ token: string; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }, "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: VerifyTotpParams<TAuthClient>) => Promise<(Omit<{ token: string; user: 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; } & {}>; }) | (Omit<{ token: string; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }, "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]>;