UNPKG

better-auth

Version:

The most comprehensive authentication framework for TypeScript.

1,425 lines (1,423 loc) • 136 kB
import { OverrideMerge, Prettify as Prettify$1, UnionToIntersection } from "../types/helper.mjs"; import { AdditionalSessionFieldsInput, AdditionalUserFieldsInput } from "../types/models.mjs"; import { isAPIError } from "../utils/is-api-error.mjs"; import { DispatchContext, dispatchAuthEndpoint } from "./dispatch.mjs"; import { requireOrgRole, requireResourceOwnership } from "./middlewares/authorization.mjs"; import { formCsrfMiddleware, originCheck, originCheckMiddleware } from "./middlewares/origin-check.mjs"; import { accountInfo, getAccessToken, linkSocialAccount, listUserAccounts, refreshToken, unlinkAccount } from "./routes/account.mjs"; import { callbackOAuth } from "./routes/callback.mjs"; import { createEmailVerificationToken, sendVerificationEmail, sendVerificationEmailFn, verifyEmail } from "./routes/email-verification.mjs"; import { error } from "./routes/error.mjs"; import { ok } from "./routes/ok.mjs"; import { requestPasswordReset, requestPasswordResetCallback, resetPassword, verifyPassword } from "./routes/password.mjs"; import { freshSessionMiddleware, getAuthoritativeSessionFromCtx, getSession, getSessionFromCtx, isStateful, listSessions, requestOnlySessionMiddleware, revokeOtherSessions, revokeSession, revokeSessions, sensitiveSessionMiddleware, sessionMiddleware } from "./routes/session.mjs"; import { signInEmail, signInSocial } from "./routes/sign-in.mjs"; import { signOut } from "./routes/sign-out.mjs"; import { signUpEmail } from "./routes/sign-up.mjs"; import { updateSession } from "./routes/update-session.mjs"; import { changeEmail, changePassword, deleteUser, deleteUserCallback, setPassword, updateUser } from "./routes/update-user.mjs"; import { getOAuthState } from "./state/oauth.mjs"; import { getShouldSkipSessionRefresh, setShouldSkipSessionRefresh } from "./state/should-session-refresh.mjs"; import { AuthContext, Awaitable, BetterAuthOptions, BetterAuthPlugin } from "@better-auth/core"; import * as _$_better_auth_core_db0 from "@better-auth/core/db"; import { InternalLogger } from "@better-auth/core/env"; import { APIError } from "@better-auth/core/error"; import * as _$_better_auth_core_oauth20 from "@better-auth/core/oauth2"; import { getIp } from "@better-auth/core/utils/ip"; import * as _$better_call0 from "better-call"; import { Middleware } from "better-call"; import { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@better-auth/core/api"; import * as _$zod from "zod"; import * as _$zod_v4_core0 from "zod/v4/core"; //#region src/api/index.d.ts declare function checkEndpointConflicts(options: BetterAuthOptions, logger: InternalLogger): void; declare function getEndpoints<Option extends BetterAuthOptions>(ctx: Awaitable<AuthContext>, options: Option): { api: OverrideMerge<{ readonly ok: _$better_call0.StrictEndpoint<"/ok", { method: "GET"; metadata: { openapi: { description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { ok: { type: string; description: string; }; }; required: string[]; }; }; }; }; }; }; scope: "server"; }; }, { ok: boolean; }>; readonly error: _$better_call0.StrictEndpoint<"/error", { method: "GET"; metadata: { openapi: { description: string; responses: { "200": { description: string; content: { "text/html": { schema: { type: "string"; description: string; }; }; }; }; }; }; scope: "server"; }; }, Response>; readonly signInSocial: _$better_call0.StrictEndpoint<"/sign-in/social", { method: "POST"; operationId: string; body: _$zod.ZodObject<{ callbackURL: _$zod.ZodOptional<_$zod.ZodString>; newUserCallbackURL: _$zod.ZodOptional<_$zod.ZodString>; errorCallbackURL: _$zod.ZodOptional<_$zod.ZodString>; provider: _$zod.ZodType<(string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown, _$zod_v4_core0.$ZodTypeInternals<(string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown>>; disableRedirect: _$zod.ZodOptional<_$zod.ZodBoolean>; idToken: _$zod.ZodOptional<_$zod.ZodObject<{ token: _$zod.ZodString; nonce: _$zod.ZodOptional<_$zod.ZodString>; accessToken: _$zod.ZodOptional<_$zod.ZodString>; refreshToken: _$zod.ZodOptional<_$zod.ZodString>; expiresAt: _$zod.ZodOptional<_$zod.ZodNumber>; user: _$zod.ZodOptional<_$zod.ZodObject<{ name: _$zod.ZodOptional<_$zod.ZodObject<{ firstName: _$zod.ZodOptional<_$zod.ZodString>; lastName: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>>; email: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>>; }, _$zod_v4_core0.$strip>>; scopes: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>; requestSignUp: _$zod.ZodOptional<_$zod.ZodBoolean>; loginHint: _$zod.ZodOptional<_$zod.ZodString>; additionalData: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>>; }, _$zod_v4_core0.$strip>; metadata: { $Infer: { body: _$zod.infer<_$zod.ZodObject<{ callbackURL: _$zod.ZodOptional<_$zod.ZodString>; newUserCallbackURL: _$zod.ZodOptional<_$zod.ZodString>; errorCallbackURL: _$zod.ZodOptional<_$zod.ZodString>; provider: _$zod.ZodType<(string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown, _$zod_v4_core0.$ZodTypeInternals<(string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown>>; disableRedirect: _$zod.ZodOptional<_$zod.ZodBoolean>; idToken: _$zod.ZodOptional<_$zod.ZodObject<{ token: _$zod.ZodString; nonce: _$zod.ZodOptional<_$zod.ZodString>; accessToken: _$zod.ZodOptional<_$zod.ZodString>; refreshToken: _$zod.ZodOptional<_$zod.ZodString>; expiresAt: _$zod.ZodOptional<_$zod.ZodNumber>; user: _$zod.ZodOptional<_$zod.ZodObject<{ name: _$zod.ZodOptional<_$zod.ZodObject<{ firstName: _$zod.ZodOptional<_$zod.ZodString>; lastName: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>>; email: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>>; }, _$zod_v4_core0.$strip>>; scopes: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>; requestSignUp: _$zod.ZodOptional<_$zod.ZodBoolean>; loginHint: _$zod.ZodOptional<_$zod.ZodString>; additionalData: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>>; }, _$zod_v4_core0.$strip>>; returned: { redirect: boolean; token?: string | undefined; url?: string | undefined; user?: ({ id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T ? { [K in keyof T]: T[K] } : never) | undefined; }; }; openapi: { description: string; operationId: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; description: string; properties: { token: { type: string; }; user: { type: string; $ref: string; }; url: { type: string; }; redirect: { type: string; }; }; required: string[]; }; }; }; }; }; }; }; }, { redirect: boolean; url: string; } | { redirect: boolean; token: string; url: undefined; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T_1 ? { [K in keyof T_1]: T_1[K] } : never; }>; readonly callbackOAuth: _$better_call0.StrictEndpoint<"/callback/:id", { method: ("GET" | "POST")[]; operationId: string; body: _$zod.ZodOptional<_$zod.ZodObject<{ code: _$zod.ZodOptional<_$zod.ZodString>; error: _$zod.ZodOptional<_$zod.ZodString>; device_id: _$zod.ZodOptional<_$zod.ZodString>; error_description: _$zod.ZodOptional<_$zod.ZodString>; state: _$zod.ZodOptional<_$zod.ZodString>; user: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>>; query: _$zod.ZodOptional<_$zod.ZodObject<{ code: _$zod.ZodOptional<_$zod.ZodString>; error: _$zod.ZodOptional<_$zod.ZodString>; device_id: _$zod.ZodOptional<_$zod.ZodString>; error_description: _$zod.ZodOptional<_$zod.ZodString>; state: _$zod.ZodOptional<_$zod.ZodString>; user: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>>; metadata: { allowedMediaTypes: string[]; scope: "server"; }; }, never>; readonly getSession: _$better_call0.StrictEndpoint<"/get-session", { method: ("GET" | "POST")[]; operationId: string; query: _$zod.ZodOptional<_$zod.ZodObject<{ disableCookieCache: _$zod.ZodOptional<_$zod.ZodCoercedBoolean<unknown>>; disableRefresh: _$zod.ZodOptional<_$zod.ZodCoercedBoolean<unknown>>; }, _$zod_v4_core0.$strip>>; requireHeaders: true; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { session: { $ref: string; }; user: { $ref: string; }; }; required: string[]; }; }; }; }; }; }; }; }, { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["session"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"session", Option["plugins"]> extends infer T_2 ? { [K_1 in keyof T_2]: T_2[K_1] } : never; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T_3 ? { [K in keyof T_3]: T_3[K] } : never; } | null>; readonly signOut: _$better_call0.StrictEndpoint<"/sign-out", { method: "POST"; operationId: string; requireHeaders: true; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; }; }; }; }; }; }; }; }; }; }, { success: boolean; }>; readonly signUpEmail: _$better_call0.StrictEndpoint<"/sign-up/email", { method: "POST"; operationId: string; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[]; body: _$zod.ZodIntersection<_$zod.ZodObject<{ name: _$zod.ZodString; email: _$zod.ZodEmail; password: _$zod.ZodString; image: _$zod.ZodOptional<_$zod.ZodString>; callbackURL: _$zod.ZodOptional<_$zod.ZodString>; rememberMe: _$zod.ZodOptional<_$zod.ZodBoolean>; }, _$zod_v4_core0.$strip>, _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>>; cloneRequest: true; metadata: { allowedMediaTypes: string[]; $Infer: { body: { name: string; email: string; password: string; image?: string | undefined; callbackURL?: string | undefined; rememberMe?: boolean | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromPluginsInput<"user", Option["plugins"]> & _$_better_auth_core_db0.InferDBFieldsFromOptionsInput<Option["user"]>; returned: { token: string | null; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T_4 ? { [K in keyof T_4]: T_4[K] } : never; }; }; openapi: { operationId: string; description: string; requestBody: { content: { "application/json": { schema: { type: "object"; properties: { name: { type: string; description: string; }; email: { type: string; description: string; }; password: { type: string; description: string; }; image: { type: string; description: string; }; callbackURL: { type: string; description: string; }; rememberMe: { type: string; description: string; }; }; required: string[]; }; }; }; }; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { token: { type: string; nullable: boolean; description: string; }; user: { type: string; properties: { id: { type: string; description: string; }; email: { type: string; format: string; description: string; }; name: { type: string; description: string; }; image: { type: string; format: string; nullable: boolean; description: string; }; emailVerified: { type: string; description: string; }; createdAt: { type: string; format: string; description: string; }; updatedAt: { type: string; format: string; description: string; }; }; required: string[]; }; }; required: string[]; }; }; }; }; "422": { description: string; content: { "application/json": { schema: { type: "object"; properties: { message: { type: string; }; }; }; }; }; }; }; }; }; }, { token: null; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T_5 ? { [K in keyof T_5]: T_5[K] } : never; } | { token: string; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T_6 ? { [K in keyof T_6]: T_6[K] } : never; }>; readonly signInEmail: _$better_call0.StrictEndpoint<"/sign-in/email", { method: "POST"; operationId: string; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[]; cloneRequest: true; body: _$zod.ZodObject<{ email: _$zod.ZodString; password: _$zod.ZodString; callbackURL: _$zod.ZodOptional<_$zod.ZodString>; rememberMe: _$zod.ZodOptional<_$zod.ZodDefault<_$zod.ZodBoolean>>; }, _$zod_v4_core0.$strip>; metadata: { allowedMediaTypes: string[]; $Infer: { body: { email: string; password: string; callbackURL?: string | undefined; rememberMe?: boolean | undefined; }; returned: { redirect: boolean; token: string; url?: string | undefined; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T_7 ? { [K in keyof T_7]: T_7[K] } : never; }; }; openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; description: string; properties: { redirect: { type: string; enum: boolean[]; }; token: { type: string; description: string; }; url: { type: string; nullable: boolean; }; user: { type: string; $ref: string; }; }; required: string[]; }; }; }; }; }; }; }; }, { redirect: boolean; token: string; url?: string | undefined; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["user"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"user", Option["plugins"]> extends infer T_8 ? { [K in keyof T_8]: T_8[K] } : never; }>; readonly resetPassword: _$better_call0.StrictEndpoint<"/reset-password", { method: "POST"; operationId: string; query: _$zod.ZodOptional<_$zod.ZodObject<{ token: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>>; body: _$zod.ZodObject<{ newPassword: _$zod.ZodString; token: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; }, { status: boolean; }>; readonly verifyPassword: _$better_call0.StrictEndpoint<"/verify-password", { method: "POST"; body: _$zod.ZodObject<{ password: _$zod.ZodString; }, _$zod_v4_core0.$strip>; metadata: { scope: "server"; openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; }; }; }; }; }; }; }; }; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; }, { status: boolean; }>; readonly verifyEmail: _$better_call0.StrictEndpoint<"/verify-email", { method: "GET"; operationId: string; query: _$zod.ZodObject<{ token: _$zod.ZodString; callbackURL: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[]; metadata: { openapi: { description: string; parameters: ({ name: string; in: "query"; description: string; required: true; schema: { type: "string"; }; } | { name: string; in: "query"; description: string; required: false; schema: { type: "string"; }; })[]; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { user: { type: string; $ref: string; }; status: { type: string; description: string; }; }; required: string[]; }; }; }; }; }; }; }; }, void | { status: boolean; }>; readonly sendVerificationEmail: _$better_call0.StrictEndpoint<"/send-verification-email", { method: "POST"; operationId: string; cloneRequest: true; body: _$zod.ZodObject<{ email: _$zod.ZodEmail; callbackURL: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; requestBody: { content: { "application/json": { schema: { type: "object"; properties: { email: { type: string; description: string; example: string; }; callbackURL: { type: string; description: string; example: string; nullable: boolean; }; }; required: string[]; }; }; }; }; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; description: string; example: boolean; }; }; }; }; }; }; "400": { description: string; content: { "application/json": { schema: { type: "object"; properties: { message: { type: string; description: string; example: string; }; }; }; }; }; }; }; }; }; }, { status: boolean; }>; readonly changeEmail: _$better_call0.StrictEndpoint<"/change-email", { method: "POST"; body: _$zod.ZodObject<{ newEmail: _$zod.ZodEmail; callbackURL: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; metadata: { openapi: { operationId: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { user: { type: string; $ref: string; }; status: { type: string; description: string; }; message: { type: string; enum: string[]; description: string; nullable: boolean; }; }; required: string[]; }; }; }; }; }; }; }; }, { status: boolean; }>; readonly changePassword: _$better_call0.StrictEndpoint<"/change-password", { method: "POST"; operationId: string; body: _$zod.ZodObject<{ newPassword: _$zod.ZodString; currentPassword: _$zod.ZodString; revokeOtherSessions: _$zod.ZodOptional<_$zod.ZodBoolean>; }, _$zod_v4_core0.$strip>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { token: { type: string; nullable: boolean; description: string; }; user: { type: string; properties: { id: { type: string; description: string; }; email: { type: string; format: string; description: string; }; name: { type: string; description: string; }; image: { type: string; format: string; nullable: boolean; description: string; }; emailVerified: { type: string; description: string; }; createdAt: { type: string; format: string; description: string; }; updatedAt: { type: string; format: string; description: string; }; }; required: string[]; }; }; required: string[]; }; }; }; }; }; }; }; }, { token: string | null; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; } & Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }>; readonly setPassword: _$better_call0.StrictEndpoint<string, { method: "POST"; body: _$zod.ZodObject<{ newPassword: _$zod.ZodString; }, _$zod_v4_core0.$strip>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; }, { status: boolean; }>; readonly updateSession: _$better_call0.StrictEndpoint<"/update-session", { method: "POST"; operationId: string; body: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; metadata: { $Infer: { body: Partial<AdditionalSessionFieldsInput<Option>>; }; openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { session: { type: string; $ref: string; }; }; }; }; }; }; }; }; }; }, { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; }>; readonly updateUser: _$better_call0.StrictEndpoint<"/update-user", { method: "POST"; operationId: string; body: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; metadata: { $Infer: { body: Partial<AdditionalUserFieldsInput<Option>> & { name?: string | undefined; image?: string | undefined | null; }; }; openapi: { operationId: string; description: string; requestBody: { content: { "application/json": { schema: { type: "object"; properties: { name: { type: string; description: string; }; image: { type: string; description: string; nullable: boolean; }; }; }; }; }; }; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { user: { type: string; $ref: string; }; }; }; }; }; }; }; }; }; }, { status: boolean; }>; readonly deleteUser: _$better_call0.StrictEndpoint<"/delete-user", { method: "POST"; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; body: _$zod.ZodObject<{ callbackURL: _$zod.ZodOptional<_$zod.ZodString>; password: _$zod.ZodOptional<_$zod.ZodString>; token: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; requestBody: { content: { "application/json": { schema: { type: "object"; properties: { callbackURL: { type: string; description: string; }; password: { type: string; description: string; }; token: { type: string; description: string; }; }; }; }; }; }; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { success: { type: string; description: string; }; message: { type: string; enum: string[]; description: string; }; }; required: string[]; }; }; }; }; }; }; }; }, { success: boolean; message: string; }>; readonly requestPasswordReset: _$better_call0.StrictEndpoint<"/request-password-reset", { method: "POST"; body: _$zod.ZodObject<{ email: _$zod.ZodEmail; redirectTo: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; message: { type: string; }; }; }; }; }; }; }; }; }; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[]; }, { status: boolean; message: string; }>; readonly requestPasswordResetCallback: _$better_call0.StrictEndpoint<"/reset-password/:token", { method: "GET"; operationId: string; query: _$zod.ZodObject<{ callbackURL: _$zod.ZodString; }, _$zod_v4_core0.$strip>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[]; metadata: { openapi: { operationId: string; description: string; parameters: ({ name: string; in: "path"; required: true; description: string; schema: { type: "string"; }; } | { name: string; in: "query"; required: true; description: string; schema: { type: "string"; }; })[]; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { token: { type: string; }; }; }; }; }; }; }; }; }; }, never>; readonly listSessions: _$better_call0.StrictEndpoint<"/list-sessions", { method: "GET"; operationId: string; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; requireHeaders: true; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "array"; items: { $ref: string; }; }; }; }; }; }; }; }; }, Prettify$1<{ id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; } & _$_better_auth_core_db0.InferDBFieldsFromOptions<Option["session"]> & _$_better_auth_core_db0.InferDBFieldsFromPlugins<"session", Option["plugins"]> extends infer T_9 ? { [K_1 in keyof T_9]: T_9[K_1] } : never>[]>; readonly revokeSession: _$better_call0.StrictEndpoint<"/revoke-session", { method: "POST"; body: _$zod.ZodObject<{ token: _$zod.ZodString; }, _$zod_v4_core0.$strip>; use: Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{ session: { session: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record<string, any> & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>>[]; requireHeaders: true; metadata: { openapi: { description: string;