better-auth
Version:
The most comprehensive authentication framework for TypeScript.
1,522 lines (1,520 loc) • 404 kB
text/typescript
import { Prettify as Prettify$1, UnionToIntersection } from "../types/helper.mjs";
import { InferRoute } from "../client/path-to-object.mjs";
import { InferErrorCodes, IsSignal } from "../client/types.mjs";
import { InferAPI } from "../types/api.mjs";
import { Session, User } from "../types/models.mjs";
import { Auth } from "../types/auth.mjs";
import "../types/index.mjs";
import "../index.mjs";
import { setCookieToHeader } from "../cookies/cookie-utils.mjs";
import "../cookies/index.mjs";
import * as _better_auth_core23 from "@better-auth/core";
import { Awaitable, BetterAuthClientOptions, BetterAuthOptions } from "@better-auth/core";
import * as _better_auth_core_oauth22 from "@better-auth/core/oauth2";
import * as _better_auth_core_db_adapter0 from "@better-auth/core/db/adapter";
import * as zod613 from "zod";
import * as better_call287 from "better-call";
import * as nanostores3 from "nanostores";
import * as _better_fetch_fetch80 from "@better-fetch/fetch";
import { SuccessContext } from "@better-fetch/fetch";
import * as zod_v4_core91 from "zod/v4/core";
//#region src/test-utils/test-instance.d.ts
declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends BetterAuthClientOptions>(options?: O | undefined, config?: {
clientOptions?: C;
port?: number;
disableTestUser?: boolean;
testUser?: Partial<User>;
testWith?: "sqlite" | "postgres" | "mongodb" | "mysql";
} | undefined): Promise<{
auth: Auth<O>;
client: UnionToIntersection<(C extends undefined ? {} : C) & {
baseURL: string | undefined;
fetchOptions: {
customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
};
} extends infer T ? T extends (C extends undefined ? {} : C) & {
baseURL: string | undefined;
fetchOptions: {
customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
};
} ? T extends {
plugins: Array<infer Plugin>;
} ? UnionToIntersection<Plugin extends _better_auth_core23.BetterAuthClientPlugin ? Plugin["getAtoms"] extends ((fetch: any) => infer Atoms) ? Atoms extends Record<string, any> ? { [key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: Atoms[key] } : {} : {} : {}> : {} : never : never> & UnionToIntersection<InferRoute<((C extends undefined ? {} : C) & {
baseURL: string | undefined;
fetchOptions: {
customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
};
})["plugins"] extends any[] ? {
getSession: <R extends boolean, H extends boolean = false>(context: {
headers: Headers;
query?: {
disableCookieCache?: boolean;
disableRefresh?: boolean;
} | undefined;
asResponse?: R | undefined;
returnHeaders?: H | undefined;
}) => false extends R ? H extends true ? Promise<{
headers: Headers;
response: {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
} | null;
}> : Promise<{
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
} | null> : Promise<Response>;
} & {
readonly ok: better_call287.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_call287.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_call287.StrictEndpoint<"/sign-in/social", {
method: "POST";
operationId: string;
body: zod613.ZodObject<{
callbackURL: zod613.ZodOptional<zod613.ZodString>;
newUserCallbackURL: zod613.ZodOptional<zod613.ZodString>;
errorCallbackURL: zod613.ZodOptional<zod613.ZodString>;
provider: zod613.ZodType<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown, zod_v4_core91.$ZodTypeInternals<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown>>;
disableRedirect: zod613.ZodOptional<zod613.ZodBoolean>;
idToken: zod613.ZodOptional<zod613.ZodObject<{
token: zod613.ZodString;
nonce: zod613.ZodOptional<zod613.ZodString>;
accessToken: zod613.ZodOptional<zod613.ZodString>;
refreshToken: zod613.ZodOptional<zod613.ZodString>;
expiresAt: zod613.ZodOptional<zod613.ZodNumber>;
}, zod_v4_core91.$strip>>;
scopes: zod613.ZodOptional<zod613.ZodArray<zod613.ZodString>>;
requestSignUp: zod613.ZodOptional<zod613.ZodBoolean>;
loginHint: zod613.ZodOptional<zod613.ZodString>;
additionalData: zod613.ZodOptional<zod613.ZodRecord<zod613.ZodString, zod613.ZodAny>>;
}, zod_v4_core91.$strip>;
metadata: {
$Infer: {
body: zod613.infer<zod613.ZodObject<{
callbackURL: zod613.ZodOptional<zod613.ZodString>;
newUserCallbackURL: zod613.ZodOptional<zod613.ZodString>;
errorCallbackURL: zod613.ZodOptional<zod613.ZodString>;
provider: zod613.ZodType<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown, zod_v4_core91.$ZodTypeInternals<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown>>;
disableRedirect: zod613.ZodOptional<zod613.ZodBoolean>;
idToken: zod613.ZodOptional<zod613.ZodObject<{
token: zod613.ZodString;
nonce: zod613.ZodOptional<zod613.ZodString>;
accessToken: zod613.ZodOptional<zod613.ZodString>;
refreshToken: zod613.ZodOptional<zod613.ZodString>;
expiresAt: zod613.ZodOptional<zod613.ZodNumber>;
}, zod_v4_core91.$strip>>;
scopes: zod613.ZodOptional<zod613.ZodArray<zod613.ZodString>>;
requestSignUp: zod613.ZodOptional<zod613.ZodBoolean>;
loginHint: zod613.ZodOptional<zod613.ZodString>;
additionalData: zod613.ZodOptional<zod613.ZodRecord<zod613.ZodString, zod613.ZodAny>>;
}, zod_v4_core91.$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;
} | 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;
enum: boolean[];
};
};
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;
};
}>;
readonly callbackOAuth: better_call287.StrictEndpoint<"/callback/:id", {
method: ("GET" | "POST")[];
operationId: string;
body: zod613.ZodOptional<zod613.ZodObject<{
code: zod613.ZodOptional<zod613.ZodString>;
error: zod613.ZodOptional<zod613.ZodString>;
device_id: zod613.ZodOptional<zod613.ZodString>;
error_description: zod613.ZodOptional<zod613.ZodString>;
state: zod613.ZodOptional<zod613.ZodString>;
user: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$strip>>;
query: zod613.ZodOptional<zod613.ZodObject<{
code: zod613.ZodOptional<zod613.ZodString>;
error: zod613.ZodOptional<zod613.ZodString>;
device_id: zod613.ZodOptional<zod613.ZodString>;
error_description: zod613.ZodOptional<zod613.ZodString>;
state: zod613.ZodOptional<zod613.ZodString>;
user: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$strip>>;
metadata: {
allowedMediaTypes: string[];
scope: "server";
};
}, void>;
readonly getSession: better_call287.StrictEndpoint<"/get-session", {
method: "GET";
operationId: string;
query: zod613.ZodOptional<zod613.ZodObject<{
disableCookieCache: zod613.ZodOptional<zod613.ZodCoercedBoolean<unknown>>;
disableRefresh: zod613.ZodOptional<zod613.ZodCoercedBoolean<unknown>>;
}, zod_v4_core91.$strip>>;
requireHeaders: true;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
nullable: boolean;
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;
};
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
} | null>;
readonly signOut: better_call287.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_call287.StrictEndpoint<"/sign-up/email", {
method: "POST";
operationId: string;
body: zod613.ZodIntersection<zod613.ZodObject<{
name: zod613.ZodString;
email: zod613.ZodEmail;
password: zod613.ZodString;
image: zod613.ZodOptional<zod613.ZodString>;
callbackURL: zod613.ZodOptional<zod613.ZodString>;
rememberMe: zod613.ZodOptional<zod613.ZodBoolean>;
}, zod_v4_core91.$strip>, zod613.ZodRecord<zod613.ZodString, zod613.ZodAny>>;
metadata: {
$Infer: {
body: {
name: string;
email: string;
password: string;
image?: string | undefined;
callbackURL?: string | undefined;
rememberMe?: boolean | undefined;
};
returned: {
token: string | null;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
};
};
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;
};
} | {
token: string;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
}>;
readonly signInEmail: better_call287.StrictEndpoint<"/sign-in/email", {
method: "POST";
operationId: string;
body: zod613.ZodObject<{
email: zod613.ZodString;
password: zod613.ZodString;
callbackURL: zod613.ZodOptional<zod613.ZodString>;
rememberMe: zod613.ZodOptional<zod613.ZodDefault<zod613.ZodBoolean>>;
}, zod_v4_core91.$strip>;
metadata: {
$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;
};
};
};
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;
};
}>;
readonly resetPassword: better_call287.StrictEndpoint<"/reset-password", {
method: "POST";
operationId: string;
query: zod613.ZodOptional<zod613.ZodObject<{
token: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$strip>>;
body: zod613.ZodObject<{
newPassword: zod613.ZodString;
token: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$strip>;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly verifyEmail: better_call287.StrictEndpoint<"/verify-email", {
method: "GET";
operationId: string;
query: zod613.ZodObject<{
token: zod613.ZodString;
callbackURL: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$strip>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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_call287.StrictEndpoint<"/send-verification-email", {
method: "POST";
operationId: string;
body: zod613.ZodObject<{
email: zod613.ZodEmail;
callbackURL: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$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_call287.StrictEndpoint<"/change-email", {
method: "POST";
body: zod613.ZodObject<{
newEmail: zod613.ZodEmail;
callbackURL: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$strip>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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[];
};
};
};
};
"422": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
message: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly changePassword: better_call287.StrictEndpoint<"/change-password", {
method: "POST";
operationId: string;
body: zod613.ZodObject<{
newPassword: zod613.ZodString;
currentPassword: zod613.ZodString;
revokeOtherSessions: zod613.ZodOptional<zod613.ZodBoolean>;
}, zod_v4_core91.$strip>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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;
email: string;
name: string;
image: string | null | undefined;
emailVerified: boolean;
createdAt: Date;
updatedAt: Date;
};
}>;
readonly setPassword: better_call287.StrictEndpoint<string, {
method: "POST";
body: zod613.ZodObject<{
newPassword: zod613.ZodString;
}, zod_v4_core91.$strip>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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 updateUser: better_call287.StrictEndpoint<"/update-user", {
method: "POST";
operationId: string;
body: zod613.ZodRecord<zod613.ZodString, zod613.ZodAny>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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<{}> & {
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_call287.StrictEndpoint<"/delete-user", {
method: "POST";
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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: zod613.ZodObject<{
callbackURL: zod613.ZodOptional<zod613.ZodString>;
password: zod613.ZodOptional<zod613.ZodString>;
token: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$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_call287.StrictEndpoint<"/request-password-reset", {
method: "POST";
body: zod613.ZodObject<{
email: zod613.ZodEmail;
redirectTo: zod613.ZodOptional<zod613.ZodString>;
}, zod_v4_core91.$strip>;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
};
message: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
message: string;
}>;
readonly requestPasswordResetCallback: better_call287.StrictEndpoint<"/reset-password/:token", {
method: "GET";
operationId: string;
query: zod613.ZodObject<{
callbackURL: zod613.ZodString;
}, zod_v4_core91.$strip>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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_call287.StrictEndpoint<"/list-sessions", {
method: "GET";
operationId: string;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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;
}>[]>;
readonly revokeSession: better_call287.StrictEndpoint<"/revoke-session", {
method: "POST";
body: zod613.ZodObject<{
token: zod613.ZodString;
}, zod_v4_core91.$strip>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
token: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly revokeSessions: better_call287.StrictEndpoint<"/revoke-sessions", {
method: "POST";
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly revokeOtherSessions: better_call287.StrictEndpoint<"/revoke-other-sessions", {
method: "POST";
requireHeaders: true;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.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: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
readonly linkSocialAccount: better_call287.StrictEndpoint<"/link-social", {
method: "POST";
requireHeaders: true;
body: zod613.ZodObject<{
callbackURL: zod613.ZodOptional<zod613.ZodString>;
provider: zod613.ZodType<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown, zod_v4_core91.$ZodTypeInternals<"github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel" | (string & {}), unknown>>;
idToken: zod613.ZodOptional<zod613.ZodObject<{
token: zod613.ZodString;
nonce: zod613.ZodOptional<zod613.ZodString>;
accessToken: zod613.ZodOptional<zod613.ZodString>;
refreshToken: zod613.ZodOptional<zod613.ZodString>;
scopes: zod613.ZodOptional<zod613.ZodArray<zod613.ZodString>>;
}, zod_v4_core91.$strip>>;
requestSignUp: zod613.ZodOptional<zod613.ZodBoolean>;
scopes: zod613.ZodOptional<zod613.ZodArray<zod613.ZodString>>;
errorCallbackURL: zod613.ZodOptional<zod613.ZodString>;
disableRedirect: zod613.ZodOptional<zod613.ZodBoolean>;
additionalData: zod613.ZodOptional<zod613.ZodRecord<zod613.ZodString, zod613.ZodAny>>;
}, zod_v4_core91.$strip>;
use: ((inputContext: better_call287.MiddlewareInputContext<better_call287.MiddlewareOptions>) => Promise<{