Kaizen
Browse modulesAuthenticationauth/serverFunctions

Function: createTaprootAuth()

function createTaprootAuth<C extends TaprootAuthConfig>(config: C): C extends TaprootAuthConfig ? Auth<{
  account:   | {
     accountLinking:   | {
        enabled: boolean | undefined;
      }
        | undefined;
   }
     | undefined;
  advanced: {
     database: {
        generateId: false;
     };
  };
  baseURL: string;
  database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
  emailAndPassword:   | {
     enabled: true;
     password: PasswordHashingConfig;
     requireEmailVerification: boolean;
     sendResetPassword:   | ((args: {
        token: string;
        url: string;
        user: {
           email: string;
           id: string;
        };
      }) => Promise<void>)
        | undefined;
   }
     | {
     enabled: false;
     password?: undefined;
     requireEmailVerification?: undefined;
     sendResetPassword?: undefined;
   };
  emailVerification:   | {
     sendVerificationEmail: (args: {
        token: string;
        url: string;
        user: {
           email: string;
           id: string;
        };
     }) => Promise<void>;
   }
     | undefined;
  plugins: [...Organization<C>[], ...Enabled<C, "admin", { $ERROR_CODES: { BANNED_USER: RawError<"BANNED_USER">; FAILED_TO_CREATE_USER: RawError<"FAILED_TO_CREATE_USER">; INVALID_ROLE_TYPE: RawError<"INVALID_ROLE_TYPE">; NO_DATA_TO_UPDATE: RawError<"NO_DATA_TO_UPDATE">; PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">; USER_ALREADY_EXISTS: RawError<"USER_ALREADY_EXISTS">; USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">; YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">; YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">; YOU_ARE_NOT_ALLOWED_TO_GET_USER: RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">; YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">; YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">; YOU_CANNOT_BAN_YOURSELF: RawError<"YOU_CANNOT_BAN_YOURSELF">; YOU_CANNOT_IMPERSONATE_ADMINS: RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">; YOU_CANNOT_REMOVE_YOURSELF: RawError<"YOU_CANNOT_REMOVE_YOURSELF"> }; endpoints: { adminUpdateUser: StrictEndpoint<"/admin/update-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, UserWithRole>; banUser: StrictEndpoint<"/admin/ban-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { user: UserWithRole }>; createUser: StrictEndpoint<"/admin/create-user", { body: ZodObject<(...), (...)>; metadata: { $Infer: ...; openapi: ... }; method: "POST" }, { user: UserWithRole }>; getUser: StrictEndpoint<"/admin/get-user", { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)>; use: (...)[] }, UserWithRole>; impersonateUser: StrictEndpoint<"/admin/impersonate-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { session: { createdAt: ...; expiresAt: ...; id: ...; ipAddress?: ...; token: ...; updatedAt: ...; userAgent?: ...; userId: ... }; user: UserWithRole }>; listUsers: StrictEndpoint<"/admin/list-users", { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)>; use: (...)[] }, { total: number; users: (...)[] }>; listUserSessions: StrictEndpoint<"/admin/list-user-sessions", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { sessions: (...)[] }>; removeUser: StrictEndpoint<"/admin/remove-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; revokeUserSession: StrictEndpoint<"/admin/revoke-user-session", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; revokeUserSessions: StrictEndpoint<"/admin/revoke-user-sessions", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; setRole: StrictEndpoint<"/admin/set-role", { body: ZodObject<(...), (...)>; metadata: { $Infer: ...; openapi: ... }; method: "POST"; requireHeaders: true; use: (...)[] }, { user: UserWithRole }>; setUserPassword: StrictEndpoint<"/admin/set-user-password", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { status: boolean }>; stopImpersonating: StrictEndpoint<"/admin/stop-impersonating", { method: "POST"; requireHeaders: true }, { session: (...) & (...); user: (...) & (...) }>; unbanUser: StrictEndpoint<"/admin/unban-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { user: UserWithRole }>; userHasPermission: StrictEndpoint<"/admin/has-permission", { body: ZodIntersection<(...), (...)>; metadata: { $Infer: ...; openapi: ... }; method: "POST" }, { error: null; success: boolean }> }; hooks: { after: { handler: Middleware<(...), (...)>; matcher: any }[] }; id: "admin"; options: NoInfer<{ adminUserIds: (...)[] | undefined; defaultRole: string | undefined }>; schema: { session: { fields: { impersonatedBy: { input: ...; required: ...; type: ... } } }; user: { fields: { banExpires: { input: ...; required: ...; type: ... }; banned: { defaultValue: ...; input: ...; required: ...; type: ... }; banReason: { input: ...; required: ...; type: ... }; role: { input: ...; required: ...; type: ... } } } }; version: string; init: any }>[], ...Enabled<C, "magicLink", { endpoints: { magicLinkVerify: StrictEndpoint<"/magic-link/verify", { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)>; requireHeaders: true; use: (...)[] }, { session: { createdAt: ...; expiresAt: ...; id: ...; ipAddress?: ...; token: ...; updatedAt: ...; userAgent?: ...; userId: ... }; token: string; user: { createdAt: ...; email: ...; emailVerified: ...; id: ...; image?: ...; name: ...; updatedAt: ... } }>; signInMagicLink: StrictEndpoint<"/sign-in/magic-link", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; requireHeaders: true; use: (...)[] }, { status: boolean }> }; id: "magic-link"; options: MagicLinkOptions; rateLimit: { max: number; window: number; pathMatcher: any }[]; version: string }>[], ...Enabled<C, "emailOtp", { $ERROR_CODES: { INVALID_OTP: RawError<"INVALID_OTP">; OTP_EXPIRED: RawError<"OTP_EXPIRED">; TOO_MANY_ATTEMPTS: RawError<"TOO_MANY_ATTEMPTS"> }; endpoints: { changeEmailEmailOTP: StrictEndpoint<"/email-otp/change-email", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; checkVerificationOTP: StrictEndpoint<"/email-otp/check-verification-otp", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; createVerificationOTP: StrictEndpoint<string, { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, string>; forgetPasswordEmailOTP: StrictEndpoint<"/forget-password/email-otp", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; getVerificationOTP: StrictEndpoint<string, { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)> }, { otp: ... } | { otp: ... }>; requestEmailChangeEmailOTP: StrictEndpoint<"/email-otp/request-email-change", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; requestPasswordResetEmailOTP: StrictEndpoint<"/email-otp/request-password-reset", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; resetPasswordEmailOTP: StrictEndpoint<"/email-otp/reset-password", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; sendVerificationOTP: StrictEndpoint<"/email-otp/send-verification-otp", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; signInEmailOTP: StrictEndpoint<"/sign-in/email-otp", { body: ZodIntersection<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { token: string; user: { createdAt: ...; email: ...; emailVerified: ...; id: ...; image?: ...; name: ...; updatedAt: ... } }>; verifyEmailOTP: StrictEndpoint<"/email-otp/verify-email", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { status: ...; token: ...; user: ... } | { status: ...; token: ...; user: ... }> }; hooks: { after: { handler: Middleware<(...), (...)>; matcher: any }[] }; id: "email-otp"; options: EmailOTPOptions; rateLimit: ({ max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any })[]; version: string; init: any }>[]];
  secret: string;
  session:   | {
     disableSessionRefresh: boolean | undefined;
     expiresIn: number | undefined;
   }
     | undefined;
  socialProviders:   | Record<string, {
     clientId: string;
     clientSecret: string;
     scope?: string[];
   }>
     | undefined;
  trustedOrigins:   | string[]
     | ((request?: Request) => Promise<(string | null | undefined)[]>)
     | undefined;
}> & {
  extendWith: Auth<{
     account:   | {
        accountLinking:   | {
           enabled: boolean | undefined;
         }
           | undefined;
      }
        | undefined;
     advanced: {
        database: {
           generateId: false;
        };
     };
     baseURL: string;
     database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
     emailAndPassword:   | {
        enabled: true;
        password: PasswordHashingConfig;
        requireEmailVerification: boolean;
        sendResetPassword:   | ((args: {
           token: string;
           url: string;
           user: {
              email: ...;
              id: ...;
           };
         }) => Promise<void>)
           | undefined;
      }
        | {
        enabled: false;
        password?: undefined;
        requireEmailVerification?: undefined;
        sendResetPassword?: undefined;
      };
     emailVerification:   | {
        sendVerificationEmail: (args: {
           token: string;
           url: string;
           user: {
              email: string;
              id: string;
           };
        }) => Promise<void>;
      }
        | undefined;
     plugins: [...Organization<C>[], ...Enabled<C, "admin", { $ERROR_CODES: { BANNED_USER: RawError<"BANNED_USER">; FAILED_TO_CREATE_USER: RawError<"FAILED_TO_CREATE_USER">; INVALID_ROLE_TYPE: RawError<"INVALID_ROLE_TYPE">; NO_DATA_TO_UPDATE: RawError<"NO_DATA_TO_UPDATE">; PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">; USER_ALREADY_EXISTS: RawError<"USER_ALREADY_EXISTS">; USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">; YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">; YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">; YOU_ARE_NOT_ALLOWED_TO_GET_USER: RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">; YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">; YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">; YOU_CANNOT_BAN_YOURSELF: RawError<"YOU_CANNOT_BAN_YOURSELF">; YOU_CANNOT_IMPERSONATE_ADMINS: RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">; YOU_CANNOT_REMOVE_YOURSELF: RawError<"YOU_CANNOT_REMOVE_YOURSELF"> }; endpoints: { adminUpdateUser: StrictEndpoint<"/admin/update-user", { body: ...; metadata: ...; method: ...; use: ... }, UserWithRole>; banUser: StrictEndpoint<"/admin/ban-user", { body: ...; metadata: ...; method: ...; use: ... }, { user: ... }>; createUser: StrictEndpoint<"/admin/create-user", { body: ...; metadata: ...; method: ... }, { user: ... }>; getUser: StrictEndpoint<"/admin/get-user", { metadata: ...; method: ...; query: ...; use: ... }, UserWithRole>; impersonateUser: StrictEndpoint<"/admin/impersonate-user", { body: ...; metadata: ...; method: ...; use: ... }, { session: ...; user: ... }>; listUsers: StrictEndpoint<"/admin/list-users", { metadata: ...; method: ...; query: ...; use: ... }, { total: ...; users: ... }>; listUserSessions: StrictEndpoint<"/admin/list-user-sessions", { body: ...; metadata: ...; method: ...; use: ... }, { sessions: ... }>; removeUser: StrictEndpoint<"/admin/remove-user", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; revokeUserSession: StrictEndpoint<"/admin/revoke-user-session", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; revokeUserSessions: StrictEndpoint<"/admin/revoke-user-sessions", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; setRole: StrictEndpoint<"/admin/set-role", { body: ...; metadata: ...; method: ...; requireHeaders: ...; use: ... }, { user: ... }>; setUserPassword: StrictEndpoint<"/admin/set-user-password", { body: ...; metadata: ...; method: ...; use: ... }, { status: ... }>; stopImpersonating: StrictEndpoint<"/admin/stop-impersonating", { method: ...; requireHeaders: ... }, { session: ...; user: ... }>; unbanUser: StrictEndpoint<"/admin/unban-user", { body: ...; metadata: ...; method: ...; use: ... }, { user: ... }>; userHasPermission: StrictEndpoint<"/admin/has-permission", { body: ...; metadata: ...; method: ... }, { error: ...; success: ... }> }; hooks: { after: { handler: ...; matcher: any }[] }; id: "admin"; options: NoInfer<{ adminUserIds: (...) | (...); defaultRole: (...) | (...) }>; schema: { session: { fields: { impersonatedBy: ... } }; user: { fields: { banExpires: ...; banned: ...; banReason: ...; role: ... } } }; version: string; init: any }>[], ...Enabled<C, "magicLink", { endpoints: { magicLinkVerify: StrictEndpoint<"/magic-link/verify", { metadata: ...; method: ...; query: ...; requireHeaders: ...; use: ... }, { session: ...; token: ...; user: ... }>; signInMagicLink: StrictEndpoint<"/sign-in/magic-link", { body: ...; metadata: ...; method: ...; requireHeaders: ...; use: ... }, { status: ... }> }; id: "magic-link"; options: MagicLinkOptions; rateLimit: { max: number; window: number; pathMatcher: any }[]; version: string }>[], ...Enabled<C, "emailOtp", { $ERROR_CODES: { INVALID_OTP: RawError<"INVALID_OTP">; OTP_EXPIRED: RawError<"OTP_EXPIRED">; TOO_MANY_ATTEMPTS: RawError<"TOO_MANY_ATTEMPTS"> }; endpoints: { changeEmailEmailOTP: StrictEndpoint<"/email-otp/change-email", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; checkVerificationOTP: StrictEndpoint<"/email-otp/check-verification-otp", { body: ...; metadata: ...; method: ... }, { success: ... }>; createVerificationOTP: StrictEndpoint<string, { body: ...; metadata: ...; method: ... }, string>; forgetPasswordEmailOTP: StrictEndpoint<"/forget-password/email-otp", { body: ...; metadata: ...; method: ... }, { success: ... }>; getVerificationOTP: StrictEndpoint<string, { metadata: ...; method: ...; query: ... }, (...) | (...)>; requestEmailChangeEmailOTP: StrictEndpoint<"/email-otp/request-email-change", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; requestPasswordResetEmailOTP: StrictEndpoint<"/email-otp/request-password-reset", { body: ...; metadata: ...; method: ... }, { success: ... }>; resetPasswordEmailOTP: StrictEndpoint<"/email-otp/reset-password", { body: ...; metadata: ...; method: ... }, { success: ... }>; sendVerificationOTP: StrictEndpoint<"/email-otp/send-verification-otp", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; signInEmailOTP: StrictEndpoint<"/sign-in/email-otp", { body: ...; metadata: ...; method: ... }, { token: ...; user: ... }>; verifyEmailOTP: StrictEndpoint<"/email-otp/verify-email", { body: ...; metadata: ...; method: ... }, (...) | (...)> }; hooks: { after: { handler: ...; matcher: any }[] }; id: "email-otp"; options: EmailOTPOptions; rateLimit: ({ max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any })[]; version: string; init: any }>[]];
     secret: string;
     session:   | {
        disableSessionRefresh: boolean | undefined;
        expiresIn: number | undefined;
      }
        | undefined;
     socialProviders:   | Record<string, {
        clientId: string;
        clientSecret: string;
        scope?: string[];
      }>
        | undefined;
     trustedOrigins:   | string[]
        | ((request?: Request) => Promise<(string | null | undefined)[]>)
        | undefined;
  }>;
} : never;

Defined in: server/auth/create-auth.ts:18

Type Parameters

Type Parameter
C extends TaprootAuthConfig

Parameters

ParameterType
configC

Returns

C extends TaprootAuthConfig ? Auth<{ account: | { accountLinking: | { enabled: boolean | undefined; } | undefined; } | undefined; advanced: { database: { generateId: false; }; }; baseURL: string; database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>; emailAndPassword: | { enabled: true; password: PasswordHashingConfig; requireEmailVerification: boolean; sendResetPassword: | ((args: { token: string; url: string; user: { email: string; id: string; }; }) => Promise<void>) | undefined; } | { enabled: false; password?: undefined; requireEmailVerification?: undefined; sendResetPassword?: undefined; }; emailVerification: | { sendVerificationEmail: (args: { token: string; url: string; user: { email: string; id: string; }; }) => Promise<void>; } | undefined; plugins: [...Organization<C>[], ...Enabled<C, "admin", { $ERROR_CODES: { BANNED_USER: RawError<"BANNED_USER">; FAILED_TO_CREATE_USER: RawError<"FAILED_TO_CREATE_USER">; INVALID_ROLE_TYPE: RawError<"INVALID_ROLE_TYPE">; NO_DATA_TO_UPDATE: RawError<"NO_DATA_TO_UPDATE">; PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">; USER_ALREADY_EXISTS: RawError<"USER_ALREADY_EXISTS">; USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">; YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">; YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">; YOU_ARE_NOT_ALLOWED_TO_GET_USER: RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">; YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">; YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">; YOU_CANNOT_BAN_YOURSELF: RawError<"YOU_CANNOT_BAN_YOURSELF">; YOU_CANNOT_IMPERSONATE_ADMINS: RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">; YOU_CANNOT_REMOVE_YOURSELF: RawError<"YOU_CANNOT_REMOVE_YOURSELF"> }; endpoints: { adminUpdateUser: StrictEndpoint<"/admin/update-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, UserWithRole>; banUser: StrictEndpoint<"/admin/ban-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { user: UserWithRole }>; createUser: StrictEndpoint<"/admin/create-user", { body: ZodObject<(...), (...)>; metadata: { $Infer: ...; openapi: ... }; method: "POST" }, { user: UserWithRole }>; getUser: StrictEndpoint<"/admin/get-user", { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)>; use: (...)[] }, UserWithRole>; impersonateUser: StrictEndpoint<"/admin/impersonate-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { session: { createdAt: ...; expiresAt: ...; id: ...; ipAddress?: ...; token: ...; updatedAt: ...; userAgent?: ...; userId: ... }; user: UserWithRole }>; listUsers: StrictEndpoint<"/admin/list-users", { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)>; use: (...)[] }, { total: number; users: (...)[] }>; listUserSessions: StrictEndpoint<"/admin/list-user-sessions", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { sessions: (...)[] }>; removeUser: StrictEndpoint<"/admin/remove-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; revokeUserSession: StrictEndpoint<"/admin/revoke-user-session", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; revokeUserSessions: StrictEndpoint<"/admin/revoke-user-sessions", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; setRole: StrictEndpoint<"/admin/set-role", { body: ZodObject<(...), (...)>; metadata: { $Infer: ...; openapi: ... }; method: "POST"; requireHeaders: true; use: (...)[] }, { user: UserWithRole }>; setUserPassword: StrictEndpoint<"/admin/set-user-password", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { status: boolean }>; stopImpersonating: StrictEndpoint<"/admin/stop-impersonating", { method: "POST"; requireHeaders: true }, { session: (...) & (...); user: (...) & (...) }>; unbanUser: StrictEndpoint<"/admin/unban-user", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { user: UserWithRole }>; userHasPermission: StrictEndpoint<"/admin/has-permission", { body: ZodIntersection<(...), (...)>; metadata: { $Infer: ...; openapi: ... }; method: "POST" }, { error: null; success: boolean }> }; hooks: { after: { handler: Middleware<(...), (...)>; matcher: any }[] }; id: "admin"; options: NoInfer<{ adminUserIds: (...)[] | undefined; defaultRole: string | undefined }>; schema: { session: { fields: { impersonatedBy: { input: ...; required: ...; type: ... } } }; user: { fields: { banExpires: { input: ...; required: ...; type: ... }; banned: { defaultValue: ...; input: ...; required: ...; type: ... }; banReason: { input: ...; required: ...; type: ... }; role: { input: ...; required: ...; type: ... } } } }; version: string; init: any }>[], ...Enabled<C, "magicLink", { endpoints: { magicLinkVerify: StrictEndpoint<"/magic-link/verify", { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)>; requireHeaders: true; use: (...)[] }, { session: { createdAt: ...; expiresAt: ...; id: ...; ipAddress?: ...; token: ...; updatedAt: ...; userAgent?: ...; userId: ... }; token: string; user: { createdAt: ...; email: ...; emailVerified: ...; id: ...; image?: ...; name: ...; updatedAt: ... } }>; signInMagicLink: StrictEndpoint<"/sign-in/magic-link", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; requireHeaders: true; use: (...)[] }, { status: boolean }> }; id: "magic-link"; options: MagicLinkOptions; rateLimit: { max: number; window: number; pathMatcher: any }[]; version: string }>[], ...Enabled<C, "emailOtp", { $ERROR_CODES: { INVALID_OTP: RawError<"INVALID_OTP">; OTP_EXPIRED: RawError<"OTP_EXPIRED">; TOO_MANY_ATTEMPTS: RawError<"TOO_MANY_ATTEMPTS"> }; endpoints: { changeEmailEmailOTP: StrictEndpoint<"/email-otp/change-email", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; checkVerificationOTP: StrictEndpoint<"/email-otp/check-verification-otp", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; createVerificationOTP: StrictEndpoint<string, { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, string>; forgetPasswordEmailOTP: StrictEndpoint<"/forget-password/email-otp", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; getVerificationOTP: StrictEndpoint<string, { metadata: { openapi: ... }; method: "GET"; query: ZodObject<(...), (...)> }, { otp: ... } | { otp: ... }>; requestEmailChangeEmailOTP: StrictEndpoint<"/email-otp/request-email-change", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; requestPasswordResetEmailOTP: StrictEndpoint<"/email-otp/request-password-reset", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; resetPasswordEmailOTP: StrictEndpoint<"/email-otp/reset-password", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { success: boolean }>; sendVerificationOTP: StrictEndpoint<"/email-otp/send-verification-otp", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST"; use: (...)[] }, { success: boolean }>; signInEmailOTP: StrictEndpoint<"/sign-in/email-otp", { body: ZodIntersection<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { token: string; user: { createdAt: ...; email: ...; emailVerified: ...; id: ...; image?: ...; name: ...; updatedAt: ... } }>; verifyEmailOTP: StrictEndpoint<"/email-otp/verify-email", { body: ZodObject<(...), (...)>; metadata: { openapi: ... }; method: "POST" }, { status: ...; token: ...; user: ... } | { status: ...; token: ...; user: ... }> }; hooks: { after: { handler: Middleware<(...), (...)>; matcher: any }[] }; id: "email-otp"; options: EmailOTPOptions; rateLimit: ({ max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any } | { max: number; window: number; pathMatcher: any })[]; version: string; init: any }>[]]; secret: string; session: | { disableSessionRefresh: boolean | undefined; expiresIn: number | undefined; } | undefined; socialProviders: | Record<string, { clientId: string; clientSecret: string; scope?: string[]; }> | undefined; trustedOrigins: | string[] | ((request?: Request) => Promise<(string | null | undefined)[]>) | undefined; }> & { extendWith: Auth<{ account: | { accountLinking: | { enabled: boolean | undefined; } | undefined; } | undefined; advanced: { database: { generateId: false; }; }; baseURL: string; database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>; emailAndPassword: | { enabled: true; password: PasswordHashingConfig; requireEmailVerification: boolean; sendResetPassword: | ((args: { token: string; url: string; user: { email: ...; id: ...; }; }) => Promise<void>) | undefined; } | { enabled: false; password?: undefined; requireEmailVerification?: undefined; sendResetPassword?: undefined; }; emailVerification: | { sendVerificationEmail: (args: { token: string; url: string; user: { email: string; id: string; }; }) => Promise<void>; } | undefined; plugins: [...Organization<C>[], ...Enabled<C, "admin", { $ERROR_CODES: { BANNED_USER: RawError<"BANNED_USER">; FAILED_TO_CREATE_USER: RawError<"FAILED_TO_CREATE_USER">; INVALID_ROLE_TYPE: RawError<"INVALID_ROLE_TYPE">; NO_DATA_TO_UPDATE: RawError<"NO_DATA_TO_UPDATE">; PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">; USER_ALREADY_EXISTS: RawError<"USER_ALREADY_EXISTS">; USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">; YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">; YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">; YOU_ARE_NOT_ALLOWED_TO_GET_USER: RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">; YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">; YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">; YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">; YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">; YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">; YOU_CANNOT_BAN_YOURSELF: RawError<"YOU_CANNOT_BAN_YOURSELF">; YOU_CANNOT_IMPERSONATE_ADMINS: RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">; YOU_CANNOT_REMOVE_YOURSELF: RawError<"YOU_CANNOT_REMOVE_YOURSELF"> }; endpoints: { adminUpdateUser: StrictEndpoint<"/admin/update-user", { body: ...; metadata: ...; method: ...; use: ... }, UserWithRole>; banUser: StrictEndpoint<"/admin/ban-user", { body: ...; metadata: ...; method: ...; use: ... }, { user: ... }>; createUser: StrictEndpoint<"/admin/create-user", { body: ...; metadata: ...; method: ... }, { user: ... }>; getUser: StrictEndpoint<"/admin/get-user", { metadata: ...; method: ...; query: ...; use: ... }, UserWithRole>; impersonateUser: StrictEndpoint<"/admin/impersonate-user", { body: ...; metadata: ...; method: ...; use: ... }, { session: ...; user: ... }>; listUsers: StrictEndpoint<"/admin/list-users", { metadata: ...; method: ...; query: ...; use: ... }, { total: ...; users: ... }>; listUserSessions: StrictEndpoint<"/admin/list-user-sessions", { body: ...; metadata: ...; method: ...; use: ... }, { sessions: ... }>; removeUser: StrictEndpoint<"/admin/remove-user", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; revokeUserSession: StrictEndpoint<"/admin/revoke-user-session", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; revokeUserSessions: StrictEndpoint<"/admin/revoke-user-sessions", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; setRole: StrictEndpoint<"/admin/set-role", { body: ...; metadata: ...; method: ...; requireHeaders: ...; use: ... }, { user: ... }>; setUserPassword: StrictEndpoint<"/admin/set-user-password", { body: ...; metadata: ...; method: ...; use: ... }, { status: ... }>; stopImpersonating: StrictEndpoint<"/admin/stop-impersonating", { method: ...; requireHeaders: ... }, { session: ...; user: ... }>; unbanUser: StrictEndpoint<"/admin/unban-user", { body: ...; metadata: ...; method: ...; use: ... }, { user: ... }>; userHasPermission: StrictEndpoint<"/admin/has-permission", { body: ...; metadata: ...; method: ... }, { error: ...; success: ... }> }; hooks: { after: { handler: ...; matcher: any }[] }; id: "admin"; options: NoInfer<{ adminUserIds: (...) | (...); defaultRole: (...) | (...) }>; schema: { session: { fields: { impersonatedBy: ... } }; user: { fields: { banExpires: ...; banned: ...; banReason: ...; role: ... } } }; version: string; init: any }>[], ...Enabled<C, "magicLink", { endpoints: { magicLinkVerify: StrictEndpoint<"/magic-link/verify", { metadata: ...; method: ...; query: ...; requireHeaders: ...; use: ... }, { session: ...; token: ...; user: ... }>; signInMagicLink: StrictEndpoint<"/sign-in/magic-link", { body: ...; metadata: ...; method: ...; requireHeaders: ...; use: ... }, { status: ... }> }; id: "magic-link"; options: MagicLinkOptions; rateLimit: { max: number; window: number; pathMatcher: any }[]; version: string }>[], ...Enabled<C, "emailOtp", { $ERROR_CODES: { INVALID_OTP: RawError<"INVALID_OTP">; OTP_EXPIRED: RawError<"OTP_EXPIRED">; TOO_MANY_ATTEMPTS: RawError<"TOO_MANY_ATTEMPTS"> }; endpoints: { changeEmailEmailOTP: StrictEndpoint<"/email-otp/change-email", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; checkVerificationOTP: StrictEndpoint<"/email-otp/check-verification-otp", { body: ...; metadata: ...; method: ... }, { success: ... }>; createVerificationOTP: StrictEndpoint<string, { body: ...; metadata: ...; method: ... }, string>; forgetPasswordEmailOTP: StrictEndpoint<"/forget-password/email-otp", { body: ...; metadata: ...; method: ... }, { success: ... }>; getVerificationOTP: StrictEndpoint<string, { metadata: ...; method: ...; query: ... }, (...) | (...)>; requestEmailChangeEmailOTP: StrictEndpoint<"/email-otp/request-email-change", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; requestPasswordResetEmailOTP: StrictEndpoint<"/email-otp/request-password-reset", { body: ...; metadata: ...; method: ... }, { success: ... }>; resetPasswordEmailOTP: StrictEndpoint<"/email-otp/reset-password", { body: ...; metadata: ...; method: ... }, { success: ... }>; sendVerificationOTP: StrictEndpoint<"/email-otp/send-verification-otp", { body: ...; metadata: ...; method: ...; use: ... }, { success: ... }>; signInEmailOTP: StrictEndpoint<"/sign-in/email-otp", { body: ...; metadata: ...; method: ... }, { token: ...; user: ... }>; verifyEmailOTP: StrictEndpoint<"/email-otp/verify-email", { body: ...; metadata: ...; method: ... }, (...) | (...)> }; hooks: { after: { handler: ...; matcher: any }[] }; id: "email-otp"; options: EmailOTPOptions; rateLimit: ({ max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any } | { max: ...; window: ...; pathMatcher: any })[]; version: string; init: any }>[]]; secret: string; session: | { disableSessionRefresh: boolean | undefined; expiresIn: number | undefined; } | undefined; socialProviders: | Record<string, { clientId: string; clientSecret: string; scope?: string[]; }> | undefined; trustedOrigins: | string[] | ((request?: Request) => Promise<(string | null | undefined)[]>) | undefined; }>; } : never

On this page