everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
4,182 lines • 165 kB
text/typescript
import { ClientRuntimeConfig } from "../types.cjs";
import { CookieOptions } from "../node_modules/better-call/dist/cookies.cjs";
import { StrictEndpoint } from "../node_modules/better-call/dist/endpoint.cjs";
import { MiddlewareContext, MiddlewareInputContext, MiddlewareOptions } from "../node_modules/better-call/dist/middleware.cjs";
import { AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs } from "../node_modules/@simplewebauthn/server/esm/types/dom.cjs";
import { AuthenticationResponseJSON, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from "../node_modules/@simplewebauthn/server/esm/types/index.cjs";
import { BetterFetch } from "../node_modules/@better-fetch/fetch/dist/index.cjs";
import { PreinitializedWritableAtom } from "../node_modules/nanostores/atom/index.cjs";
import { AuthContext, clearAuthenticatedQueries, requireAdmin, requireSession } from "./auth-guards.cjs";
import { pluginHref, pluginPath, pluginSearch } from "./plugin-path.cjs";
import { QueryClient } from "@tanstack/react-query";
import { PasskeyWalletLink } from "better-near-auth";
//#region src/ui/auth.d.ts
type CreateAuthClientOptions = {
runtimeConfig?: Partial<ClientRuntimeConfig>;
headers?: HeadersInit;
cspNonce?: string;
};
declare function getDeviceLinkClientId(config?: Partial<ClientRuntimeConfig>): string;
declare function createAuthClient(options?: CreateAuthClientOptions): import("better-auth/react").ReactAuthClient<{
baseURL: string;
fetchOptions: {
credentials: "include";
headers?: HeadersInit | undefined;
};
plugins: ({
id: "api-key";
version: string;
$InferServerPlugin: {
id: "api-key";
version: string;
$ERROR_CODES: {
INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
};
hooks: {
before: {
matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
handler: (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
session: {
id: string;
token: string;
userId: string;
userAgent: string | null;
ipAddress: string | null;
createdAt: Date;
updatedAt: Date;
expiresAt: Date;
};
} | {
context: MiddlewareContext<MiddlewareOptions, {
returned?: unknown | undefined;
responseHeaders?: Headers | undefined;
} & import("better-auth").PluginContext<import("better-auth").BetterAuthOptions> & import("better-auth").InfoContext & {
options: import("better-auth").BetterAuthOptions;
trustedOrigins: string[];
trustedProviders: string[];
isTrustedOrigin: (url: string, settings?: {
allowRelativePaths: boolean;
}) => boolean;
oauthConfig: {
skipStateCookieCheck?: boolean | undefined;
storeStateStrategy: "database" | "cookie";
};
newSession: {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
} & Record<string, any>;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & Record<string, any>;
} | null;
session: {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
} & Record<string, any>;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & Record<string, any>;
} | null;
setNewSession: (session: {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
} & Record<string, any>;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & Record<string, any>;
} | null) => void;
socialProviders: import("better-auth").OAuthProvider[];
authCookies: import("better-auth").BetterAuthCookies;
logger: ReturnType<typeof import("better-auth").createLogger>;
rateLimit: {
enabled: boolean;
window: number;
max: number;
storage: "memory" | "database" | "secondary-storage";
} & Omit<import("better-auth").BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
adapter: import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
internalAdapter: import("better-auth").InternalAdapter<import("better-auth").BetterAuthOptions>;
createAuthCookie: (cookieName: string, overrideAttributes?: Partial<CookieOptions> | undefined) => import("better-auth").BetterAuthCookie;
secret: string;
secretConfig: string | import("better-auth").SecretConfig;
sessionConfig: {
updateAge: number;
expiresIn: number;
freshAge: number;
cookieRefreshCache: false | {
enabled: true;
updateAge: number;
};
};
generateId: (options: {
model: import("better-auth").ModelNames;
size?: number | undefined;
}) => string | false;
secondaryStorage: import("better-auth").SecondaryStorage | undefined;
password: {
hash: (password: string) => Promise<string>;
verify: (data: {
password: string;
hash: string;
}) => Promise<boolean>;
config: {
minPasswordLength: number;
maxPasswordLength: number;
};
checkPassword: (userId: string, ctx: import("better-auth").GenericEndpointContext<import("better-auth").BetterAuthOptions>) => Promise<boolean>;
};
tables: import("better-auth").BetterAuthDBSchema;
runMigrations: () => Promise<void>;
publishTelemetry: (event: {
type: string;
anonymousId?: string | undefined;
payload: Record<string, any>;
}) => Promise<void>;
skipOriginCheck: boolean | string[];
skipCSRFCheck: boolean;
runInBackground: (promise: Promise<unknown>) => void;
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => import("better-auth").Awaitable<unknown>;
}>;
}>;
}[];
};
endpoints: {
createApiKey: StrictEndpoint<"/api-key/create", {
method: "POST";
body: import("zod").ZodObject<{
configId: import("zod").ZodOptional<import("zod").ZodString>;
name: import("zod").ZodOptional<import("zod").ZodString>;
expiresIn: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
prefix: import("zod").ZodOptional<import("zod").ZodString>;
remaining: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
metadata: import("zod").ZodOptional<import("zod").ZodAny>;
refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
organizationId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
id: {
type: string;
description: string;
};
createdAt: {
type: string;
format: string;
description: string;
};
updatedAt: {
type: string;
format: string;
description: string;
};
name: {
type: string;
nullable: boolean;
description: string;
};
prefix: {
type: string;
nullable: boolean;
description: string;
};
start: {
type: string;
nullable: boolean;
description: string;
};
key: {
type: string;
description: string;
};
enabled: {
type: string;
description: string;
};
expiresAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
referenceId: {
type: string;
description: string;
};
lastRefillAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
lastRequest: {
type: string;
format: string;
nullable: boolean;
description: string;
};
metadata: {
type: string;
nullable: boolean;
additionalProperties: boolean;
description: string;
};
rateLimitMax: {
type: string;
nullable: boolean;
description: string;
};
rateLimitTimeWindow: {
type: string;
nullable: boolean;
description: string;
};
remaining: {
type: string;
nullable: boolean;
description: string;
};
refillAmount: {
type: string;
nullable: boolean;
description: string;
};
refillInterval: {
type: string;
nullable: boolean;
description: string;
};
rateLimitEnabled: {
type: string;
description: string;
};
requestCount: {
type: string;
description: string;
};
permissions: {
type: string;
nullable: boolean;
additionalProperties: {
type: string;
items: {
type: string;
};
};
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
key: string;
metadata: any;
permissions: any;
id: string;
configId: string;
name: string | null;
start: string | null;
prefix: string | null;
referenceId: string;
refillInterval: number | null;
refillAmount: number | null;
lastRefillAt: Date | null;
enabled: boolean;
rateLimitEnabled: boolean;
rateLimitTimeWindow: number | null;
rateLimitMax: number | null;
requestCount: number;
remaining: number | null;
lastRequest: Date | null;
expiresAt: Date | null;
createdAt: Date;
updatedAt: Date;
}>;
verifyApiKey: StrictEndpoint<string, {
method: "POST";
body: import("zod").ZodObject<{
configId: import("zod").ZodOptional<import("zod").ZodString>;
key: import("zod").ZodString;
permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
}, import("zod/v4/core").$strip>;
}, {
valid: boolean;
error: {
message: import("better-auth").RawError<"INVALID_API_KEY">;
code: "KEY_NOT_FOUND";
};
key: null;
} | {
valid: boolean;
error: {
message: string | undefined;
code: string;
cause?: unknown;
};
key: null;
} | {
valid: boolean;
error: {
message: import("better-auth").RawError<"INVALID_API_KEY">;
code: "INVALID_API_KEY";
};
key: null;
} | {
valid: boolean;
error: null;
key: Omit<import("@better-auth/api-key/client").ApiKey, "key"> | null;
}>;
getApiKey: StrictEndpoint<"/api-key/get", {
method: "GET";
query: import("zod").ZodObject<{
configId: import("zod").ZodOptional<import("zod").ZodString>;
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
use: ((inputContext: MiddlewareInputContext<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: {
id: {
type: string;
description: string;
};
name: {
type: string;
nullable: boolean;
description: string;
};
start: {
type: string;
nullable: boolean;
description: string;
};
prefix: {
type: string;
nullable: boolean;
description: string;
};
userId: {
type: string;
description: string;
};
refillInterval: {
type: string;
nullable: boolean;
description: string;
};
refillAmount: {
type: string;
nullable: boolean;
description: string;
};
lastRefillAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
enabled: {
type: string;
description: string;
default: boolean;
};
rateLimitEnabled: {
type: string;
description: string;
};
rateLimitTimeWindow: {
type: string;
nullable: boolean;
description: string;
};
rateLimitMax: {
type: string;
nullable: boolean;
description: string;
};
requestCount: {
type: string;
description: string;
};
remaining: {
type: string;
nullable: boolean;
description: string;
};
lastRequest: {
type: string;
format: string;
nullable: boolean;
description: string;
};
expiresAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
createdAt: {
type: string;
format: string;
description: string;
};
updatedAt: {
type: string;
format: string;
description: string;
};
metadata: {
type: string;
nullable: boolean;
additionalProperties: boolean;
description: string;
};
permissions: {
type: string;
nullable: boolean;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
metadata: Record<string, any> | null;
permissions: {
[key: string]: string[];
} | null;
id: string;
configId: string;
name: string | null;
start: string | null;
prefix: string | null;
referenceId: string;
refillInterval: number | null;
refillAmount: number | null;
lastRefillAt: Date | null;
enabled: boolean;
rateLimitEnabled: boolean;
rateLimitTimeWindow: number | null;
rateLimitMax: number | null;
requestCount: number;
remaining: number | null;
lastRequest: Date | null;
expiresAt: Date | null;
createdAt: Date;
updatedAt: Date;
}>;
updateApiKey: StrictEndpoint<"/api-key/update", {
method: "POST";
body: import("zod").ZodObject<{
configId: import("zod").ZodOptional<import("zod").ZodString>;
keyId: import("zod").ZodString;
userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
name: import("zod").ZodOptional<import("zod").ZodString>;
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
remaining: import("zod").ZodOptional<import("zod").ZodNumber>;
refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
metadata: import("zod").ZodOptional<import("zod").ZodAny>;
expiresIn: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>;
rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
permissions: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>>;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
id: {
type: string;
description: string;
};
name: {
type: string;
nullable: boolean;
description: string;
};
start: {
type: string;
nullable: boolean;
description: string;
};
prefix: {
type: string;
nullable: boolean;
description: string;
};
userId: {
type: string;
description: string;
};
refillInterval: {
type: string;
nullable: boolean;
description: string;
};
refillAmount: {
type: string;
nullable: boolean;
description: string;
};
lastRefillAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
enabled: {
type: string;
description: string;
default: boolean;
};
rateLimitEnabled: {
type: string;
description: string;
};
rateLimitTimeWindow: {
type: string;
nullable: boolean;
description: string;
};
rateLimitMax: {
type: string;
nullable: boolean;
description: string;
};
requestCount: {
type: string;
description: string;
};
remaining: {
type: string;
nullable: boolean;
description: string;
};
lastRequest: {
type: string;
format: string;
nullable: boolean;
description: string;
};
expiresAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
createdAt: {
type: string;
format: string;
description: string;
};
updatedAt: {
type: string;
format: string;
description: string;
};
metadata: {
type: string;
nullable: boolean;
additionalProperties: boolean;
description: string;
};
permissions: {
type: string;
nullable: boolean;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
metadata: Record<string, any> | null;
permissions: {
[key: string]: string[];
} | null;
id: string;
configId: string;
name: string | null;
start: string | null;
prefix: string | null;
referenceId: string;
refillInterval: number | null;
refillAmount: number | null;
lastRefillAt: Date | null;
enabled: boolean;
rateLimitEnabled: boolean;
rateLimitTimeWindow: number | null;
rateLimitMax: number | null;
requestCount: number;
remaining: number | null;
lastRequest: Date | null;
expiresAt: Date | null;
createdAt: Date;
updatedAt: Date;
}>;
deleteApiKey: StrictEndpoint<"/api-key/delete", {
method: "POST";
body: import("zod").ZodObject<{
configId: import("zod").ZodOptional<import("zod").ZodString>;
keyId: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
use: ((inputContext: MiddlewareInputContext<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;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
keyId: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
listApiKeys: StrictEndpoint<"/api-key/list", {
method: "GET";
use: ((inputContext: MiddlewareInputContext<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;
};
};
}>)[];
query: import("zod").ZodOptional<import("zod").ZodObject<{
configId: import("zod").ZodOptional<import("zod").ZodString>;
organizationId: import("zod").ZodOptional<import("zod").ZodString>;
limit: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
offset: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
sortBy: import("zod").ZodOptional<import("zod").ZodString>;
sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
asc: "asc";
desc: "desc";
}>>;
}, import("zod/v4/core").$strip>>;
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
apiKeys: {
type: string;
items: {
type: string;
properties: {
id: {
type: string;
description: string;
};
name: {
type: string;
nullable: boolean;
description: string;
};
start: {
type: string;
nullable: boolean;
description: string;
};
prefix: {
type: string;
nullable: boolean;
description: string;
};
userId: {
type: string;
description: string;
};
refillInterval: {
type: string;
nullable: boolean;
description: string;
};
refillAmount: {
type: string;
nullable: boolean;
description: string;
};
lastRefillAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
enabled: {
type: string;
description: string;
default: boolean;
};
rateLimitEnabled: {
type: string;
description: string;
};
rateLimitTimeWindow: {
type: string;
nullable: boolean;
description: string;
};
rateLimitMax: {
type: string;
nullable: boolean;
description: string;
};
requestCount: {
type: string;
description: string;
};
remaining: {
type: string;
nullable: boolean;
description: string;
};
lastRequest: {
type: string;
format: string;
nullable: boolean;
description: string;
};
expiresAt: {
type: string;
format: string;
nullable: boolean;
description: string;
};
createdAt: {
type: string;
format: string;
description: string;
};
updatedAt: {
type: string;
format: string;
description: string;
};
metadata: {
type: string;
nullable: boolean;
additionalProperties: boolean;
description: string;
};
permissions: {
type: string;
nullable: boolean;
description: string;
};
};
required: string[];
};
};
total: {
type: string;
description: string;
};
limit: {
type: string;
nullable: boolean;
description: string;
};
offset: {
type: string;
nullable: boolean;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
apiKeys: {
metadata: Record<string, any> | null;
permissions: {
[key: string]: string[];
} | null;
id: string;
configId: string;
name: string | null;
start: string | null;
prefix: string | null;
referenceId: string;
refillInterval: number | null;
refillAmount: number | null;
lastRefillAt: Date | null;
enabled: boolean;
rateLimitEnabled: boolean;
rateLimitTimeWindow: number | null;
rateLimitMax: number | null;
requestCount: number;
remaining: number | null;
lastRequest: Date | null;
expiresAt: Date | null;
createdAt: Date;
updatedAt: Date;
}[];
total: number;
limit: number | undefined;
offset: number | undefined;
}>;
deleteAllExpiredApiKeys: StrictEndpoint<string, {
method: "POST";
}, {
success: boolean;
error: unknown;
}>;
};
schema: {
apikey: {
fields: {
configId: {
type: "string";
required: true;
defaultValue: string;
input: false;
index: true;
};
name: {
type: "string";
required: false;
input: false;
};
start: {
type: "string";
required: false;
input: false;
};
referenceId: {
type: "string";
required: true;
input: false;
index: true;
};
prefix: {
type: "string";
required: false;
input: false;
};
key: {
type: "string";
required: true;
input: false;
index: true;
};
refillInterval: {
type: "number";
required: false;
input: false;
};
refillAmount: {
type: "number";
required: false;
input: false;
};
lastRefillAt: {
type: "date";
required: false;
input: false;
};
enabled: {
type: "boolean";
required: false;
input: false;
defaultValue: true;
};
rateLimitEnabled: {
type: "boolean";
required: false;
input: false;
defaultValue: true;
};
rateLimitTimeWindow: {
type: "number";
required: false;
input: false;
defaultValue: number;
};
rateLimitMax: {
type: "number";
required: false;
input: false;
defaultValue: number;
};
requestCount: {
type: "number";
required: false;
input: false;
defaultValue: number;
};
remaining: {
type: "number";
required: false;
input: false;
};
lastRequest: {
type: "date";
required: false;
input: false;
};
expiresAt: {
type: "date";
required: false;
input: false;
};
createdAt: {
type: "date";
required: true;
input: false;
};
updatedAt: {
type: "date";
required: true;
input: false;
};
permissions: {
type: "string";
required: false;
input: false;
};
metadata: {
type: "string";
required: false;
input: true;
transform: {
input(value: import("better-auth").DBPrimitive): string;
output(value: import("better-auth").DBPrimitive): any;
};
};
};
};
};
};
pathMethods: {
"/api-key/create": "POST";
"/api-key/delete": "POST";
"/api-key/delete-all-expired-api-keys": "POST";
};
$ERROR_CODES: {
INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
};
} | {
id: "passkey";
version: string;
$InferServerPlugin: ReturnType<(options?: import("@better-auth/passkey/client").PasskeyOptions | undefined) => {
id: "passkey";
version: string;
endpoints: {
generatePasskeyRegistrationOptions: StrictEndpoint<"/passkey/generate-register-options", {
method: "GET";
use: ((inputContext: MiddlewareInputContext<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;
};
};
}>)[];
query: import("zod").ZodOptional<import("zod").ZodObject<{
authenticatorAttachment: import("zod").ZodOptional<import("zod").ZodEnum<{
platform: "platform";
"cross-platform": "cross-platform";
}>>;
name: import("zod").ZodOptional<import("zod").ZodString>;
context: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>>;
metadata: {
openapi: {
operationId: string;
description: string;
parameters: {
name: string;
in: "query";
required: false;
description: string;
schema: {
type: "string";
};
}[];
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
challenge: {
type: string;
};
rp: {
type: string;
properties: {
name: {
type: string;
};
id: {
type: string;
};
};
};
user: {
type: string;
properties: {
id: {
type: string;
};
name: {
type: string;
};
displayName: {
type: string;
};
};
};
pubKeyCredParams: {
type: string;
items: {
type: string;
properties: {
type: {
type: string;
};
alg: {
type: string;
};
};
};
};
timeout: {
type: string;
};
excludeCredentials: {
type: string;
items: {
type: string;
properties: {
id: {
type: string;
};
type: {
type: string;
};
transports: {
type: string;
items: {
type: string;
};
};
};
};
};
authenticatorSelection: {
type: string;
properties: {
authenticatorAttachment: {
type: string;
};
requireResidentKey: {
type: string;
};
userVerification: {
type: string;
};
};
};
attestation: {
type: string;
};
extensions: {
type: string;
};
};
};
};
};
};
};
};
};
}, PublicKeyCredentialCreationOptionsJSON>;
generatePasskeyAuthenticationOptions: StrictEndpoint<"/passkey/generate-authenticate-options", {
method: "GET";
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
challenge: {
type: string;
};
rp: {
type: string;
properties: {
name: {
type: string;
};
id: {
type: string;
};
};
};
user: {
type: string;
properties: {
id: {
type: string;
};
name: {
type: string;
};
displayName: {
type: string;
};
};
};
timeout: {
type: string;
};
allowCredentials: {
type: string;
items: {
type: string;
properties: {
id: {
type: string;
};
type: {
type: string;
};
transports: {
type: string;
items: {
type: string;
};
};
};
};
};
userVerification: {
type: string;
};
authenticatorSelection: {
type: string;
properties: {
authenticatorAttachment: {
type: string;
};
requireResidentKey: {
type: string;
};
userVerification: {
type: string;
};
};
};
extensions: {
type: string;
};
};
};
};
};
};
};
};
};
}, PublicKeyCredentialRequestOptionsJSON>;
verifyPasskeyRegistration: StrictEndpoint<"/passkey/verify-registration", {
method: "POST";
body: import("zod").ZodObject<{
response: import("zod").ZodAny;
name: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: MiddlewareInputContext<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: {
$ref: string;
};
};
};
};
400: {
description: string;
};
};
};
};
}, import("@better-auth/passkey/client").Passkey>;
verifyPasskeyAuthentication: StrictEndpoint<"/passkey/verify-authentication", {
method: "POST";
body: import("zod").ZodObject<{
response: import("zod").ZodRecord<import("zod").ZodAny, import("zod").ZodAny>;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
operationId: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
session: {
$ref: string;
};
user: {
$ref: string;
};
};
};
};
};
};
};
};
$Infer: {
body: {
response: AuthenticationResponseJSON;
};
};
};
}, {
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;
};
}>;
listPasskeys: StrictEndpoint<"/passkey/list-user-passkeys", {
method: "GET";
use: ((inputContext: MiddlewareInputContext<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: "array";
items: {
$ref: string;
required: string[];
};
description: string;
};
};
};
};
};
};
};
}, import("@better-auth/passkey/client").Passkey[]>;
deletePasskey: StrictEndpoint<"/passkey/delete-passkey", {
method: "POST";
body: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
use: (((inputContext: MiddlewareInputContext<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;
};
};
}>) | ((inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
verifiedResource: {};
}>))[];
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
updatePasskey: StrictEndpoint<"/passkey/update-passkey", {
method: "POST";
body: import("zod").ZodObject<{
id: import("zod").ZodString;
name: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
use: (((inputContext: MiddlewareInputContext<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;
};
};
}>) | ((inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
verifiedResource: {};
}>))[];
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
passkey: {
$ref: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
passkey: import("@better-auth/passkey/client").Passkey;
}>;
};
schema: {
passkey: {
fields: {
name: {
type: "string";
required: false;
};
publicKey: {
type: "string";
required: true;
};
userId: {
type: "string";
references: {
model: string;
field: string;
};
required: true;
index: true;
};
credentialID: {
type: "string";
required: true;
index: true;
};
counter: {
type: "number";
required: true;
};
deviceType: {
type: "string";
required: true;
};
backedUp: {
type: "boolean";
required: true;
};
transports: {
type: "string";
required: false;
};
createdAt: {
type: "date";
required: false;
};
aaguid: {
type: "string";
required: false;
};
};
};
};
$ERROR_CODES: {
CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
PREVIOUSLY_REGISTERED: import("better-auth").RawError<"PREVIOUSLY_REGISTERED">;
REGISTRATION_CANCELLED: import("better-auth").RawError<"REGISTRATION_CANCELLED">;
AUTH_CANCELLED: import("better-auth").RawError<"AUTH_CANCELLED">;
UNKNOWN_ERROR: import("better-auth").RawError<"UNKNOWN_ERROR">;
SESSION_REQUIRED: import("better-auth").RawError<"SESSION_REQUIRED">;
RESOLVE_USER_REQUIRED: import("better-auth").RawError<"RESOLVE_USER_REQUIRED">;
RESOLVED_USER_INVALID: import("better-auth").RawError<"RESOLVED_USER_INVALID">;
};
options: import("@better-auth/passkey/client").PasskeyOptions | undefined;
}>;
getActions: ($fetch: BetterFetch, $store: import("better-auth").ClientStore) => {
signIn: {
passkey: (opts?: {
autoFill?: boolean;
extensions?: AuthenticationExtensionsClientInputs;
returnWebAuthnResponse?: boolean;
fetchOptions?: import("better-auth").ClientFetchOption;
} | undefined, options?: import("better-auth").ClientFetchOption | undefined) => Promise<{
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
} | {
data: {
session: import("better-auth").Session;
user: import("better-auth").User;
};
error: null;
} | {
data: null;
error: {
code: string;
message: string;
status: number;
statusText: string;
};
} | {
webauthn: {
response: AuthenticationResponseJSON;
clientExtensionResults: AuthenticationExtensionsClientOutputs;
};
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
} | {
webauthn: {
response: AuthenticationResponseJSON;
clientExtensionResults: AuthenticationExtensionsClientOutputs;
};
data: {
session: import("better-auth").Session;
user: import("better-auth").User;
};
error: null;
}>;
};
passkey: {
addPasskey: (opts?: {
fetchOptions?: import("better-auth").ClientFetchOption;
name?: string;
authenticatorAttachment?: "platform" | "cross-platform";
context?: string | null;
extensions?: AuthenticationExtensionsClientInputs;
useAutoRegister?: boolean;
returnWebAuthnResponse?: boolean;
} | undefined, fetchOpts?: import("better-auth").ClientFetchOption | undefined) => Promise<{
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
} | {
data: import("@better-auth/passkey/client").Passkey;
error: null;
} | {
webauthn: {
response: RegistrationResponseJSON;
clientExtensionResults: AuthenticationExtensionsClientOutputs;
};
data: import("@better-auth/passkey/client").Passkey;
error: null;
} | {
data: null;
error: {
code: string;
message: string;
status: number;
statusText: string;
};
}>;
};
$Infer: {
Passkey: import("@better-auth/passkey/client").Passkey;
};
};
getAtoms($fetch: BetterFetch): {
listPasskeys: import("better-auth/client").AuthQueryAtom<import("@better-auth/passkey/client").Passkey[]>;
$listPasskeys: PreinitializedWritableAtom<any> & object;
};
pathMethods: {
"/passkey/register": "POST";
"/passkey/authenticate": "POST";
};
atomListeners: ({
matcher(path: string): path is "/passkey/delete-passkey" | "/passkey/update-passkey" | "/passkey/verify-registration" | "/sign-out";
signal: "$listPasskeys";
} | {
matcher: (path: string) => path is "/passkey/verify-authentication";
signal: "$sessionSignal";
})[];
$ERROR_CODES: {
CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
PREVIOUSLY_REGISTERED: import("better-auth").RawError<"PREVIOUSLY_REGISTERED">;
REGISTRATION_CANCELLED: import("better-auth").RawError<"REGISTRATION_CANCELLED">;
AUTH_CANCELLED: import("better-auth").RawError<"AUTH_CANCELLED">;
UNKNOWN_ERROR: import("better-auth").RawError<"UNKNOWN_ERROR">;
SESSION_REQUIRED: import("better-auth").RawError<"SESSION_REQUIRED">;
RESOLVE_USER_REQUIRED: import("better-auth").RawError<"RESOLVE_USER_REQUIRED">;
RESOLVED_USER_INVALID: import("better-auth").RawError<"RESOLVED_USER_INVALID">;
};
} | {
id: "additional-fields-client";
version: string;
$InferServerPlugin: {
id: "additional-fields-client";
version: string;
schema: {
user: {
fields: {
locale: {
type: "string";
required: false;
input: true;
};
};
};
session: {
fields: {};
};
};
};
} | {
id: "admin-client";
version: string;
$InferServerPlugin: {
id: "admin";
version: string;
init(): {
options: {
databaseHooks: {
user: {
create: {
before(user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & Record<string, unknown>): Promise<{
data: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
role: string;
};
}>;
};
};
session: {
create: {
before(session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
} & Record<string, unknown>, ctx: import("better-auth").GenericEndpointContext | null): Promise<void>;
};
};
};
};
};
hooks: {
after: {
matcher(context: import("better-auth").HookEndpointContext): boolean;
handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<import("better-auth/plugins").SessionWithImpersonatedBy[] | undefined>;
}[];
};
endpoints: {
setRole: import("better-auth").StrictEndpoint<"/admin/set-role", {
method: "POST";
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
role: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>;
}, import("zod/v4/core").$strip>;
requireHeaders: true;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
};
};
};
};
};
};
};
$Infer: {
body: {
userId: string;
role: "admin" | "user" | ("admin" | "user")[];
};
};
};
}, {
user: import("better-auth/plugins").UserWithRole;
}>;
getUser: import("better-auth").StrictEndpoint<"/admin/get-user", {
method: "GET";
query: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
};
};
};
};
};
};
};
};
}, import("better-auth/plugins").UserWithRole>;
createUser: import("better-auth").StrictEndpoint<"/admin/create-user", {
method: "POST";
body: import("zod").ZodObject<{
email: import("zod").ZodString;
password: import("zod").ZodOptional<import("zod").ZodString>;
name: import("zod").ZodString;
role: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
data: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
};
};
};
};
};
};
};
$Infer: {
body: {
email: string;
password?: string | undefined;
name: string;
role?: "admin" | "user" | ("admin" | "user")[] | undefined;
data?: Record<string, any> | undefined;
};
};
};
}, {
user: import("better-auth/plugins").UserWithRole;
}>;
adminUpdateUser: import("better-auth").StrictEndpoint<"/admin/update-user", {
method: "POST";
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
data: import("zod").ZodRecord<import("zod").ZodAny, import("zod").ZodAny>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
};
};
};
};
};
};
};
};
}, import("better-auth/plugins").UserWithRole>;
listUsers: import("better-auth").StrictEndpoint<"/admin/list-users", {
method: "GET";
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
query: import("zod").ZodObject<{
searchValue: import("zod").ZodOptional<import("zod").ZodString>;
searchField: import("zod").ZodOptional<import("zod").ZodEnum<{
email: "email";
name: "name";
}>>;
searchOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
contains: "contains";
starts_with: "starts_with";
ends_with: "ends_with";
}>>;
limit: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
offset: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
sortBy: import("zod").ZodOptional<import("zod").ZodString>;
sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
asc: "asc";
desc: "desc";
}>>;
filterField: import("zod").ZodOptional<import("zod").ZodString>;
filterValue: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, import("zod").ZodBoolean]>, import("zod").ZodArray<import("zod").ZodString>]>, import("zod").ZodArray<import("zod").ZodNumber>]>>;
filterOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
eq: "eq";
ne: "ne";
gt: "gt";
gte: "gte";
lt: "lt";
lte: "lte";
in: "in";
not_in: "not_in";
contains: "contains";
starts_with: "starts_with";
ends_with: "ends_with";
}>>;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
users: {
type: string;
items: {
$ref: string;
};
};
total: {
type: string;
};
limit: {
type: string;
};
offset: {
type: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
users: import("better-auth/plugins").UserWithRole[];
total: number;
}>;
listUserSessions: import("better-auth").StrictEndpoint<"/admin/list-user-sessions", {
method: "POST";
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
sessions: {
type: string;
items: {
$ref: string;
};
};
};
};
};
};
};
};
};
};
}, {
sessions: import("better-auth/plugins").SessionWithImpersonatedBy[];
}>;
unbanUser: import("better-auth").StrictEndpoint<"/admin/unban-user", {
method: "POST";
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
};
};
};
};
};
};
};
};
}, {
user: import("better-auth/plugins").UserWithRole;
}>;
banUser: import("better-auth").StrictEndpoint<"/admin/ban-user", {
method: "POST";
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
banReason: import("zod").ZodOptional<import("zod").ZodString>;
banExpiresIn: import("zod").ZodOptional<import("zod").ZodNumber>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
};
};
};
};
};
};
};
};
}, {
user: import("better-auth/plugins").UserWithRole;
}>;
impersonateUser: import("better-auth").StrictEndpoint<"/admin/impersonate-user", {
method: "POST";
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
session: {
$ref: string;
};
user: {
$ref: string;
};
};
};
};
};
};
};
};
};
}, {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: import("better-auth/plugins").UserWithRole;
}>;
stopImpersonating: import("better-auth").StrictEndpoint<"/admin/stop-impersonating", {
method: "POST";
requireHeaders: true;
}, {
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
} & Record<string, any>;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & Record<string, any>;
}>;
revokeUserSession: import("better-auth").StrictEndpoint<"/admin/revoke-user-session", {
method: "POST";
body: import("zod").ZodObject<{
sessionToken: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
revokeUserSessions: import("better-auth").StrictEndpoint<"/admin/revoke-user-sessions", {
method: "POST";
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
removeUser: import("better-auth").StrictEndpoint<"/admin/remove-user", {
method: "POST";
body: import("zod").ZodObject<{
userId: import("zod").ZodCoercedString<unknown>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
setUserPassword: import("better-auth").StrictEndpoint<"/admin/set-user-password", {
method: "POST";
body: import("zod").ZodObject<{
newPassword: import("zod").ZodString;
userId: import("zod").ZodCoercedString<unknown>;
}, import("zod/v4/core").$strip>;
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
session: {
user: import("better-auth/plugins").UserWithRole;
session: {
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
};
}>)[];
metadata: {
openapi: {
operationId: string;
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
userHasPermission: import("better-auth").StrictEndpoint<"/admin/has-permission", {
method: "POST";
body: import("zod").ZodIntersection<import("zod").ZodObject<{
userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
role: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>, import("zod").ZodXor<readonly [import("zod").ZodObject<{
permission: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
permissions: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
}, import("zod/v4/core").$strip>]>>;
metadata: {
openapi: {
description: string;
requestBody: {
content: {
"application/json": {
schema: {
type: "object";
properties: {
permissions: {
type: string;
description: string;
};
};
required: string[];
};
};
};
};
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
error: {
type: string;
};
success: {
type: string;
};
};
required: string[];
};
};
};
};
};
};
$Infer: {
body: {
permissions: {
readonly user?: ("ban" | "create" | "delete" | "get" | "impersonate" | "impersonate-admins" | "list" | "set-email" | "set-password" | "set-role" | "update")[] | undefined;
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
};
} & {
userId?: string | undefined;
role?: "admin" | "user" | undefined;
};
};
};
}, {
error: null;
success: boolean;
}>;
};
$ERROR_CODES: {
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: import("better-auth").RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;
USER_ALREADY_EXISTS: import("better-auth").RawError<"USER_ALREADY_EXISTS">;
YOU_CANNOT_BAN_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_BAN_YOURSELF">;
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">;
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">;
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">;
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">;
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">;
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">;
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">;
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">;
BANNED_USER: import("better-auth").RawError<"BANNED_USER">;
YOU_ARE_NOT_ALLOWED_TO_GET_USER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">;
NO_DATA_TO_UPDATE: import("better-auth").RawError<"NO_DATA_TO_UPDATE">;
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">;
YOU_CANNOT_REMOVE_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_REMOVE_YOURSELF">;
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">;
YOU_CANNOT_IMPERSONATE_ADMINS: import("better-auth").RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">;
INVALID_ROLE_TYPE: import("better-auth").RawError<"INVALID_ROLE_TYPE">;
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">;
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: import("better-auth").RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">;
};
schema: {
user: {
fields: {
role: {
type: "string";
required: false;
input: false;
};
banned: {
type: "boolean";
defaultValue: false;
required: false;
input: false;
};
banReason: {
type: "string";
required: false;
input: false;
};
banExpires: {
type: "date";
required: false;
input: false;
};
};
};
session: {
fields: {
impersonatedBy: {
type: "string";
required: false;
input: false;
};
};
};
};
options: NoInfer<{
ac: import("better-auth/plugins").AccessControl<{
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
readonly session: readonly ["list", "revoke", "delete"];
}>;
roles: {
admin: import("better-auth/plugins").Role;
user: import("better-auth/plugins").Role;
};
}>;
};
getActions: () => {
admin: {
checkRolePermission: <R extends import("better-auth/client/plugins").AdminClientOptions extends {
roles: any;
} ? string | number | symbol : "admin" | "user">(data: {
permissions: {
readonly user?: ("ban" | "create" | "delete" | "get" | "impersonate" | "impersonate-admins" | "list" | "set-email" | "set-password" | "set-role" | "update")[] | undefined;
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
};
} & {
role: R;
}) => boolean;
};
};
pathMethods: {
"/admin/list-users": "GET";
"/admin/impersonate-user": "POST";
"/admin/stop-impersonating": "POST";
};
atomListeners: {
matcher: (path: string) => path is "/admin/impersonate-user" | "/admin/stop-impersonating";
signal: "$sessionSignal";
}[];
$ERROR_CODES: {
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: import("better-auth").RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;
USER_ALREADY_EXISTS: import("better-auth").RawError<"USER_ALREADY_EXISTS">;
YOU_CANNOT_BAN_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_BAN_YOURSELF">;
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">;
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">;
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">;
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">;
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">;
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">;
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">;
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">;
BANNED_USER: import("better-auth").RawError<"BANNED_USER">;
YOU_ARE_NOT_ALLOWED_TO_GET_USER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">;
NO_DATA_TO_UPDATE: import("better-auth").RawError<"NO_DATA_TO_UPDATE">;
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">;
YOU_CANNOT_REMOVE_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_REMOVE_YOURSELF">;
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">;
YOU_CANNOT_IMPERSONATE_ADMINS: import("better-auth").RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">;
INVALID_ROLE_TYPE: import("better-auth").RawError<"INVALID_ROLE_TYPE">;
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">;
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: import("better-auth").RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">;
};
} | {
id: "anonymous";
version: string;
$InferServerPlugin: ReturnType<(options?: import("better-auth/plugins").AnonymousOptions | undefined) => {
id: "anonymous";
version: string;
endpoints: {
signInAnonymous: import("better-auth").StrictEndpoint<"/sign-in/anonymous", {
method: "POST";
metadata: {
openapi: {
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
session: {
$ref: string;
};
};
};
};
};
};
};
};
};
}, {
token: string;
user: Record<string, any> & {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
};
}>;
deleteAnonymousUser: import("better-auth").StrictEndpoint<"/delete-anonymous-user", {
method: "POST";
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").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: {
success: {
type: string;
};
};
};
};
};
};
"400": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
message: {
type: string;
};
};
};
required: string[];
};
};
};
"500": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
message: {
type: string;
};
};
required: string[];
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
};
hooks: {
after: {
matcher(ctx: import("better-auth").HookEndpointContext): boolean;
handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
}[];
};
options: import("better-auth/plugins").AnonymousOptions | undefined;
schema: {
user: {
fields: {
isAnonymous: {
type: "boolean";
required: false;
input: false;
defaultValue: false;
};
};
};
};
$ERROR_CODES: {
FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;
INVALID_EMAIL_FORMAT: import("better-auth").RawError<"INVALID_EMAIL_FORMAT">;
COULD_NOT_CREATE_SESSION: import("better-auth").RawError<"COULD_NOT_CREATE_SESSION">;
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY: import("better-auth").RawError<"ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY">;
FAILED_TO_DELETE_ANONYMOUS_USER: import("better-auth").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER">;
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS: import("better-auth").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS">;
USER_IS_NOT_ANONYMOUS: import("better-auth").RawError<"USER_IS_NOT_ANONYMOUS">;
DELETE_ANONYMOUS_USER_DISABLED: import("better-auth").RawError<"DELETE_ANONYMOUS_USER_DISABLED">;
};
}>;
pathMethods: {
"/sign-in/anonymous": "POST";
"/delete-anonymous-user": "POST";
};
atomListeners: {
matcher: (path: string) => path is "/sign-in/anonymous";
signal: "$sessionSignal";
}[];
$ERROR_CODES: {
FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;
INVALID_EMAIL_FORMAT: import("better-auth").RawError<"INVALID_EMAIL_FORMAT">;
COULD_NOT_CREATE_SESSION: import("better-auth").RawError<"COULD_NOT_CREATE_SESSION">;
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY: import("better-auth").RawError<"ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY">;
FAILED_TO_DELETE_ANONYMOUS_USER: import("better-auth").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER">;
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS: import("better-auth").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS">;
USER_IS_NOT_ANONYMOUS: import("better-auth").RawError<"USER_IS_NOT_ANONYMOUS">;
DELETE_ANONYMOUS_USER_DISABLED: import("better-auth").RawError<"DELETE_ANONYMOUS_USER_DISABLED">;
};
} | {
id: "device-authorization";
version: string;
$InferServerPlugin: ReturnType<(options?: Partial<import("better-auth/plugins").DeviceAuthorizationOptions>) => {
id: "device-authorization";
version: string;
schema: {
deviceCode: {
fields: {
deviceCode: {
type: "string";
required: true;
};
userCode: {
type: "string";
required: true;
};
userId: {
type: "string";
required: false;
};
expiresAt: {
type: "date";
required: true;
};
status: {
type: "string";
required: true;
};
lastPolledAt: {
type: "date";
required: false;
};
pollingInterval: {
type: "number";
required: false;
};
clientId: {
type: "string";
required: false;
};
scope: {
type: "string";
required: false;
};
};
};
};
endpoints: {
deviceCode: import("better-auth").StrictEndpoint<"/device/code", {
method: "POST";
body: import("zod").ZodObject<{
client_id: import("zod").ZodString;
user_id: import("zod").ZodOptional<import("zod").ZodString>;
scope: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
error: import("zod").ZodObject<{
error: import("zod").ZodEnum<{
invalid_request: "invalid_request";
invalid_client: "invalid_client";
}>;
error_description: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
device_code: {
type: string;
description: string;
};
user_code: {
type: string;
description: string;
};
verification_uri: {
type: string;
format: string;
description: string;
};
verification_uri_complete: {
type: string;
format: string;
description: string;
};
expires_in: {
type: string;
description: string;
};
interval: {
type: string;
description: string;
};
};
};
};
};
};
400: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
error: {
type: string;
enum: string[];
};
error_description: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
device_code: string;
user_code: string;
verification_uri: string;
verification_uri_complete: string;
expires_in: number;
interval: number;
}>;
deviceToken: import("better-auth").StrictEndpoint<"/device/token", {
method: "POST";
body: import("zod").ZodObject<{
grant_type: import("zod").ZodLiteral<"urn:ietf:params:oauth:grant-type:device_code">;
device_code: import("zod").ZodString;
client_id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
error: import("zod").ZodObject<{
error: import("zod").ZodEnum<{
invalid_request: "invalid_request";
authorization_pending: "authorization_pending";
slow_down: "slow_down";
expired_token: "expired_token";
access_denied: "access_denied";
invalid_grant: "invalid_grant";
}>;
error_description: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
session: {
$ref: string;
};
user: {
$ref: string;
};
};
};
};
};
};
400: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
error: {
type: string;
enum: string[];
};
error_description: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
access_token: string;
token_type: string;
expires_in: number;
scope: string;
}>;
deviceVerify: import("better-auth").StrictEndpoint<"/device", {
method: "GET";
query: import("zod").ZodObject<{
user_code: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
error: import("zod").ZodObject<{
error: import("zod").ZodEnum<{
invalid_request: "invalid_request";
}>;
error_description: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user_code: {
type: string;
description: string;
};
status: {
type: string;
enum: string[];
description: string;
};
};
};
};
};
};
};
};
};
}, {
user_code: string;
status: string;
}>;
deviceApprove: import("better-auth").StrictEndpoint<"/device/approve", {
method: "POST";
body: import("zod").ZodObject<{
userCode: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
error: import("zod").ZodObject<{
error: import("zod").ZodEnum<{
invalid_request: "invalid_request";
expired_token: "expired_token";
access_denied: "access_denied";
device_code_already_processed: "device_code_already_processed";
unauthorized: "unauthorized";
}>;
error_description: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
requireHeaders: true;
metadata: {
openapi: {
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
deviceDeny: import("better-auth").StrictEndpoint<"/device/deny", {
method: "POST";
body: import("zod").ZodObject<{
userCode: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
error: import("zod").ZodObject<{
error: import("zod").ZodEnum<{
invalid_request: "invalid_request";
expired_token: "expired_token";
access_denied: "access_denied";
unauthorized: "unauthorized";
}>;
error_description: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
requireHeaders: true;
metadata: {
openapi: {
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
success: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
success: boolean;
}>;
};
$ERROR_CODES: {
USER_NOT_FOUND: import("better-auth").RawError<"USER_NOT_FOUND">;
FAILED_TO_CREATE_SESSION: import("better-auth").RawError<"FAILED_TO_CREATE_SESSION">;
INVALID_DEVICE_CODE: import("better-auth").RawError<"INVALID_DEVICE_CODE">;
EXPIRED_DEVICE_CODE: import("better-auth").RawError<"EXPIRED_DEVICE_CODE">;
EXPIRED_USER_CODE: import("better-auth").RawError<"EXPIRED_USER_CODE">;
AUTHORIZATION_PENDING: import("better-auth").RawError<"AUTHORIZATION_PENDING">;
ACCESS_DENIED: import("better-auth").RawError<"ACCESS_DENIED">;
INVALID_USER_CODE: import("better-auth").RawError<"INVALID_USER_CODE">;
DEVICE_CODE_ALREADY_PROCESSED: import("better-auth").RawError<"DEVICE_CODE_ALREADY_PROCESSED">;
DEVICE_CODE_NOT_CLAIMED: import("better-auth").RawError<"DEVICE_CODE_NOT_CLAIMED">;
POLLING_TOO_FREQUENTLY: import("better-auth").RawError<"POLLING_TOO_FREQUENTLY">;
INVALID_DEVICE_CODE_STATUS: import("better-auth").RawError<"INVALID_DEVICE_CODE_STATUS">;
AUTHENTICATION_REQUIRED: import("better-auth").RawError<"AUTHENTICATION_REQUIRED">;
};
options: Partial<{
expiresIn: import("better-auth/plugins").TimeString;
interval: import("better-auth/plugins").TimeString;
deviceCodeLength: number;
userCodeLength: number;
generateDeviceCode?: (() => string | Promise<string>) | undefined;
generateUserCode?: (() => string | Promise<string>) | undefined;
validateClient?: ((clientId: string) => boolean | Promise<boolean>) | undefined;
onDeviceAuthRequest?: ((clientId: string, scope: string | undefined) => void | Promise<void>) | undefined;
verificationUri?: string | undefined;
schema?: {
deviceCode?: {
modelName?: string | undefined;
fields?: {
deviceCode?: string | undefined;
userCode?: string | undefined;
userId?: string | undefined;
expiresAt?: string | undefined;
status?: string | undefined;
lastPolledAt?: string | undefined;
pollingInterval?: string | undefined;
clientId?: string | undefined;
scope?: string | undefined;
} | undefined;
} | undefined;
} | undefined;
}>;
}>;
pathMethods: {
"/device/code": "POST";
"/device/token": "POST";
"/device": "GET";
"/device/approve": "POST";
"/device/deny": "POST";
};
} | {
id: "organization";
version: string;
$InferServerPlugin: import("better-auth/plugins").OrganizationPlugin<{
ac: import("better-auth/plugins").AccessControl<{
readonly organization: readonly ["update", "delete"];
readonly member: readonly ["create", "update", "delete"];
readonly invitation: readonly ["create", "cancel"];
readonly team: readonly ["create", "update", "delete"];
readonly ac: readonly ["create", "read", "update", "delete"];
}>;
roles: {
admin: import("better-auth/plugins").Role;
member: import("better-auth/plugins").Role;
owner: import("better-auth/plugins").Role;
};
teams: {
enabled: true;
};
schema: unknown;
dynamicAccessControl: {
enabled: false;
};
}>;
getActions: ($fetch: BetterFetch, _$store: import("better-auth").ClientStore, co: import("better-auth").BetterAuthClientOptions | undefined) => {
$Infer: {
ActiveOrganization: {
members: {
id: string;
organizationId: string;
role: "admin" | "member" | "owner";
createdAt: Date;
userId: string;
teamId?: string | undefined;
user: {
id: string;
email: string;
name: string;
image?: string | undefined;
};
}[];
invitations: {
id: string;
organizationId: string;
email: string;
role: "admin" | "member" | "owner";
status: import("better-auth/plugins").InvitationStatus;
inviterId: string;
expiresAt: Date;
createdAt: Date;
teamId?: string | undefined;
}[];
teams: {
id: string;
name: string;
organizationId: string;
createdAt: Date;
updatedAt?: Date | undefined;
}[];
} & {
id: string;
name: string;
slug: string;
createdAt: Date;
logo?: string | null | undefined;
metadata?: any;
};
Organization: {
id: string;
name: string;
slug: string;
logo?: string | null | undefined;
metadata?: any;
createdAt: Date;
};
Invitation: {
id: string;
organizationId: string;
email: string;
role: "admin" | "member" | "owner";
status: import("better-auth/plugins").InvitationStatus;
inviterId: string;
expiresAt: Date;
createdAt: Date;
teamId?: string | undefined;
};
Member: {
id: string;
organizationId: string;
role: "admin" | "member" | "owner";
createdAt: Date;
userId: string;
teamId?: string | undefined;
user: {
id: string;
email: string;
name: string;
image?: string | undefined;
};
};
Team: {
id: string;
name: string;
organizationId: string;
createdAt: Date;
updatedAt?: Date | undefined;
};
};
organization: {
checkRolePermission: <R extends {
teams: {
enabled: true;
};
} extends {
roles: any;
} ? string | number | symbol : "admin" | "member" | "owner">(data: {
permissions: {
readonly organization?: ("delete" | "update")[] | undefined;
readonly member?: ("create" | "delete" | "update")[] | undefined;
readonly invitation?: ("cancel" | "create")[] | undefined;
readonly team?: ("create" | "delete" | "update")[] | undefined;
readonly ac?: ("create" | "delete" | "read" | "update")[] | undefined;
};
} & {
role: R;
}) => boolean;
};
};
getAtoms: ($fetch: BetterFetch) => {
$listOrg: PreinitializedWritableAtom<boolean> & object;
$activeOrgSignal: PreinitializedWritableAtom<boolean> & object;
$activeMemberSignal: PreinitializedWritableAtom<boolean> & object;
$activeMemberRoleSignal: PreinitializedWritableAtom<boolean> & object;
activeOrganization: import("better-auth/client").AuthQueryAtom<import("better-auth").Prettify<{
id: string;
name: string;
slug: string;
createdAt: Date;
logo?: string | null | undefined;
metadata?: any;
} & {
members: {
id: string;
organizationId: string;
role: "admin" | "member" | "owner";
createdAt: Date;
userId: string;
teamId?: string | undefined;
user: {
id: string;
email: string;
name: string;
image?: string | undefined;
};
}[];
invitations: {
id: string;
organizationId: string;
email: string;
role: "admin" | "member" | "owner";
status: import("better-auth/plugins").InvitationStatus;
inviterId: string;
expiresAt: Date;
createdAt: Date;
teamId?: string | undefined;
}[];
}>>;
listOrganizations: import("better-auth/client").AuthQueryAtom<{
id: string;
name: string;
slug: string;
createdAt: Date;
logo?: string | null | undefined;
metadata?: any;
}[]>;
activeMember: import("better-auth/client").AuthQueryAtom<{
id: string;
organizationId: string;
userId: string;
role: string;
createdAt: Date;
}>;
activeMemberRole: import("better-auth/client").AuthQueryAtom<{
role: string;
}>;
};
pathMethods: {
"/organization/get-full-organization": "GET";
"/organization/list-user-teams": "GET";
};
atomListeners: ({
matcher(path: string): path is "/organization/create" | "/organization/update" | "/organization/delete";
signal: "$listOrg";
} | {
matcher(path: string): boolean;
signal: "$activeOrgSignal";
} | {
matcher(path: string): boolean;
signal: "$sessionSignal";
} | {
matcher(path: string): boolean;
signal: "$activeMemberSignal";
} | {
matcher(path: string): boolean;
signal: "$activeMemberRoleSignal";
})[];
$ERROR_CODES: {
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION">;
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: import("better-auth").RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS">;
ORGANIZATION_ALREADY_EXISTS: import("better-auth").RawError<"ORGANIZATION_ALREADY_EXISTS">;
ORGANIZATION_SLUG_ALREADY_TAKEN: import("better-auth").RawError<"ORGANIZATION_SLUG_ALREADY_TAKEN">;
ORGANIZATION_NOT_FOUND: import("better-auth").RawError<"ORGANIZATION_NOT_FOUND">;
USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION: import("better-auth").RawError<"USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION">;
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION">;
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION">;
NO_ACTIVE_ORGANIZATION: import("better-auth").RawError<"NO_ACTIVE_ORGANIZATION">;
USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION: import("better-auth").RawError<"USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION">;
MEMBER_NOT_FOUND: import("better-auth").RawError<"MEMBER_NOT_FOUND">;
ROLE_NOT_FOUND: import("better-auth").RawError<"ROLE_NOT_FOUND">;
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM">;
TEAM_ALREADY_EXISTS: import("better-auth").RawError<"TEAM_ALREADY_EXISTS">;
TEAM_NOT_FOUND: import("better-auth").RawError<"TEAM_NOT_FOUND">;
YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER: import("better-auth").RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER">;
YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER: import("better-auth").RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER">;
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER">;
YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION">;
USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION: import("better-auth").RawError<"USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION">;
INVITATION_NOT_FOUND: import("better-auth").RawError<"INVITATION_NOT_FOUND">;
YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: import("better-auth").RawError<"YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION">;
EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: import("better-auth").RawError<"EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION">;
EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION: import("better-auth").RawError<"EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION">;
YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION">;
INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: import("better-auth").RawError<"INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION">;
YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE">;
FAILED_TO_RETRIEVE_INVITATION: import("better-auth").RawError<"FAILED_TO_RETRIEVE_INVITATION">;
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS: import("better-auth").RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS">;
UNABLE_TO_REMOVE_LAST_TEAM: import("better-auth").RawError<"UNABLE_TO_REMOVE_LAST_TEAM">;
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER">;
ORGANIZATION_MEMBERSHIP_LIMIT_REACHED: import("better-auth").RawError<"ORGANIZATION_MEMBERSHIP_LIMIT_REACHED">;
YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION">;
YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION">;
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM">;
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM">;
INVITATION_LIMIT_REACHED: import("better-auth").RawError<"INVITATION_LIMIT_REACHED">;
TEAM_MEMBER_LIMIT_REACHED: import("better-auth").RawError<"TEAM_MEMBER_LIMIT_REACHED">;
USER_IS_NOT_A_MEMBER_OF_THE_TEAM: import("better-auth").RawError<"USER_IS_NOT_A_MEMBER_OF_THE_TEAM">;
YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM: import("better-auth").RawError<"YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM">;
YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: import("better-auth").RawError<"YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM">;
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER">;
YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER">;
YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION">;
YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION">;
MISSING_AC_INSTANCE: import("better-auth").RawError<"MISSING_AC_INSTANCE">;
YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE: import("better-auth").RawError<"YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE">;
YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE">;
TOO_MANY_ROLES: import("better-auth").RawError<"TOO_MANY_ROLES">;
INVALID_RESOURCE: import("better-auth").RawError<"INVALID_RESOURCE">;
ROLE_NAME_IS_ALREADY_TAKEN: import("better-auth").RawError<"ROLE_NAME_IS_ALREADY_TAKEN">;
CANNOT_DELETE_A_PRE_DEFINED_ROLE: import("better-auth").RawError<"CANNOT_DELETE_A_PRE_DEFINED_ROLE">;
ROLE_IS_ASSIGNED_TO_MEMBERS: import("better-auth").RawError<"ROLE_IS_ASSIGNED_TO_MEMBERS">;
INVALID_TEAM_ID: import("better-auth").RawError<"INVALID_TEAM_ID">;
};
} | {
id: "phoneNumber";
version: string;
$InferServerPlugin: ReturnType<(options?: import("better-auth/plugins").PhoneNumberOptions | undefined) => {
id: "phone-number";
version: string;
init(): {
options: {
databaseHooks: {
user: {
update: {
before(data: Partial<{
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
}> & Record<string, unknown>): Promise<{
data: {
[x: string]: unknown;
id?: string | undefined;
createdAt?: Date | undefined;
updatedAt?: Date | undefined;
email?: string | undefined;
emailVerified?: boolean | undefined;
name?: string | undefined;
image?: string | null | undefined;
};
} | undefined>;
};
};
};
};
};
hooks: {
before: {
matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<never>;
}[];
};
endpoints: {
signInPhoneNumber: import("better-auth").StrictEndpoint<"/sign-in/phone-number", {
method: "POST";
body: import("zod").ZodObject<{
phoneNumber: import("zod").ZodString;
password: import("zod").ZodString;
rememberMe: import("zod").ZodOptional<import("zod").ZodBoolean>;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
user: {
$ref: string;
};
session: {
$ref: string;
};
};
};
};
};
};
400: {
description: string;
};
};
};
};
}, {
token: string;
user: import("better-auth/plugins").UserWithPhoneNumber;
}>;
sendPhoneNumberOTP: import("better-auth").StrictEndpoint<"/phone-number/send-otp", {
method: "POST";
body: import("zod").ZodObject<{
phoneNumber: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
summary: string;
description: string;
responses: {
200: {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
message: {
type: string;
};
};
};
};
};
};
};
};
};
}, {
message: string;
}>;
verifyPhoneNumber: import("better-auth").StrictEndpoint<"/phone-number/verify", {
method: "POST";
body: import("zod").ZodIntersection<import("zod").ZodObject<{
phoneNumber: import("zod").ZodString;
code: import("zod").ZodString;
disableSession: import("zod").ZodOptional<import("zod").ZodBoolean>;
updatePhoneNumber: import("zod").ZodOptional<import("zod").ZodBoolean>;
}, import("zod/v4/core").$strip>, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: {
openapi: {
summary: string;
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
enum: boolean[];
};
token: {
type: string;
nullable: boolean;
description: string;
};
user: {
type: string;
nullable: boolean;
properties: {
id: {
type: string;
description: string;
};
email: {
type: string;
format: string;
nullable: boolean;
description: string;
};
emailVerified: {
type: string;
nullable: boolean;
description: string;
};
name: {
type: string;
nullable: boolean;
description: string;
};
image: {
type: string;
format: string;
nullable: boolean;
description: string;
};
phoneNumber: {
type: string;
description: string;
};
phoneNumberVerified: {
type: string;
description: string;
};
createdAt: {
type: string;
format: string;
description: string;
};
updatedAt: {
type: string;
format: string;
description: string;
};
};
required: string[];
description: string;
};
};
required: string[];
};
};
};
};
400: {
description: string;
};
};
};
};
}, {
status: boolean;
token: string;
user: {
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & import("better-auth/plugins").UserWithPhoneNumber;
} | {
status: boolean;
token: null;
user: import("better-auth/plugins").UserWithPhoneNumber;
}>;
requestPasswordResetPhoneNumber: import("better-auth").StrictEndpoint<"/phone-number/request-password-reset", {
method: "POST";
body: import("zod").ZodObject<{
phoneNumber: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
enum: boolean[];
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
resetPasswordPhoneNumber: import("better-auth").StrictEndpoint<"/phone-number/reset-password", {
method: "POST";
body: import("zod").ZodObject<{
otp: import("zod").ZodString;
phoneNumber: import("zod").ZodString;
newPassword: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
metadata: {
openapi: {
description: string;
responses: {
"200": {
description: string;
content: {
"application/json": {
schema: {
type: "object";
properties: {
status: {
type: string;
description: string;
enum: boolean[];
};
};
required: string[];
};
};
};
};
};
};
};
}, {
status: boolean;
}>;
};
schema: {
user: {
fields: {
phoneNumber: {
type: "string";
required: false;
unique: true;
sortable: true;
returned: true;
};
phoneNumberVerified: {
type: "boolean";
required: false;
returned: true;
input: false;
};
};
};
};
rateLimit: {
pathMatcher(path: string): boolean;
window: number;
max: number;
}[];
options: import("better-auth/plugins").PhoneNumberOptions | undefined;
$ERROR_CODES: {
OTP_EXPIRED: import("better-auth").RawError<"OTP_EXPIRED">;
INVALID_OTP: import("better-auth").RawError<"INVALID_OTP">;
TOO_MANY_ATTEMPTS: import("better-auth").RawError<"TOO_MANY_ATTEMPTS">;
INVALID_PHONE_NUMBER: import("better-auth").RawError<"INVALID_PHONE_NUMBER">;
PHONE_NUMBER_EXIST: import("better-auth").RawError<"PHONE_NUMBER_EXIST">;
PHONE_NUMBER_NOT_EXIST: import("better-auth").RawError<"PHONE_NUMBER_NOT_EXIST">;
INVALID_PHONE_NUMBER_OR_PASSWORD: import("better-auth").RawError<"INVALID_PHONE_NUMBER_OR_PASSWORD">;
UNEXPECTED_ERROR: import("better-auth").RawError<"UNEXPECTED_ERROR">;
OTP_NOT_FOUND: import("better-auth").RawError<"OTP_NOT_FOUND">;
PHONE_NUMBER_NOT_VERIFIED: import("better-auth").RawError<"PHONE_NUMBER_NOT_VERIFIED">;
PHONE_NUMBER_CANNOT_BE_UPDATED: import("better-auth").RawError<"PHONE_NUMBER_CANNOT_BE_UPDATED">;
SEND_OTP_NOT_IMPLEMENTED: import("better-auth").RawError<"SEND_OTP_NOT_IMPLEMENTED">;
};
}>;
atomListeners: {
matcher(path: string): path is "/phone-number/verify" | "/sign-in/phone-number" | "/phone-number/update";
signal: "$sessionSignal";
}[];
$ERROR_CODES: {
OTP_EXPIRED: import("better-auth").RawError<"OTP_EXPIRED">;
INVALID_OTP: import("better-auth").RawError<"INVALID_OTP">;
TOO_MANY_ATTEMPTS: import("better-auth").RawError<"TOO_MANY_ATTEMPTS">;
INVALID_PHONE_NUMBER: import("better-auth").RawError<"INVALID_PHONE_NUMBER">;
PHONE_NUMBER_EXIST: import("better-auth").RawError<"PHONE_NUMBER_EXIST">;
PHONE_NUMBER_NOT_EXIST: import("better-auth").RawError<"PHONE_NUMBER_NOT_EXIST">;
INVALID_PHONE_NUMBER_OR_PASSWORD: import("better-auth").RawError<"INVALID_PHONE_NUMBER_OR_PASSWORD">;
UNEXPECTED_ERROR: import("better-auth").RawError<"UNEXPECTED_ERROR">;
OTP_NOT_FOUND: import("better-auth").RawError<"OTP_NOT_FOUND">;
PHONE_NUMBER_NOT_VERIFIED: import("better-auth").RawError<"PHONE_NUMBER_NOT_VERIFIED">;
PHONE_NUMBER_CANNOT_BE_UPDATED: import("better-auth").RawError<"PHONE_NUMBER_CANNOT_BE_UPDATED">;
SEND_OTP_NOT_IMPLEMENTED: import("better-auth").RawError<"SEND_OTP_NOT_IMPLEMENTED">;
};
} | {
id: "siwn";
$InferServerPlugin: {};
getAtoms: (_$fetch: BetterFetch) => import("better-near-auth/client").NearClientAtoms;
getActions: ($fetch: BetterFetch, $store: import("better-auth").ClientStore, _options: unknown) => import("better-near-auth/client").SIWNClientActions;
})[];
}>;
type AuthClient = ReturnType<typeof createAuthClient>;
type SessionData = AuthClient["$Infer"]["Session"];
/**
* Explicit shapes for the organization/passkey records — better-auth's client
* inference collapses to `any` for these plugin endpoints, which would leak
* `any` into every consumer union.
*/
interface Organization {
id: string;
name: string;
slug?: string | null;
logo?: string | null;
createdAt?: Date | string | null;
metadata?: Record<string, unknown> | null;
}
interface Passkey {
id: string;
name?: string | null;
createdAt?: Date | string | null;
lastUsedAt?: Date | string | null;
}
declare function useAuthClient(): AuthClient;
declare const sessionQueryKey: readonly ["session"];
declare function sessionQueryOptions(authClient: AuthClient): {
queryKey: readonly ["session"];
queryFn: () => Promise<{
user: import("better-auth").StripEmptyObjects<{
id: string;
createdAt: Date;
updatedAt: Date;
email: string;
emailVerified: boolean;
name: string;
image?: string | null | undefined;
} & {} & {
locale?: string | null | undefined;
} & {
banned: boolean | null | undefined;
} & {
banExpires?: Date | null | undefined;
banReason?: string | null | undefined;
role?: string | null | undefined;
} & {
isAnonymous: boolean | null | undefined;
} & {} & {} & {
phoneNumber?: string | null | undefined;
phoneNumberVerified?: boolean | null | undefined;
}>;
session: import("better-auth").StripEmptyObjects<{
id: string;
createdAt: Date;
updatedAt: Date;
userId: string;
expiresAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
} & {} & {} & {} & {
impersonatedBy?: string | null | undefined;
} & {} & {
activeOrganizationId?: string | null | undefined;
activeTeamId?: string | null | undefined;
}>;
} | null>;
staleTime: number;
gcTime: number;
};
declare function refreshSessionCache(authClient: AuthClient, queryClient: QueryClient): Promise<SessionData | null>;
/**
* Resolves the session for the root route: the query cache wins (it is kept
* authoritative by the single sessionQueryOptions read path), and a populated
* router-context session — the host's SSR resolution — seeds an empty cache so
* the dehydrated state carries it to the client.
*/
declare function resolveSessionFromCache<T>(queryClient: QueryClient | undefined, contextSession: T | null | undefined): T | null | undefined;
declare function useRelayHistory(session: SessionData | null | undefined, authClient: AuthClient): import("@tanstack/react-query").UseQueryResult<{
id: string;
userId: string;
txHash: string;
senderId: string;
receiverId: string;
network: string;
status: string;
gasUsed?: string | undefined;
createdAt: string;
updatedAt?: string | undefined;
}[], Error>;
type PasskeyWalletStatus = PasskeyWalletLink;
type PasskeyCeremonyError = Error & {
code?: string;
};
declare function isUnsupportedAuthenticatorError(error: unknown): boolean;
declare function isPasskeyAutofillAvailable(): Promise<boolean>;
declare function createAccountWithPasskey(authClient: AuthClient, options?: {
onSuccess?: (result: {
passkeyWallet?: PasskeyWalletStatus;
}) => void;
onError?: (error: PasskeyCeremonyError) => void;
}): Promise<void>;
declare function signInWithPasskey(authClient: AuthClient, options?: {
autoFill?: boolean;
onSuccess?: () => void;
onError?: (error: PasskeyCeremonyError) => void;
}): Promise<void>;
//#endregion
export { AuthClient, type AuthContext, CreateAuthClientOptions, Organization, Passkey, PasskeyCeremonyError, PasskeyWalletStatus, SessionData, clearAuthenticatedQueries, createAccountWithPasskey, createAuthClient, getDeviceLinkClientId, isPasskeyAutofillAvailable, isUnsupportedAuthenticatorError, pluginHref, pluginPath, pluginSearch, refreshSessionCache, requireAdmin, requireSession, resolveSessionFromCache, sessionQueryKey, sessionQueryOptions, signInWithPasskey, useAuthClient, useRelayHistory };
//# sourceMappingURL=auth.d.cts.map