import { z } from 'zod'; import * as better_call from 'better-call'; import { H as HookEndpointContext } from '../../shared/better-auth.DijUyhfq.cjs'; import '../../shared/better-auth.Bi8FQwDD.cjs'; import '../../shared/better-auth.WtOxsS45.cjs'; import 'jose'; import 'kysely'; import 'better-sqlite3'; interface EmailOTPOptions { /** * Function to send email verification */ sendVerificationOTP: (data: { email: string; otp: string; type: "sign-in" | "email-verification" | "forget-password"; }, request?: Request) => Promise; /** * Length of the OTP * * @default 6 */ otpLength?: number; /** * Expiry time of the OTP in seconds * * @default 300 (5 minutes) */ expiresIn?: number; /** * Custom function to generate otp */ generateOTP?: (data: { email: string; type: "sign-in" | "email-verification" | "forget-password"; }, request?: Request) => string; /** * Send email verification on sign-up * * @Default false */ sendVerificationOnSignUp?: boolean; /** * A boolean value that determines whether to prevent * automatic sign-up when the user is not registered. * * @Default false */ disableSignUp?: boolean; } declare const emailOTP: (options: EmailOTPOptions) => { id: "email-otp"; endpoints: { sendVerificationOTP: { ; }, "strip", z.ZodTypeAny, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }>; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ email: z.ZodString; type: z.ZodEnum<["email-verification", "sign-in", "forget-password"]>; }, "strip", z.ZodTypeAny, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }>; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/email-otp/send-verification-otp"; }; createVerificationOTP: { ; }, "strip", z.ZodTypeAny, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }>; metadata: { SERVER_ONLY: true; openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "string"; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ email: z.ZodString; type: z.ZodEnum<["email-verification", "sign-in", "forget-password"]>; }, "strip", z.ZodTypeAny, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }>; metadata: { SERVER_ONLY: true; openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "string"; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/email-otp/create-verification-otp"; }; getVerificationOTP: { ; }, "strip", z.ZodTypeAny, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }>; metadata: { SERVER_ONLY: true; openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { otp: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "GET"; query: z.ZodObject<{ email: z.ZodString; type: z.ZodEnum<["email-verification", "sign-in", "forget-password"]>; }, "strip", z.ZodTypeAny, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }, { email: string; type: "sign-in" | "forget-password" | "email-verification"; }>; metadata: { SERVER_ONLY: true; openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { otp: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/email-otp/get-verification-otp"; }; verifyEmailOTP: { ; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { user: { $ref: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ email: z.ZodString; otp: z.ZodString; }, "strip", z.ZodTypeAny, { email: string; otp: string; }, { email: string; otp: string; }>; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { user: { $ref: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/email-otp/verify-email"; }; signInEmailOTP: { ; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { user: { $ref: string; }; session: { $ref: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ email: z.ZodString; otp: z.ZodString; }, "strip", z.ZodTypeAny, { email: string; otp: string; }, { email: string; otp: string; }>; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { user: { $ref: string; }; session: { $ref: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/sign-in/email-otp"; }; forgetPasswordEmailOTP: { ; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ email: z.ZodString; }, "strip", z.ZodTypeAny, { email: string; }, { email: string; }>; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/forget-password/email-otp"; }; resetPasswordEmailOTP: { ; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "POST"; body: z.ZodObject<{ email: z.ZodString; otp: z.ZodString; password: z.ZodString; }, "strip", z.ZodTypeAny, { password: string; email: string; otp: string; }, { password: string; email: string; otp: string; }>; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/email-otp/reset-password"; }; }; hooks: { after: { matcher(context: HookEndpointContext): boolean; handler: (inputContext: better_call.MiddlewareInputContext) => Promise; }[]; }; $ERROR_CODES: { readonly OTP_EXPIRED: "otp expired"; readonly INVALID_OTP: "invalid otp"; readonly INVALID_EMAIL: "invalid email"; readonly USER_NOT_FOUND: "user not found"; }; rateLimit: ({ pathMatcher(path: string): path is "/email-otp/send-verification-otp"; window: number; max: number; } | { pathMatcher(path: string): path is "/email-otp/verify-email"; window: number; max: number; } | { pathMatcher(path: string): path is "/sign-in/email-otp"; window: number; max: number; })[]; }; export { type EmailOTPOptions, emailOTP };