diff --git a/apps/desktop/layer/renderer/src/atoms/app.ts b/apps/desktop/layer/renderer/src/atoms/app.ts index 4489a6c2e..e1ba97dd0 100644 --- a/apps/desktop/layer/renderer/src/atoms/app.ts +++ b/apps/desktop/layer/renderer/src/atoms/app.ts @@ -4,6 +4,8 @@ import { atom } from "jotai" import { createAtomHooks } from "~/lib/jotai" export const [, , useAppIsReady, , appIsReady, setAppIsReady] = createAtomHooks(atom(false)) +export const [, , useAppMessagingToken, , appMessagingToken, setAppMessagingToken] = + createAtomHooks(atom(null)) export const [, , useAppSearchOpen, , , setAppSearchOpen] = createAtomHooks(atom(false)) diff --git a/apps/desktop/layer/renderer/src/modules/action/target-action-list.tsx b/apps/desktop/layer/renderer/src/modules/action/target-action-list.tsx index b68542840..1f5a05b7d 100644 --- a/apps/desktop/layer/renderer/src/modules/action/target-action-list.tsx +++ b/apps/desktop/layer/renderer/src/modules/action/target-action-list.tsx @@ -119,7 +119,7 @@ export const TargetActionList = ({ index }: { index: number }) => { }, { title: t("actions.action_card.new_entry_notification"), - icon: , + icon: , enabled: !!newEntryNotification, onInit: (data) => { data.result.newEntryNotification = true diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/notifications.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/notifications.tsx new file mode 100644 index 000000000..a6e843276 --- /dev/null +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/notifications.tsx @@ -0,0 +1,115 @@ +import { Button } from "@follow/components/ui/button/index.js" +import { Divider } from "@follow/components/ui/divider/index.js" +import { LoadingCircle } from "@follow/components/ui/loading/index.jsx" +import { ScrollArea } from "@follow/components/ui/scroll-area/index.js" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@follow/components/ui/table/index.jsx" +import { + Tooltip, + TooltipContent, + TooltipPortal, + TooltipTrigger, +} from "@follow/components/ui/tooltip/index.jsx" +import { Trans } from "react-i18next" +import { Link } from "react-router" +import { toast } from "sonner" + +import { useAppMessagingToken } from "~/atoms/app" +import { useCurrentModal } from "~/components/ui/modal/stacked/hooks" +import { useI18n } from "~/hooks/common" +import { useMessaging, useTestMessaging } from "~/queries/messaging" + +export const SettingNotifications = () => { + const t = useI18n() + const { isLoading, data } = useMessaging() + const { dismiss } = useCurrentModal() + + const token = useAppMessagingToken() + + const testMessaging = useTestMessaging() + + return ( +
+
+

+ { + dismiss() + }} + /> + ), + }} + /> +

