import { z } from 'zod'; import * as better_call from 'better-call'; import { U as User, I as InferOptionSchema, d as AuthEndpoint, G as GenericEndpointContext, S as Session, H as HookEndpointContext } from '../../shared/better-auth.CzPT2ibV.mjs'; import { L as LiteralString } from '../../shared/better-auth.Bi8FQwDD.mjs'; import * as _better_fetch_fetch from '@better-fetch/fetch'; import '../../shared/better-auth.DqRARNaM.mjs'; import 'jose'; import 'kysely'; import 'better-sqlite3'; interface BackupCodeOptions { /** * The amount of backup codes to generate * * @default 10 */ amount?: number; /** * The length of the backup codes * * @default 10 */ length?: number; customBackupCodesGenerate?: () => string[]; } interface OTPOptions { /** * How long the opt will be valid for in * minutes * * @default "3 mins" */ period?: number; /** * Number of digits for the OTP code * * @default 6 */ digits?: number; /** * Send the otp to the user * * @param user - The user to send the otp to * @param otp - The otp to send * @param request - The request object * @returns void | Promise */ sendOTP?: ( /** * The user to send the otp to * @type UserWithTwoFactor * @default UserWithTwoFactors */ data: { user: UserWithTwoFactor; otp: string; }, /** * The request object */ request?: Request) => Promise | void; } type TOTPOptions = { /** * Issuer */ issuer?: string; /** * How many digits the otp to be * * @default 6 */ digits?: 6 | 8; /** * Period for otp in seconds. * @default 30 */ period?: number; /** * Backup codes configuration */ backupCodes?: BackupCodeOptions; /** * Disable totp */ disable?: boolean; }; declare const schema: { user: { fields: { twoFactorEnabled: { type: "boolean"; required: false; defaultValue: false; input: false; }; }; }; twoFactor: { fields: { secret: { type: "string"; required: true; returned: false; }; backupCodes: { type: "string"; required: true; returned: false; }; userId: { type: "string"; required: true; returned: false; references: { model: string; field: string; }; }; }; }; }; interface TwoFactorOptions { /** * Application Name */ issuer?: string; /** * TOTP OPtions */ totpOptions?: Omit; /** * OTP Options */ otpOptions?: OTPOptions; /** * Backup code options */ backupCodeOptions?: BackupCodeOptions; /** * Skip verification on enabling two factor authentication. * @default false */ skipVerificationOnEnable?: boolean; /** * Custom schema for the two factor plugin */ schema?: InferOptionSchema; } interface UserWithTwoFactor extends User { /** * If the user has enabled two factor authentication. */ twoFactorEnabled: boolean; } interface TwoFactorProvider { id: LiteralString; endpoints?: Record; } interface TwoFactorTable { userId: string; secret: string; backupCodes: string; enabled: boolean; } declare const twoFactorClient: (options?: { /** * a redirect function to call if a user needs to verify * their two factor */ onTwoFactorRedirect?: () => void | Promise; }) => { id: "two-factor"; $InferServerPlugin: ReturnType; atomListeners: { matcher: (path: string) => boolean; signal: "$sessionSignal"; }[]; pathMethods: { "/two-factor/disable": "POST"; "/two-factor/enable": "POST"; "/two-factor/send-otp": "POST"; "/two-factor/generate-backup-codes": "POST"; }; fetchPlugins: { id: string; name: string; hooks: { onSuccess(context: _better_fetch_fetch.SuccessContext): Promise; }; }[]; }; declare const twoFactor: (options?: TwoFactorOptions) => { id: "two-factor"; endpoints: { enableTwoFactor: { ; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { totpURI: { type: string; description: string; }; backupCodes: { type: string; items: { type: string; }; description: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ password: z.ZodString; }, "strip", z.ZodTypeAny, { password: string; }, { password: string; }>; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { totpURI: { type: string; description: string; }; backupCodes: { type: string; items: { type: string; }; description: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/two-factor/enable"; }; disableTwoFactor: { ; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ password: z.ZodString; }, "strip", z.ZodTypeAny, { password: string; }, { password: string; }>; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/two-factor/disable"; }; verifyBackupCode: { ; trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { code: string; trustDevice?: boolean | undefined; disableSession?: boolean | undefined; }, { code: string; trustDevice?: boolean | undefined; disableSession?: boolean | undefined; }>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; } & { use: any[]; }>]>(...inputCtx: C): Promise; user: User & Record; } & { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; } & { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }; } : { user: UserWithTwoFactor; session: { session: Session & Record; user: User & Record; } & { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; } & { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>; options: { method: "POST"; body: z.ZodObject<{ code: z.ZodString; disableSession: z.ZodOptional; trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { code: string; trustDevice?: boolean | undefined; disableSession?: boolean | undefined; }, { code: string; trustDevice?: boolean | undefined; disableSession?: boolean | undefined; }>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; } & { use: any[]; }; path: "/two-factor/verify-backup-code"; }; generateBackupCodes: { ; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ password: z.ZodString; }, "strip", z.ZodTypeAny, { password: string; }, { password: string; }>; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; } & { use: any[]; }; path: "/two-factor/generate-backup-codes"; }; viewBackupCodes: { ; metadata: { SERVER_ONLY: true; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "GET"; body: z.ZodObject<{ userId: z.ZodString; }, "strip", z.ZodTypeAny, { userId: string; }, { userId: string; }>; metadata: { SERVER_ONLY: true; }; } & { use: any[]; }; path: "/two-factor/view-backup-codes"; }; sendTwoFactorOTP: { ; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }> | undefined)?]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/two-factor/send-otp"; }; verifyTwoFactorOTP: { ; }, "strip", z.ZodTypeAny, { code: string; trustDevice?: boolean | undefined; }, { code: string; trustDevice?: boolean | undefined; }>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ code: z.ZodString; trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { code: string; trustDevice?: boolean | undefined; }, { code: string; trustDevice?: boolean | undefined; }>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/two-factor/verify-otp"; }; generateTOTP: { ) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { code: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }> | undefined)?]>(...inputCtx: C): Promise; options: { method: "POST"; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { code: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/totp/generate"; }; getTOTPURI: { ) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; body: z.ZodObject<{ password: z.ZodString; }, "strip", z.ZodTypeAny, { password: string; }, { password: string; }>; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { totpURI: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; body: z.ZodObject<{ password: z.ZodString; }, "strip", z.ZodTypeAny, { password: string; }, { password: string; }>; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { totpURI: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/two-factor/get-totp-uri"; }; verifyTOTP: { ; }, "strip", z.ZodTypeAny, { code: string; trustDevice?: boolean | undefined; }, { code: string; trustDevice?: boolean | undefined; }>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ code: z.ZodString; trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { code: string; trustDevice?: boolean | undefined; }, { code: string; trustDevice?: boolean | undefined; }>; use: ((inputContext: better_call.MiddlewareInputContext<{ body: z.ZodObject<{ trustDevice: z.ZodOptional; }, "strip", z.ZodTypeAny, { trustDevice?: boolean | undefined; }, { trustDevice?: boolean | undefined; }>; }>) => Promise<{ valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: UserWithTwoFactor; }; } | { valid: (ctx: GenericEndpointContext) => Promise<{ token: string; user: { id: string; email: string; emailVerified: boolean; name: string; image: string | null | undefined; createdAt: Date; updatedAt: Date; }; }>; invalid: () => Promise; session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { summary: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/two-factor/verify-totp"; }; }; options: TwoFactorOptions | undefined; hooks: { after: { matcher(context: HookEndpointContext): boolean; handler: (inputContext: better_call.MiddlewareInputContext) => Promise<{ twoFactorRedirect: boolean; } | undefined>; }[]; }; schema: { user: { fields: { twoFactorEnabled: { type: "boolean"; required: false; defaultValue: false; input: false; }; }; }; twoFactor: { fields: { secret: { type: "string"; required: true; returned: false; }; backupCodes: { type: "string"; required: true; returned: false; }; userId: { type: "string"; required: true; returned: false; references: { model: string; field: string; }; }; }; }; }; rateLimit: { pathMatcher(path: string): boolean; window: number; max: number; }[]; }; export { type TwoFactorOptions, type TwoFactorProvider, type TwoFactorTable, type UserWithTwoFactor, twoFactor, twoFactorClient };