+
+ +
+ {isLoading && } + + +
+ + + + {t.settings("notifications.channel")} + {t.settings("notifications.token")} + + {t.common("words.actions")} + + + + + {data?.data?.map((row) => ( + + {row.channel} + + {row.token.slice(0, 6)}...{row.token.slice(-6)} + {row.token === token && ` ${t.settings("notifications.current")}`} + + + + + + + + {t.settings("notifications.test")} + + + + + ))} + +
+
+
+
+
+ ) +} diff --git a/apps/desktop/layer/renderer/src/pages/settings/(settings)/notifications.tsx b/apps/desktop/layer/renderer/src/pages/settings/(settings)/notifications.tsx new file mode 100644 index 000000000..b489a2a08 --- /dev/null +++ b/apps/desktop/layer/renderer/src/pages/settings/(settings)/notifications.tsx @@ -0,0 +1,24 @@ +import { UserRole } from "@follow/constants" + +import { SettingNotifications } from "~/modules/settings/tabs/notifications" +import { SettingsTitle } from "~/modules/settings/title" +import { defineSettingPageData, DisableWhy } from "~/modules/settings/utils" + +const iconName = "i-mgc-notification-cute-re" +const priority = 1040 + +export const loader = defineSettingPageData({ + icon: iconName, + name: "titles.notifications", + priority, + disableIf: (ctx) => [ctx.role === UserRole.Trial, DisableWhy.NotActivation], +}) + +export function Component() { + return ( + <> + + + + ) +} diff --git a/apps/desktop/layer/renderer/src/push-notification.ts b/apps/desktop/layer/renderer/src/push-notification.ts index fbdb1ee71..78ad65049 100644 --- a/apps/desktop/layer/renderer/src/push-notification.ts +++ b/apps/desktop/layer/renderer/src/push-notification.ts @@ -2,6 +2,7 @@ import { env } from "@follow/shared/env.desktop" import { initializeApp } from "firebase/app" import { getMessaging, getToken } from "firebase/messaging" +import { setAppMessagingToken } from "./atoms/app" import { apiClient } from "./lib/api-fetch" import { router } from "./router" @@ -52,6 +53,8 @@ export async function registerWebPushNotifications() { registerPushNotificationPostMessage() + setAppMessagingToken(token) + return token } catch (error) { if (error instanceof Error) { diff --git a/apps/desktop/layer/renderer/src/queries/messaging.ts b/apps/desktop/layer/renderer/src/queries/messaging.ts new file mode 100644 index 000000000..33bae89e3 --- /dev/null +++ b/apps/desktop/layer/renderer/src/queries/messaging.ts @@ -0,0 +1,24 @@ +import { useMutation } from "@tanstack/react-query" + +import { useAuthQuery } from "~/hooks/common" +import { apiClient } from "~/lib/api-fetch" +import { defineQuery } from "~/lib/defineQuery" + +export const messaging = { + list: () => + defineQuery(["messaging"], () => apiClient.messaging.$get(), { + rootKey: ["messaging"], + }), +} + +export const useMessaging = () => useAuthQuery(messaging.list()) + +export const useTestMessaging = () => + useMutation({ + mutationFn: ({ channel }: { channel: string }) => + apiClient.messaging.test.$get({ + query: { + channel, + }, + }), + }) diff --git a/apps/mobile/src/icons/bell_ringing_cute_fi.tsx b/apps/mobile/src/icons/bell_ringing_cute_fi.tsx deleted file mode 100644 index 641b53a27..000000000 --- a/apps/mobile/src/icons/bell_ringing_cute_fi.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from "react" -import Svg, { Path } from "react-native-svg" - -interface BellRingingCuteFiIconProps { - width?: number - height?: number - color?: string -} - -export const BellRingingCuteFiIcon = ({ - width = 24, - height = 24, - color = "#10161F", -}: BellRingingCuteFiIconProps) => { - return ( - - - - ) -} diff --git a/apps/mobile/src/icons/bell_ringing_cute_re.tsx b/apps/mobile/src/icons/bell_ringing_cute_re.tsx deleted file mode 100644 index 2cf23cf22..000000000 --- a/apps/mobile/src/icons/bell_ringing_cute_re.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from "react" -import Svg, { Path } from "react-native-svg" - -interface BellRingingCuteReIconProps { - width?: number - height?: number - color?: string -} - -export const BellRingingCuteReIcon = ({ - width = 24, - height = 24, - color = "#10161F", -}: BellRingingCuteReIconProps) => { - return ( - - - - ) -} diff --git a/apps/mobile/src/icons/fire_cute_re.tsx b/apps/mobile/src/icons/fire_cute_re.tsx new file mode 100644 index 000000000..ac7e36acf --- /dev/null +++ b/apps/mobile/src/icons/fire_cute_re.tsx @@ -0,0 +1,24 @@ +import * as React from "react" +import Svg, { Path } from "react-native-svg" + +interface FireCuteReIconProps { + width?: number + height?: number + color?: string +} + +export const FireCuteReIcon = ({ + width = 24, + height = 24, + color = "#10161F", +}: FireCuteReIconProps) => { + return ( + + + + ) +} diff --git a/apps/mobile/src/icons/notification_cute_re.tsx b/apps/mobile/src/icons/notification_cute_re.tsx new file mode 100644 index 000000000..bda580ed6 --- /dev/null +++ b/apps/mobile/src/icons/notification_cute_re.tsx @@ -0,0 +1,24 @@ +import * as React from "react" +import Svg, { Path } from "react-native-svg" + +interface NotificationCuteReIconProps { + width?: number + height?: number + color?: string +} + +export const NotificationCuteReIcon = ({ + width = 24, + height = 24, + color = "#10161F", +}: NotificationCuteReIconProps) => { + return ( + + + + ) +} diff --git a/apps/mobile/src/modules/settings/SettingsList.tsx b/apps/mobile/src/modules/settings/SettingsList.tsx index daf2bd89e..740f29c6c 100644 --- a/apps/mobile/src/modules/settings/SettingsList.tsx +++ b/apps/mobile/src/modules/settings/SettingsList.tsx @@ -14,12 +14,12 @@ import { GroupedInsetListNavigationLinkIcon, } from "@/src/components/ui/grouped/GroupedList" import { getDbPath } from "@/src/database" -import { BellRingingCuteFiIcon } from "@/src/icons/bell_ringing_cute_fi" import { CertificateCuteFiIcon } from "@/src/icons/certificate_cute_fi" import { DatabaseIcon } from "@/src/icons/database" import { ExitCuteFiIcon } from "@/src/icons/exit_cute_fi" import { LoveCuteFiIcon } from "@/src/icons/love_cute_fi" import { Magic2CuteFiIcon } from "@/src/icons/magic_2_cute_fi" +import { NotificationCuteReIcon } from "@/src/icons/notification_cute_re" import { PaletteCuteFiIcon } from "@/src/icons/palette_cute_fi" import { RadaCuteFiIcon } from "@/src/icons/rada_cute_fi" import { SafeLockFilledIcon } from "@/src/icons/safe_lock_filled" @@ -66,7 +66,7 @@ const SettingGroupNavigationLinks: GroupNavigationLink[] = [ }, { label: "titles.notifications", - icon: BellRingingCuteFiIcon, + icon: NotificationCuteReIcon, onPress: ({ navigation }) => { navigation.pushControllerView(NotificationsScreen) }, diff --git a/icons/mgc/bell_ringing_cute_fi.svg b/icons/mgc/bell_ringing_cute_fi.svg deleted file mode 100644 index 979a9fc95..000000000 --- a/icons/mgc/bell_ringing_cute_fi.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icons/mgc/bell_ringing_cute_re.svg b/icons/mgc/bell_ringing_cute_re.svg deleted file mode 100644 index 5bb67e1c0..000000000 --- a/icons/mgc/bell_ringing_cute_re.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/icons/mgc/finger_press_cute_re.svg b/icons/mgc/finger_press_cute_re.svg new file mode 100644 index 000000000..85fd0f517 --- /dev/null +++ b/icons/mgc/finger_press_cute_re.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/mgc/notification_cute_re.svg b/icons/mgc/notification_cute_re.svg new file mode 100644 index 000000000..b030d5212 --- /dev/null +++ b/icons/mgc/notification_cute_re.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/locales/settings/en.json b/locales/settings/en.json index 21eb58e74..3342da467 100644 --- a/locales/settings/en.json +++ b/locales/settings/en.json @@ -342,6 +342,12 @@ "lists.subscriptions": "Subs", "lists.title": "Title", "lists.view": "View", + "notifications.channel": "Channel", + "notifications.current": "(current client)", + "notifications.info": "Folo offers robust and versatile notification features through Actions. You can customize notification for specific feeds, views, or keywords. Below are your registered notification channels.", + "notifications.test": "Test Notification", + "notifications.test_success": "Test notification sent successfully.", + "notifications.token": "Client Token", "privacy.privacy": "Privacy", "privacy.terms": "Terms", "profile.avatar.label": "Avatar", diff --git a/packages/internal/shared/src/hono.ts b/packages/internal/shared/src/hono.ts index 23d2ecfdd..c20a0deb7 100644 --- a/packages/internal/shared/src/hono.ts +++ b/packages/internal/shared/src/hono.ts @@ -293,48 +293,6 @@ declare const authPlugins: ({ path: "/one-time-token/apply"; }; }; -} | { - id: "customCreateSession"; - endpoints: { - customCreateSession: { - (inputCtx_0?: ({ - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - ck: string; - userId: string; - } | null; - } : { - ck: string; - userId: string; - } | null>; - options: { - method: "GET"; - } & { - use: any[]; - }; - path: "/create-session"; - }; - }; })[]; declare const achievements: drizzle_orm_pg_core.PgTableWithColumns<{ @@ -853,7 +811,7 @@ declare const actionsItemOpenAPISchema: z.ZodObject<{ }; }>; type ActionItem = z.infer; -declare const actionsOpenAPISchema: z.ZodObject; updatedAt: z.ZodNullable; @@ -906,7 +864,7 @@ declare const actionsOpenAPISchema: z.ZodObject>; -}, "rules">, { +}, "rules"> & { rules: z.ZodNullable, "many">>>; -}>, "strip", z.ZodTypeAny, { +}, "strip", z.ZodTypeAny, { createdAt: string | null; updatedAt: string | null; userId: string; @@ -1432,7 +1390,7 @@ declare const airdrops: drizzle_orm_pg_core.PgTableWithColumns<{ }; dialect: "pg"; }>; -declare const airdropsOpenAPISchema: z.ZodObject; userId: z.ZodString; amount: z.ZodString; @@ -1488,7 +1446,7 @@ declare const airdropsOpenAPISchema: z.ZodObject>; verify: z.ZodNullable; tx: z.ZodNullable; -}, "detail">, { +}, "detail"> & { detail: z.ZodNullable>; -}>, "strip", z.ZodTypeAny, { +}, "strip", z.ZodTypeAny, { userId: string; tx: string | null; activity: "public_beta"; @@ -1852,78 +1810,15 @@ type ExtraModel = { }[]; }; declare const CommonEntryFields: { - id: drizzle_orm.HasRuntimeDefault>>>>; - title: drizzle_orm_pg_core.PgTextBuilder<{ - name: "title"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; - url: drizzle_orm_pg_core.PgTextBuilder<{ - name: "url"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; - content: drizzle_orm_pg_core.PgTextBuilder<{ - name: "content"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; - description: drizzle_orm_pg_core.PgTextBuilder<{ - name: "description"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; - guid: drizzle_orm.NotNull>; - author: drizzle_orm_pg_core.PgTextBuilder<{ - name: "author"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; - authorUrl: drizzle_orm_pg_core.PgTextBuilder<{ - name: "author_url"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; - authorAvatar: drizzle_orm_pg_core.PgTextBuilder<{ - name: "author_avatar"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; + id: drizzle_orm.HasRuntimeDefault>>>>; + title: drizzle_orm_pg_core.PgTextBuilderInitial<"title", [string, ...string[]]>; + url: drizzle_orm_pg_core.PgTextBuilderInitial<"url", [string, ...string[]]>; + content: drizzle_orm_pg_core.PgTextBuilderInitial<"content", [string, ...string[]]>; + description: drizzle_orm_pg_core.PgTextBuilderInitial<"description", [string, ...string[]]>; + guid: drizzle_orm.NotNull>; + author: drizzle_orm_pg_core.PgTextBuilderInitial<"author", [string, ...string[]]>; + authorUrl: drizzle_orm_pg_core.PgTextBuilderInitial<"author_url", [string, ...string[]]>; + authorAvatar: drizzle_orm_pg_core.PgTextBuilderInitial<"author_avatar", [string, ...string[]]>; insertedAt: drizzle_orm.NotNull>; publishedAt: drizzle_orm.NotNull>; media: drizzle_orm.$Type, MediaModel[]>; @@ -1953,14 +1848,7 @@ declare const CommonEntryFields: { }>; attachments: drizzle_orm.$Type, AttachmentsModel[]>; extra: drizzle_orm.$Type, ExtraModel>; - language: drizzle_orm_pg_core.PgTextBuilder<{ - name: "language"; - dataType: "string"; - columnType: "PgText"; - data: string; - enumValues: [string, ...string[]]; - driverParam: string; - }>; + language: drizzle_orm_pg_core.PgTextBuilderInitial<"language", [string, ...string[]]>; }; declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ name: "entries"; @@ -2358,7 +2246,7 @@ declare const extraZodSchema: z.ZodNullable>>; -declare const entriesOpenAPISchema: z.ZodObject; url: z.ZodNullable; @@ -2520,7 +2408,7 @@ declare const entriesOpenAPISchema: z.ZodObject>; language: z.ZodNullable; feedId: z.ZodString; -}, "media" | "attachments" | "extra">, { +}, "media" | "attachments" | "extra"> & { attachments: z.ZodNullable>; @@ -2589,7 +2477,7 @@ declare const entriesOpenAPISchema: z.ZodObject>>; -}>, "strip", z.ZodTypeAny, { +}, "strip", z.ZodTypeAny, { id: string; description: string | null; title: string | null; @@ -3750,7 +3638,7 @@ declare const inboxesEntries: drizzle_orm_pg_core.PgTableWithColumns<{ }; dialect: "pg"; }>; -declare const inboxesEntriesOpenAPISchema: z.ZodObject; url: z.ZodNullable; @@ -3913,7 +3801,7 @@ declare const inboxesEntriesOpenAPISchema: z.ZodObject; inboxHandle: z.ZodString; read: z.ZodNullable; -}, "media" | "attachments" | "extra">, { +}, "media" | "attachments" | "extra"> & { attachments: z.ZodNullable>; @@ -3982,7 +3870,7 @@ declare const inboxesEntriesOpenAPISchema: z.ZodObject>>; -}>, "strip", z.ZodTypeAny, { +}, "strip", z.ZodTypeAny, { id: string; description: string | null; title: string | null; @@ -4059,7 +3947,7 @@ declare const inboxesEntriesOpenAPISchema: z.ZodObject; -declare const inboxesEntriesInsertOpenAPISchema: z.ZodObject; description: z.ZodOptional>; title: z.ZodOptional>; @@ -4222,7 +4110,7 @@ declare const inboxesEntriesInsertOpenAPISchema: z.ZodObject>; inboxHandle: z.ZodString; -}, "id" | "media" | "attachments" | "extra" | "insertedAt" | "publishedAt" | "inboxHandle">, { +}, "id" | "media" | "attachments" | "extra" | "insertedAt" | "publishedAt" | "inboxHandle"> & { attachments: z.ZodNullable>; @@ -4292,7 +4180,7 @@ declare const inboxesEntriesInsertOpenAPISchema: z.ZodObject>>; publishedAt: z.ZodString; -}>, "strip", z.ZodTypeAny, { +}, "strip", z.ZodTypeAny, { guid: string; publishedAt: string; description?: string | null | undefined; @@ -4583,6 +4471,61 @@ declare const invitationsRelations: drizzle_orm.Relations<"invitations", { users: drizzle_orm.One<"user", false>; }>; +declare const listAnalytics: drizzle_orm_pg_core.PgTableWithColumns<{ + name: "list_analytics"; + schema: undefined; + columns: { + listId: drizzle_orm_pg_core.PgColumn<{ + name: "list_id"; + tableName: "list_analytics"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: true; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + subscriptionCount: drizzle_orm_pg_core.PgColumn<{ + name: "subscription_count"; + tableName: "list_analytics"; + dataType: "number"; + columnType: "PgInteger"; + data: number; + driverParam: string | number; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + identity: undefined; + generated: undefined; + }, {}, {}>; + }; + dialect: "pg"; +}>; +declare const listAnalyticsOpenAPISchema: zod.ZodObject<{ + listId: zod.ZodString; + subscriptionCount: zod.ZodNullable; +}, zod.UnknownKeysParam, zod.ZodTypeAny, { + subscriptionCount: number | null; + listId: string; +}, { + subscriptionCount: number | null; + listId: string; +}>; +declare const listAnalyticsRelations: drizzle_orm.Relations<"list_analytics", { + list: drizzle_orm.One<"lists", true>; +}>; + declare const lists: drizzle_orm_pg_core.PgTableWithColumns<{ name: "lists"; schema: undefined; @@ -5040,13 +4983,13 @@ declare const messaging: drizzle_orm_pg_core.PgTableWithColumns<{ }; dialect: "pg"; }>; -declare const messagingOpenAPISchema: z.ZodObject; token: z.ZodString; channel: z.ZodString; -}, "channel">, { +}, "channel"> & { channel: z.ZodEnum<["macos", "windows", "linux", "ios", "android", "web", "desktop"]>; -}>, "strip", z.ZodTypeAny, { +}, "strip", z.ZodTypeAny, { userId: string | null; token: string; channel: "macos" | "windows" | "linux" | "ios" | "android" | "web" | "desktop"; @@ -8154,8 +8097,8 @@ declare const auth: { required: string[]; }; }; - required: string[]; }; + required: string[]; }; }; }; @@ -8462,10 +8405,12 @@ declare const auth: { name: string; email: string; password: string; + callbackURL?: string; } | ({ name: string; email: string; password: string; + callbackURL?: string; } & {} & {})) & { handle: string; } & { @@ -8546,10 +8491,12 @@ declare const auth: { name: string; email: string; password: string; + callbackURL?: string; } | ({ name: string; email: string; password: string; + callbackURL?: string; } & {} & {})) & { handle: string; } & { @@ -9081,8 +9028,8 @@ declare const auth: { type: string; description: string; }; - required: string[]; }; + required: string[]; }; }; }; @@ -9540,16 +9487,1679 @@ declare const auth: { }; updateUser: { (inputCtx_0: { - body: Partial better_auth.Adapter; + advanced: { + generateId: false; + defaultCookieAttributes: { + sameSite: "none"; + secure: true; + }; + }; + session: { + updateAge: number; + expiresIn: number; + }; + basePath: string; + trustedOrigins: string[]; + user: { + additionalFields: { + handle: { + type: "string"; + }; + }; + changeEmail: { + enabled: true; + sendChangeEmailVerification: ({ user, url }: { + user: better_auth.User; + newEmail: string; + url: string; + token: string; + }) => Promise; + }; + }; + account: { + accountLinking: { + enabled: true; + trustedProviders: ("github" | "apple" | "google")[]; + allowDifferentEmails: true; + }; + }; + socialProviders: { + google: { + clientId: string; + clientSecret: string; + }; + github: { + clientId: string; + clientSecret: string; + }; + apple: { + enabled: boolean; + clientId: string; + clientSecret: string; + appBundleIdentifier: string | undefined; + }; + }; + emailAndPassword: { + enabled: true; + sendResetPassword({ user, url }: { + user: better_auth.User; + url: string; + token: string; + }): Promise; + }; + emailVerification: { + sendOnSignUp: true; + sendVerificationEmail({ user, url }: { + user: better_auth.User; + url: string; + token: string; + }): Promise; + }; + plugins: ({ + id: "open-api"; + endpoints: { + generateOpenAPISchema: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_1 | undefined; + }) | undefined): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_1] extends [true] ? { + headers: Headers; + response: { + openapi: string; + info: { + title: string; + description: string; + version: string; + }; + components: { + securitySchemes: { + apiKeyCookie: { + type: string; + in: string; + name: string; + description: string; + }; + bearerAuth: { + type: string; + scheme: string; + description: string; + }; + }; + schemas: {}; + }; + security: { + apiKeyCookie: never[]; + bearerAuth: never[]; + }[]; + servers: { + url: string; + }[]; + tags: { + name: string; + description: string; + }[]; + paths: Record; + }; + } : { + openapi: string; + info: { + title: string; + description: string; + version: string; + }; + components: { + securitySchemes: { + apiKeyCookie: { + type: string; + in: string; + name: string; + description: string; + }; + bearerAuth: { + type: string; + scheme: string; + description: string; + }; + }; + schemas: {}; + }; + security: { + apiKeyCookie: never[]; + bearerAuth: never[]; + }[]; + servers: { + url: string; + }[]; + tags: { + name: string; + description: string; + }[]; + paths: Record; + }>; + options: { + method: "GET"; + } & { + use: any[]; + }; + path: "/open-api/generate-schema"; + }; + openAPIReference: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_2 | undefined; + }) | undefined): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_2] extends [true] ? { + headers: Headers; + response: Response; + } : Response>; + options: { + method: "GET"; + metadata: { + isAction: boolean; + }; + } & { + use: any[]; + }; + path: "/reference"; + }; + }; + } | { + id: "two-factor"; + endpoints: { + enableTwoFactor: { + (inputCtx_0: { + body: { + password: string; + issuer?: string | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_3 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_3] extends [true] ? { + headers: Headers; + response: { + totpURI: string; + backupCodes: string[]; + }; + } : { + totpURI: string; + backupCodes: string[]; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + password: zod.ZodString; + issuer: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + password: string; + issuer?: string | undefined; + }, { + password: string; + issuer?: string | undefined; + }>; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + totpURI: { + type: string; + description: string; + }; + backupCodes: { + type: string; + items: { + type: string; + }; + description: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/enable"; + }; + disableTwoFactor: { + (inputCtx_0: { + body: { + password: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_4 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_4] extends [true] ? { + headers: Headers; + response: { + status: boolean; + }; + } : { + status: boolean; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + password: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + password: string; + }, { + password: string; + }>; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/disable"; + }; + verifyBackupCode: { + (inputCtx_0: { + body: { + code: string; + trustDevice?: boolean | undefined; + disableSession?: boolean | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_5 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_5] extends [true] ? { + headers: Headers; + response: { + token: string | undefined; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }; + } : { + token: string | undefined; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + code: zod.ZodString; + disableSession: zod.ZodOptional; + trustDevice: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + code: string; + trustDevice?: boolean | undefined; + disableSession?: boolean | undefined; + }, { + code: string; + trustDevice?: boolean | undefined; + disableSession?: boolean | undefined; + }>; + metadata: { + openapi: { + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + user: { + type: string; + 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; + }; + twoFactorEnabled: { + type: string; + description: string; + }; + createdAt: { + type: string; + format: string; + description: string; + }; + updatedAt: { + type: string; + format: string; + description: string; + }; + }; + required: string[]; + description: string; + }; + session: { + type: string; + properties: { + token: { + type: string; + description: string; + }; + userId: { + type: string; + description: string; + }; + createdAt: { + type: string; + format: string; + description: string; + }; + expiresAt: { + type: string; + format: string; + description: string; + }; + }; + required: string[]; + description: string; + }; + }; + required: string[]; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/verify-backup-code"; + }; + generateBackupCodes: { + (inputCtx_0: { + body: { + password: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_6 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_6] extends [true] ? { + headers: Headers; + response: { + status: boolean; + backupCodes: string[]; + }; + } : { + status: boolean; + backupCodes: string[]; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + password: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + password: string; + }, { + password: string; + }>; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + metadata: { + openapi: { + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + description: string; + enum: boolean[]; + }; + backupCodes: { + type: string; + items: { + type: string; + }; + description: string; + }; + }; + required: string[]; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/generate-backup-codes"; + }; + viewBackupCodes: { + (inputCtx_0: { + body: { + userId: string; + }; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_7 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_7] extends [true] ? { + headers: Headers; + response: { + status: boolean; + backupCodes: string[]; + }; + } : { + status: boolean; + backupCodes: string[]; + }>; + options: { + method: "GET"; + body: zod.ZodObject<{ + userId: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + userId: string; + }, { + userId: string; + }>; + metadata: { + SERVER_ONLY: true; + }; + } & { + use: any[]; + }; + path: "/two-factor/view-backup-codes"; + }; + sendTwoFactorOTP: { + (inputCtx_0?: ({ + body?: { + trustDevice?: boolean | undefined; + } | undefined; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_8 | undefined; + }) | undefined): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_8] extends [true] ? { + headers: Headers; + response: { + status: boolean; + }; + } : { + status: boolean; + }>; + options: { + method: "POST"; + body: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + trustDevice?: boolean | undefined; + }, { + trustDevice?: boolean | undefined; + }>>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/send-otp"; + }; + verifyTwoFactorOTP: { + (inputCtx_0: { + body: { + code: string; + trustDevice?: boolean | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_9 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_9] extends [true] ? { + headers: Headers; + response: { + token: string; + user: { + id: any; + email: any; + emailVerified: any; + name: any; + image: any; + createdAt: any; + updatedAt: any; + }; + }; + } : { + token: string; + user: { + id: any; + email: any; + emailVerified: any; + name: any; + image: any; + createdAt: any; + updatedAt: any; + }; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + code: zod.ZodString; + trustDevice: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + code: string; + trustDevice?: boolean | undefined; + }, { + code: string; + trustDevice?: boolean | undefined; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + token: { + type: string; + description: string; + }; + user: { + type: string; + 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; + }; + createdAt: { + type: string; + format: string; + description: string; + }; + updatedAt: { + type: string; + format: string; + description: string; + }; + }; + required: string[]; + description: string; + }; + }; + required: string[]; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/verify-otp"; + }; + generateTOTP: { + (inputCtx_0: { + body: { + secret: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_10 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_10] extends [true] ? { + headers: Headers; + response: { + code: string; + }; + } : { + code: string; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + secret: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + secret: string; + }, { + secret: string; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + code: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + SERVER_ONLY: true; + }; + } & { + use: any[]; + }; + path: "/totp/generate"; + }; + getTOTPURI: { + (inputCtx_0: { + body: { + password: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_11 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_11] extends [true] ? { + headers: Headers; + response: { + totpURI: string; + }; + } : { + totpURI: string; + }>; + options: { + method: "POST"; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + body: zod.ZodObject<{ + password: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + password: string; + }, { + password: string; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + totpURI: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/get-totp-uri"; + }; + verifyTOTP: { + (inputCtx_0: { + body: { + code: string; + trustDevice?: boolean | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_12 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_12] extends [true] ? { + headers: Headers; + response: { + token: string; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }; + } : { + token: string; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + code: zod.ZodString; + trustDevice: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + code: string; + trustDevice?: boolean | undefined; + }, { + code: string; + trustDevice?: boolean | undefined; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/verify-totp"; + }; + }; + options: better_auth_plugins.TwoFactorOptions | undefined; + hooks: { + after: { + matcher(context: better_auth.HookEndpointContext): boolean; + handler: (inputContext: better_call.MiddlewareInputContext) => Promise<{ + twoFactorRedirect: boolean; + } | undefined>; + }[]; + }; + schema: { + user: { + fields: { + twoFactorEnabled: { + type: "boolean"; + required: false; + defaultValue: false; + input: false; + }; + }; + }; + twoFactor: { + fields: { + secret: { + type: "string"; + required: true; + returned: false; + }; + backupCodes: { + type: "string"; + required: true; + returned: false; + }; + userId: { + type: "string"; + required: true; + returned: false; + references: { + model: string; + field: string; + }; + }; + }; + }; + }; + rateLimit: { + pathMatcher(path: string): boolean; + window: number; + max: number; + }[]; + $ERROR_CODES: { + readonly OTP_NOT_ENABLED: "OTP not enabled"; + readonly OTP_HAS_EXPIRED: "OTP has expired"; + readonly TOTP_NOT_ENABLED: "TOTP not enabled"; + readonly TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled"; + readonly BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled"; + readonly INVALID_BACKUP_CODE: "Invalid backup code"; + readonly INVALID_CODE: "Invalid code"; + readonly TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: "Too many attempts. Please request a new code."; + readonly INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie"; + }; + } | { + id: "expo"; + init: (ctx: better_auth.AuthContext) => { + options: { + trustedOrigins: string[]; + }; + }; + onRequest(request: Request, ctx: better_auth.AuthContext): Promise<{ + request: Request; + } | undefined>; + hooks: { + after: { + matcher(context: better_auth.HookEndpointContext): boolean; + handler: (inputContext: better_call.MiddlewareInputContext) => Promise; + }[]; + }; + } | { + id: "custom-session"; + endpoints: { + getSession: { + (inputCtx_0: { + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: { + disableCookieCache?: string | boolean | undefined; + disableRefresh?: boolean | undefined; + } | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_13 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_13] extends [true] ? { + headers: Headers; + response: { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined | undefined; + } & { + image: string | null; + handle: string | null; + twoFactorEnabled: boolean | null; + }; + session: { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined | undefined; + userAgent?: string | null | undefined | undefined; + }; + invitation: boolean | { + code: string; + createdAt: Date | null; + usedAt: Date | null; + fromUserId: string; + toUserId: string | null; + } | undefined; + role: "user" | "trial"; + } | null; + } : { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined | undefined; + } & { + image: string | null; + handle: string | null; + twoFactorEnabled: boolean | null; + }; + session: { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined | undefined; + userAgent?: string | null | undefined | undefined; + }; + invitation: boolean | { + code: string; + createdAt: Date | null; + usedAt: Date | null; + fromUserId: string; + toUserId: string | null; + } | undefined; + role: "user" | "trial"; + } | null>; + options: { + method: "GET"; + query: zod.ZodOptional]>>; + disableRefresh: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + disableCookieCache?: boolean | undefined; + disableRefresh?: boolean | undefined; + }, { + disableCookieCache?: string | boolean | undefined; + disableRefresh?: boolean | undefined; + }>>; + metadata: { + CUSTOM_SESSION: boolean; + openapi: { + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "array"; + nullable: boolean; + items: { + $ref: string; + }; + }; + }; + }; + }; + }; + }; + }; + requireHeaders: true; + } & { + use: any[]; + }; + path: "/get-session"; + }; + }; + } | { + id: "customGetProviders"; + endpoints: { + customGetProviders: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_14 | undefined; + }) | undefined): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_14] extends [true] ? { + headers: Headers; + response: any; + } : any>; + options: { + method: "GET"; + } & { + use: any[]; + }; + path: "/get-providers"; + }; + }; + } | { + id: "getAccountInfo"; + endpoints: { + getAccountInfo: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_14 | undefined; + }) | undefined): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_14] extends [true] ? { + headers: Headers; + response: ({ + id: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + }; + accountId?: undefined; + } | { + id: string; + accountId: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + } | undefined; + })[] | null; + } : ({ + id: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + }; + accountId?: undefined; + } | { + id: string; + accountId: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + } | undefined; + })[] | null>; + options: { + method: "GET"; + } & { + use: any[]; + }; + path: "/get-account-info"; + }; + }; + } | { + id: "customUpdateUser"; + endpoints: { + customUpdateUser: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_14 | undefined; + }) | undefined): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_14] extends [true] ? { + headers: Headers; + response: string | null; + } : string | null>; + options: { + method: "POST"; + } & { + use: any[]; + }; + path: "/update-user-ccc"; + }; + }; + } | { + id: "oneTimeToken"; + endpoints: { + generateOneTimeToken: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_14 | undefined; + }) | undefined): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_14] extends [true] ? { + headers: Headers; + response: { + token: string; + }; + } : { + token: string; + }>; + options: { + method: "GET"; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + } & { + use: any[]; + }; + path: "/one-time-token/generate"; + }; + applyOneTimeToken: { + (inputCtx_0: { + body: { + token: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse_1 | undefined; + returnHeaders?: ReturnHeaders_14 | undefined; + }): Promise<[AsResponse_1] extends [true] ? Response : [ReturnHeaders_14] extends [true] ? { + headers: Headers; + response: { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + } & Record; + }; + } : { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + } & Record; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + token: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + token: string; + }, { + token: string; + }>; + } & { + use: any[]; + }; + path: "/one-time-token/apply"; + }; + }; + })[]; + }>> & { name?: string; - image?: string | null; - }>>; + image?: string; + }; } & { method?: "POST" | undefined; } & { @@ -9604,16 +11214,1679 @@ declare const auth: { }>)[]; metadata: { $Infer: { - body: Partial better_auth.Adapter; + advanced: { + generateId: false; + defaultCookieAttributes: { + sameSite: "none"; + secure: true; + }; + }; + session: { + updateAge: number; + expiresIn: number; + }; + basePath: string; + trustedOrigins: string[]; + user: { + additionalFields: { + handle: { + type: "string"; + }; + }; + changeEmail: { + enabled: true; + sendChangeEmailVerification: ({ user, url }: { + user: better_auth.User; + newEmail: string; + url: string; + token: string; + }) => Promise; + }; + }; + account: { + accountLinking: { + enabled: true; + trustedProviders: ("github" | "apple" | "google")[]; + allowDifferentEmails: true; + }; + }; + socialProviders: { + google: { + clientId: string; + clientSecret: string; + }; + github: { + clientId: string; + clientSecret: string; + }; + apple: { + enabled: boolean; + clientId: string; + clientSecret: string; + appBundleIdentifier: string | undefined; + }; + }; + emailAndPassword: { + enabled: true; + sendResetPassword({ user, url }: { + user: better_auth.User; + url: string; + token: string; + }): Promise; + }; + emailVerification: { + sendOnSignUp: true; + sendVerificationEmail({ user, url }: { + user: better_auth.User; + url: string; + token: string; + }): Promise; + }; + plugins: ({ + id: "open-api"; + endpoints: { + generateOpenAPISchema: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + openapi: string; + info: { + title: string; + description: string; + version: string; + }; + components: { + securitySchemes: { + apiKeyCookie: { + type: string; + in: string; + name: string; + description: string; + }; + bearerAuth: { + type: string; + scheme: string; + description: string; + }; + }; + schemas: {}; + }; + security: { + apiKeyCookie: never[]; + bearerAuth: never[]; + }[]; + servers: { + url: string; + }[]; + tags: { + name: string; + description: string; + }[]; + paths: Record; + }; + } : { + openapi: string; + info: { + title: string; + description: string; + version: string; + }; + components: { + securitySchemes: { + apiKeyCookie: { + type: string; + in: string; + name: string; + description: string; + }; + bearerAuth: { + type: string; + scheme: string; + description: string; + }; + }; + schemas: {}; + }; + security: { + apiKeyCookie: never[]; + bearerAuth: never[]; + }[]; + servers: { + url: string; + }[]; + tags: { + name: string; + description: string; + }[]; + paths: Record; + }>; + options: { + method: "GET"; + } & { + use: any[]; + }; + path: "/open-api/generate-schema"; + }; + openAPIReference: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: Response; + } : Response>; + options: { + method: "GET"; + metadata: { + isAction: boolean; + }; + } & { + use: any[]; + }; + path: "/reference"; + }; + }; + } | { + id: "two-factor"; + endpoints: { + enableTwoFactor: { + (inputCtx_0: { + body: { + password: string; + issuer?: string | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + totpURI: string; + backupCodes: string[]; + }; + } : { + totpURI: string; + backupCodes: string[]; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + password: zod.ZodString; + issuer: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + password: string; + issuer?: string | undefined; + }, { + password: string; + issuer?: string | undefined; + }>; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + totpURI: { + type: string; + description: string; + }; + backupCodes: { + type: string; + items: { + type: string; + }; + description: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/enable"; + }; + disableTwoFactor: { + (inputCtx_0: { + body: { + password: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + status: boolean; + }; + } : { + status: boolean; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + password: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + password: string; + }, { + password: string; + }>; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/disable"; + }; + verifyBackupCode: { + (inputCtx_0: { + body: { + code: string; + trustDevice?: boolean | undefined; + disableSession?: boolean | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + token: string | undefined; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }; + } : { + token: string | undefined; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + code: zod.ZodString; + disableSession: zod.ZodOptional; + trustDevice: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + code: string; + trustDevice?: boolean | undefined; + disableSession?: boolean | undefined; + }, { + code: string; + trustDevice?: boolean | undefined; + disableSession?: boolean | undefined; + }>; + metadata: { + openapi: { + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + user: { + type: string; + 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; + }; + twoFactorEnabled: { + type: string; + description: string; + }; + createdAt: { + type: string; + format: string; + description: string; + }; + updatedAt: { + type: string; + format: string; + description: string; + }; + }; + required: string[]; + description: string; + }; + session: { + type: string; + properties: { + token: { + type: string; + description: string; + }; + userId: { + type: string; + description: string; + }; + createdAt: { + type: string; + format: string; + description: string; + }; + expiresAt: { + type: string; + format: string; + description: string; + }; + }; + required: string[]; + description: string; + }; + }; + required: string[]; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/verify-backup-code"; + }; + generateBackupCodes: { + (inputCtx_0: { + body: { + password: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + status: boolean; + backupCodes: string[]; + }; + } : { + status: boolean; + backupCodes: string[]; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + password: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + password: string; + }, { + password: string; + }>; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + metadata: { + openapi: { + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + description: string; + enum: boolean[]; + }; + backupCodes: { + type: string; + items: { + type: string; + }; + description: string; + }; + }; + required: string[]; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/generate-backup-codes"; + }; + viewBackupCodes: { + (inputCtx_0: { + body: { + userId: string; + }; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + status: boolean; + backupCodes: string[]; + }; + } : { + status: boolean; + backupCodes: string[]; + }>; + options: { + method: "GET"; + body: zod.ZodObject<{ + userId: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + userId: string; + }, { + userId: string; + }>; + metadata: { + SERVER_ONLY: true; + }; + } & { + use: any[]; + }; + path: "/two-factor/view-backup-codes"; + }; + sendTwoFactorOTP: { + (inputCtx_0?: ({ + body?: { + trustDevice?: boolean | undefined; + } | undefined; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + status: boolean; + }; + } : { + status: boolean; + }>; + options: { + method: "POST"; + body: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + trustDevice?: boolean | undefined; + }, { + trustDevice?: boolean | undefined; + }>>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/send-otp"; + }; + verifyTwoFactorOTP: { + (inputCtx_0: { + body: { + code: string; + trustDevice?: boolean | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + token: string; + user: { + id: any; + email: any; + emailVerified: any; + name: any; + image: any; + createdAt: any; + updatedAt: any; + }; + }; + } : { + token: string; + user: { + id: any; + email: any; + emailVerified: any; + name: any; + image: any; + createdAt: any; + updatedAt: any; + }; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + code: zod.ZodString; + trustDevice: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + code: string; + trustDevice?: boolean | undefined; + }, { + code: string; + trustDevice?: boolean | undefined; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + token: { + type: string; + description: string; + }; + user: { + type: string; + 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; + }; + createdAt: { + type: string; + format: string; + description: string; + }; + updatedAt: { + type: string; + format: string; + description: string; + }; + }; + required: string[]; + description: string; + }; + }; + required: string[]; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/verify-otp"; + }; + generateTOTP: { + (inputCtx_0: { + body: { + secret: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + code: string; + }; + } : { + code: string; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + secret: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + secret: string; + }, { + secret: string; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + code: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + SERVER_ONLY: true; + }; + } & { + use: any[]; + }; + path: "/totp/generate"; + }; + getTOTPURI: { + (inputCtx_0: { + body: { + password: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + totpURI: string; + }; + } : { + totpURI: string; + }>; + options: { + method: "POST"; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + body: zod.ZodObject<{ + password: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + password: string; + }, { + password: string; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + totpURI: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/get-totp-uri"; + }; + verifyTOTP: { + (inputCtx_0: { + body: { + code: string; + trustDevice?: boolean | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + token: string; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }; + } : { + token: string; + user: { + id: string; + email: string; + emailVerified: boolean; + name: string; + image: string | null | undefined; + createdAt: Date; + updatedAt: Date; + }; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + code: zod.ZodString; + trustDevice: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + code: string; + trustDevice?: boolean | undefined; + }, { + code: string; + trustDevice?: boolean | undefined; + }>; + metadata: { + openapi: { + summary: string; + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + status: { + type: string; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/two-factor/verify-totp"; + }; + }; + options: better_auth_plugins.TwoFactorOptions | undefined; + hooks: { + after: { + matcher(context: better_auth.HookEndpointContext): boolean; + handler: (inputContext: better_call.MiddlewareInputContext) => Promise<{ + twoFactorRedirect: boolean; + } | undefined>; + }[]; + }; + schema: { + user: { + fields: { + twoFactorEnabled: { + type: "boolean"; + required: false; + defaultValue: false; + input: false; + }; + }; + }; + twoFactor: { + fields: { + secret: { + type: "string"; + required: true; + returned: false; + }; + backupCodes: { + type: "string"; + required: true; + returned: false; + }; + userId: { + type: "string"; + required: true; + returned: false; + references: { + model: string; + field: string; + }; + }; + }; + }; + }; + rateLimit: { + pathMatcher(path: string): boolean; + window: number; + max: number; + }[]; + $ERROR_CODES: { + readonly OTP_NOT_ENABLED: "OTP not enabled"; + readonly OTP_HAS_EXPIRED: "OTP has expired"; + readonly TOTP_NOT_ENABLED: "TOTP not enabled"; + readonly TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled"; + readonly BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled"; + readonly INVALID_BACKUP_CODE: "Invalid backup code"; + readonly INVALID_CODE: "Invalid code"; + readonly TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: "Too many attempts. Please request a new code."; + readonly INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie"; + }; + } | { + id: "expo"; + init: (ctx: better_auth.AuthContext) => { + options: { + trustedOrigins: string[]; + }; + }; + onRequest(request: Request, ctx: better_auth.AuthContext): Promise<{ + request: Request; + } | undefined>; + hooks: { + after: { + matcher(context: better_auth.HookEndpointContext): boolean; + handler: (inputContext: better_call.MiddlewareInputContext) => Promise; + }[]; + }; + } | { + id: "custom-session"; + endpoints: { + getSession: { + (inputCtx_0: { + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: { + disableCookieCache?: string | boolean | undefined; + disableRefresh?: boolean | undefined; + } | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined | undefined; + } & { + image: string | null; + handle: string | null; + twoFactorEnabled: boolean | null; + }; + session: { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined | undefined; + userAgent?: string | null | undefined | undefined; + }; + invitation: boolean | { + code: string; + createdAt: Date | null; + usedAt: Date | null; + fromUserId: string; + toUserId: string | null; + } | undefined; + role: "user" | "trial"; + } | null; + } : { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined | undefined; + } & { + image: string | null; + handle: string | null; + twoFactorEnabled: boolean | null; + }; + session: { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined | undefined; + userAgent?: string | null | undefined | undefined; + }; + invitation: boolean | { + code: string; + createdAt: Date | null; + usedAt: Date | null; + fromUserId: string; + toUserId: string | null; + } | undefined; + role: "user" | "trial"; + } | null>; + options: { + method: "GET"; + query: zod.ZodOptional]>>; + disableRefresh: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + disableCookieCache?: boolean | undefined; + disableRefresh?: boolean | undefined; + }, { + disableCookieCache?: string | boolean | undefined; + disableRefresh?: boolean | undefined; + }>>; + metadata: { + CUSTOM_SESSION: boolean; + openapi: { + description: string; + responses: { + "200": { + description: string; + content: { + "application/json": { + schema: { + type: "array"; + nullable: boolean; + items: { + $ref: string; + }; + }; + }; + }; + }; + }; + }; + }; + requireHeaders: true; + } & { + use: any[]; + }; + path: "/get-session"; + }; + }; + } | { + id: "customGetProviders"; + endpoints: { + customGetProviders: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: any; + } : any>; + options: { + method: "GET"; + } & { + use: any[]; + }; + path: "/get-providers"; + }; + }; + } | { + id: "getAccountInfo"; + endpoints: { + getAccountInfo: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: ({ + id: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + }; + accountId?: undefined; + } | { + id: string; + accountId: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + } | undefined; + })[] | null; + } : ({ + id: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + }; + accountId?: undefined; + } | { + id: string; + accountId: string; + provider: string; + profile: { + id: string; + name?: string; + email?: string | null; + image?: string; + emailVerified: boolean; + } | undefined; + })[] | null>; + options: { + method: "GET"; + } & { + use: any[]; + }; + path: "/get-account-info"; + }; + }; + } | { + id: "customUpdateUser"; + endpoints: { + customUpdateUser: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: string | null; + } : string | null>; + options: { + method: "POST"; + } & { + use: any[]; + }; + path: "/update-user-ccc"; + }; + }; + } | { + id: "oneTimeToken"; + endpoints: { + generateOneTimeToken: { + (inputCtx_0?: ({ + body?: undefined; + } & { + method?: "GET" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + token: string; + }; + } : { + token: string; + }>; + options: { + method: "GET"; + use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ + session: { + session: Record & { + id: string; + createdAt: Date; + updatedAt: Date; + userId: string; + expiresAt: Date; + token: string; + ipAddress?: string | null | undefined; + userAgent?: string | null | undefined; + }; + user: Record & { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + }; + }; + }>)[]; + } & { + use: any[]; + }; + path: "/one-time-token/generate"; + }; + applyOneTimeToken: { + (inputCtx_0: { + body: { + token: string; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + } & Record; + }; + } : { + user: { + id: string; + name: string; + email: string; + emailVerified: boolean; + createdAt: Date; + updatedAt: Date; + image?: string | null | undefined; + } & Record; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + token: zod.ZodString; + }, "strip", zod.ZodTypeAny, { + token: string; + }, { + token: string; + }>; + } & { + use: any[]; + }; + path: "/one-time-token/apply"; + }; + }; + })[]; + }>> & { name?: string; - image?: string | null; - }>>; + image?: string; + }; }; openapi: { description: string; @@ -10693,6 +13966,107 @@ declare const auth: { }; path: "/refresh-token"; }; + getAccessToken: { + (inputCtx_0: { + body: { + providerId: string; + accountId?: string | undefined; + userId?: string | undefined; + }; + } & { + method?: "POST" | undefined; + } & { + query?: Record | undefined; + } & { + params?: Record; + } & { + request?: Request; + } & { + headers?: HeadersInit; + } & { + asResponse?: boolean; + returnHeaders?: boolean; + use?: better_call.Middleware[]; + path?: string; + } & { + asResponse?: AsResponse | undefined; + returnHeaders?: ReturnHeaders | undefined; + }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { + headers: Headers; + response: { + accessToken: string | undefined; + accessTokenExpiresAt: Date | undefined; + scopes: string[]; + idToken: string | undefined; + }; + } : { + accessToken: string | undefined; + accessTokenExpiresAt: Date | undefined; + scopes: string[]; + idToken: string | undefined; + }>; + options: { + method: "POST"; + body: zod.ZodObject<{ + providerId: zod.ZodString; + accountId: zod.ZodOptional; + userId: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + providerId: string; + accountId?: string | undefined; + userId?: string | undefined; + }, { + providerId: string; + accountId?: string | undefined; + userId?: string | undefined; + }>; + metadata: { + openapi: { + description: string; + responses: { + 200: { + description: string; + content: { + "application/json": { + schema: { + type: "object"; + properties: { + tokenType: { + type: string; + }; + idToken: { + type: string; + }; + accessToken: { + type: string; + }; + refreshToken: { + type: string; + }; + accessTokenExpiresAt: { + type: string; + format: string; + }; + refreshTokenExpiresAt: { + type: string; + format: string; + }; + }; + }; + }; + }; + }; + 400: { + description: string; + }; + }; + }; + }; + } & { + use: any[]; + }; + path: "/get-access-token"; + }; } & { generateOpenAPISchema: { (inputCtx_0?: ({ @@ -11095,45 +14469,6 @@ declare const auth: { }; path: "/one-time-token/apply"; }; - } & { - customCreateSession: { - (inputCtx_0?: ({ - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - ck: string; - userId: string; - } | null; - } : { - ck: string; - userId: string; - } | null>; - options: { - method: "GET"; - } & { - use: any[]; - }; - path: "/create-session"; - }; } & { enableTwoFactor: { (inputCtx_0: { @@ -13901,48 +17236,6 @@ declare const auth: { path: "/one-time-token/apply"; }; }; - } | { - id: "customCreateSession"; - endpoints: { - customCreateSession: { - (inputCtx_0?: ({ - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - ck: string; - userId: string; - } | null; - } : { - ck: string; - userId: string; - } | null>; - options: { - method: "GET"; - } & { - use: any[]; - }; - path: "/create-session"; - }; - }; })[]; }; $context: Promise; @@ -14887,6 +18180,7 @@ declare const _routes: hono_hono_base.HonoBase | hono_types.MergeSchemaPath<{ "/configs": { $get: { @@ -17071,9 +20386,21 @@ declare const _routes: hono_hono_base.HonoBase, "/">; type AppType = typeof _routes; -export { type ActionItem, type ActionsModel, type AirdropActivity, type AppType, type AttachmentsModel, type AuthSession, type AuthUser, CommonEntryFields, type ConditionItem, type DetailModel, type EntriesModel, type ExtraModel, type FeedModel, type ListModel, type MediaModel, type MessagingData, MessagingType, type SettingsModel, type UrlReadsModel, account, achievements, achievementsOpenAPISchema, actions, actionsItemOpenAPISchema, actionsOpenAPISchema, actionsRelations, activityEnum, airdrops, airdropsOpenAPISchema, attachmentsZodSchema, authPlugins, boosts, captcha, collections, collectionsOpenAPISchema, collectionsRelations, detailModelSchema, entries, entriesOpenAPISchema, entriesRelations, extraZodSchema, feedAnalytics, feedAnalyticsOpenAPISchema, feedAnalyticsRelations, feedPowerTokens, feedPowerTokensOpenAPISchema, feedPowerTokensRelations, feeds, feedsOpenAPISchema, feedsRelations, inboxHandleSchema, inboxes, inboxesEntries, inboxesEntriesInsertOpenAPISchema, type inboxesEntriesModel, inboxesEntriesOpenAPISchema, inboxesEntriesRelations, inboxesOpenAPISchema, inboxesRelations, invitations, invitationsOpenAPISchema, invitationsRelations, languageSchema, levels, levelsOpenAPISchema, levelsRelations, lists, listsOpenAPISchema, listsRelations, listsSubscriptions, listsSubscriptionsOpenAPISchema, listsSubscriptionsRelations, lower, mediaZodSchema, messaging, messagingOpenAPISchema, messagingRelations, readabilities, rsshub, rsshubAnalytics, rsshubAnalyticsOpenAPISchema, rsshubOpenAPISchema, rsshubPurchase, rsshubUsage, rsshubUsageOpenAPISchema, rsshubUsageRelations, session, settings, subscriptions, subscriptionsOpenAPISchema, subscriptionsRelations, timeline, timelineOpenAPISchema, timelineRelations, transactionType, transactions, transactionsOpenAPISchema, transactionsRelations, trendingFeeds, trendingFeedsOpenAPISchema, trendingFeedsRelations, twoFactor, uploads, urlReads, urlReadsOpenAPISchema, user, users, usersOpenApiSchema, usersRelations, verification, wallets, walletsOpenAPISchema, walletsRelations }; +export { type ActionItem, type ActionsModel, type AirdropActivity, type AppType, type AttachmentsModel, type AuthSession, type AuthUser, CommonEntryFields, type ConditionItem, type DetailModel, type EntriesModel, type ExtraModel, type FeedModel, type ListModel, type MediaModel, type MessagingData, MessagingType, type SettingsModel, type UrlReadsModel, account, achievements, achievementsOpenAPISchema, actions, actionsItemOpenAPISchema, actionsOpenAPISchema, actionsRelations, activityEnum, airdrops, airdropsOpenAPISchema, attachmentsZodSchema, authPlugins, boosts, captcha, collections, collectionsOpenAPISchema, collectionsRelations, detailModelSchema, entries, entriesOpenAPISchema, entriesRelations, extraZodSchema, feedAnalytics, feedAnalyticsOpenAPISchema, feedAnalyticsRelations, feedPowerTokens, feedPowerTokensOpenAPISchema, feedPowerTokensRelations, feeds, feedsOpenAPISchema, feedsRelations, inboxHandleSchema, inboxes, inboxesEntries, inboxesEntriesInsertOpenAPISchema, type inboxesEntriesModel, inboxesEntriesOpenAPISchema, inboxesEntriesRelations, inboxesOpenAPISchema, inboxesRelations, invitations, invitationsOpenAPISchema, invitationsRelations, languageSchema, levels, levelsOpenAPISchema, levelsRelations, listAnalytics, listAnalyticsOpenAPISchema, listAnalyticsRelations, lists, listsOpenAPISchema, listsRelations, listsSubscriptions, listsSubscriptionsOpenAPISchema, listsSubscriptionsRelations, lower, mediaZodSchema, messaging, messagingOpenAPISchema, messagingRelations, readabilities, rsshub, rsshubAnalytics, rsshubAnalyticsOpenAPISchema, rsshubOpenAPISchema, rsshubPurchase, rsshubUsage, rsshubUsageOpenAPISchema, rsshubUsageRelations, session, settings, subscriptions, subscriptionsOpenAPISchema, subscriptionsRelations, timeline, timelineOpenAPISchema, timelineRelations, transactionType, transactions, transactionsOpenAPISchema, transactionsRelations, trendingFeeds, trendingFeedsOpenAPISchema, trendingFeedsRelations, twoFactor, uploads, urlReads, urlReadsOpenAPISchema, user, users, usersOpenApiSchema, usersRelations, verification, wallets, walletsOpenAPISchema, walletsRelations };