@pithy-sh/auth 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/users.d.ts +155 -0
- package/dist/admin/users.d.ts.map +1 -0
- package/dist/admin/users.js +205 -0
- package/dist/audit/actions.d.ts +66 -0
- package/dist/audit/actions.d.ts.map +1 -0
- package/dist/audit/actions.js +66 -0
- package/dist/audit/emit.d.ts +101 -0
- package/dist/audit/emit.d.ts.map +1 -0
- package/dist/audit/emit.js +170 -0
- package/dist/capability.d.ts +60 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +169 -0
- package/dist/client/api.d.ts +299 -0
- package/dist/client/api.d.ts.map +1 -0
- package/dist/client/api.js +385 -0
- package/dist/client/projection.d.ts +51 -0
- package/dist/client/projection.d.ts.map +1 -0
- package/dist/client/projection.js +0 -0
- package/dist/data/betterAuth.d.ts +75 -0
- package/dist/data/betterAuth.d.ts.map +1 -0
- package/dist/data/betterAuth.js +92 -0
- package/dist/data/device.d.ts +36 -0
- package/dist/data/device.d.ts.map +1 -0
- package/dist/data/device.js +33 -0
- package/dist/data/kitFields.d.ts +78 -0
- package/dist/data/kitFields.d.ts.map +1 -0
- package/dist/data/kitFields.js +77 -0
- package/dist/data/rotatedToken.d.ts +20 -0
- package/dist/data/rotatedToken.d.ts.map +1 -0
- package/dist/data/rotatedToken.js +22 -0
- package/dist/data/tables.d.ts +104 -0
- package/dist/data/tables.d.ts.map +1 -0
- package/dist/data/tables.js +30 -0
- package/dist/device/registry.d.ts +54 -0
- package/dist/device/registry.d.ts.map +1 -0
- package/dist/device/registry.js +85 -0
- package/dist/email/send.d.ts +38 -0
- package/dist/email/send.d.ts.map +1 -0
- package/dist/email/send.js +48 -0
- package/dist/http/adminRoutes.d.ts +9 -0
- package/dist/http/adminRoutes.d.ts.map +1 -0
- package/dist/http/adminRoutes.js +274 -0
- package/dist/http/baseUrl.d.ts +41 -0
- package/dist/http/baseUrl.d.ts.map +1 -0
- package/dist/http/baseUrl.js +96 -0
- package/dist/http/csrf.d.ts +18 -0
- package/dist/http/csrf.d.ts.map +1 -0
- package/dist/http/csrf.js +81 -0
- package/dist/http/devLoginRoute.d.ts +42 -0
- package/dist/http/devLoginRoute.d.ts.map +1 -0
- package/dist/http/devLoginRoute.js +112 -0
- package/dist/http/errors.d.ts +24 -0
- package/dist/http/errors.d.ts.map +1 -0
- package/dist/http/errors.js +67 -0
- package/dist/http/guards.d.ts +103 -0
- package/dist/http/guards.d.ts.map +1 -0
- package/dist/http/guards.js +148 -0
- package/dist/http/middleware.d.ts +17 -0
- package/dist/http/middleware.d.ts.map +1 -0
- package/dist/http/middleware.js +47 -0
- package/dist/http/rateLimit.d.ts +17 -0
- package/dist/http/rateLimit.d.ts.map +1 -0
- package/dist/http/rateLimit.js +31 -0
- package/dist/http/resolve.d.ts +9 -0
- package/dist/http/resolve.d.ts.map +1 -0
- package/dist/http/resolve.js +92 -0
- package/dist/http/responses.d.ts +152 -0
- package/dist/http/responses.d.ts.map +1 -0
- package/dist/http/responses.js +121 -0
- package/dist/http/routes.d.ts +34 -0
- package/dist/http/routes.d.ts.map +1 -0
- package/dist/http/routes.js +268 -0
- package/dist/http/schemas.d.ts +66 -0
- package/dist/http/schemas.d.ts.map +1 -0
- package/dist/http/schemas.js +59 -0
- package/dist/http/views.d.ts +53 -0
- package/dist/http/views.d.ts.map +1 -0
- package/dist/http/views.js +86 -0
- package/dist/i18n/errorCopy.d.ts +24 -0
- package/dist/i18n/errorCopy.d.ts.map +1 -0
- package/dist/i18n/errorCopy.es.d.ts +31 -0
- package/dist/i18n/errorCopy.es.d.ts.map +1 -0
- package/dist/i18n/errorCopy.es.js +33 -0
- package/dist/i18n/errorCopy.js +91 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/instance/auth.d.ts +1122 -0
- package/dist/instance/auth.d.ts.map +1 -0
- package/dist/instance/auth.js +176 -0
- package/dist/instance/plugins.d.ts +87 -0
- package/dist/instance/plugins.d.ts.map +1 -0
- package/dist/instance/plugins.js +116 -0
- package/dist/instance/providers.d.ts +117 -0
- package/dist/instance/providers.d.ts.map +1 -0
- package/dist/instance/providers.js +111 -0
- package/dist/instance/secrets.d.ts +163 -0
- package/dist/instance/secrets.d.ts.map +1 -0
- package/dist/instance/secrets.js +169 -0
- package/dist/migrations/0001_init.d.ts +33 -0
- package/dist/migrations/0001_init.d.ts.map +1 -0
- package/dist/migrations/0001_init.js +77 -0
- package/dist/migrations/pluginTables.d.ts +126 -0
- package/dist/migrations/pluginTables.d.ts.map +1 -0
- package/dist/migrations/pluginTables.js +233 -0
- package/dist/seeds/devSession.d.ts +124 -0
- package/dist/seeds/devSession.d.ts.map +1 -0
- package/dist/seeds/devSession.js +211 -0
- package/dist/seeds/example.d.ts +12 -0
- package/dist/seeds/example.d.ts.map +1 -0
- package/dist/seeds/example.js +30 -0
- package/dist/test-utils/liveApp.d.ts +227 -0
- package/dist/test-utils/liveApp.d.ts.map +1 -0
- package/dist/test-utils/liveApp.js +240 -0
- package/dist/token/rotation.d.ts +56 -0
- package/dist/token/rotation.d.ts.map +1 -0
- package/dist/token/rotation.js +68 -0
- package/dist/version.generated.d.ts +5 -0
- package/dist/version.generated.d.ts.map +1 -0
- package/dist/version.generated.js +7 -0
- package/package.json +24 -13
- package/src/version.generated.ts +1 -1
|
@@ -0,0 +1,1122 @@
|
|
|
1
|
+
import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
|
|
2
|
+
import { type BetterAuthPlugin } from "better-auth";
|
|
3
|
+
import type { AuthDatabase } from "../data/tables";
|
|
4
|
+
import { type ResolvedProviders } from "./providers";
|
|
5
|
+
/**
|
|
6
|
+
* Build the `socialProviders` block from whichever provider credentials were resolved. Exported so the
|
|
7
|
+
* per-provider branch matrix is unit-testable without constructing a Better Auth instance — it reads
|
|
8
|
+
* only the resolved credentials on `deps`, never the database.
|
|
9
|
+
*
|
|
10
|
+
* **Only a `ready` provider is registered.** A `disabled` one never was; an `unresolvable` one is the
|
|
11
|
+
* change #381 made, and it is what keeps magic link and OTP working while one credential is unreadable.
|
|
12
|
+
* The narrowing is the type's doing rather than this function's discipline — `deps.google.credentials`
|
|
13
|
+
* does not exist until `state === "ready"` has been established.
|
|
14
|
+
*/
|
|
15
|
+
export declare function socialProviders(deps: AuthInstanceDeps): Record<string, unknown> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The seeding guard: a new account may be created only for an email a provider has **verified**.
|
|
18
|
+
*
|
|
19
|
+
* Passwordless sign-up (magic link / OTP) always creates `emailVerified: true`; a social sign-up
|
|
20
|
+
* carries the provider's own flag. Refusing an unverified-email create closes the rival-account
|
|
21
|
+
* seeding vector — otherwise an untrusted provider (e.g. a GitHub account holding an *unverified*
|
|
22
|
+
* email at someone else's address) could mint a row that a later magic-link login by the true owner
|
|
23
|
+
* would inherit. Returns `true` when the create must be refused. Account *linking* into an existing
|
|
24
|
+
* user is handled separately by Better Auth's `trustedProviders` gate; this only guards creation.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isUnverifiedSignup(user: {
|
|
27
|
+
emailVerified?: boolean | null;
|
|
28
|
+
}): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* What the instance hands to Pithy's email seam to deliver. The route never sends inline — the hook
|
|
31
|
+
* enqueues an `@pithy-sh/email` job (`magicLink`/`otp` template) which a Workflow delivers.
|
|
32
|
+
*/
|
|
33
|
+
export type AuthEmailMessage = {
|
|
34
|
+
to: string;
|
|
35
|
+
template: "magicLink";
|
|
36
|
+
token: string;
|
|
37
|
+
url: string;
|
|
38
|
+
} | {
|
|
39
|
+
to: string;
|
|
40
|
+
template: "otp";
|
|
41
|
+
code: string;
|
|
42
|
+
};
|
|
43
|
+
/** The email-delivery seam: enqueue (never send inline). Injected so the instance stays I/O-agnostic. */
|
|
44
|
+
export type SendAuthEmail = (message: AuthEmailMessage) => Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Everything the Better-Auth instance needs, resolved per invocation from config + request env.
|
|
47
|
+
*
|
|
48
|
+
* Generic in the adopter's plugin tuple so the composed instance's type — and therefore its `$Infer`
|
|
49
|
+
* surface — reflects what was actually composed rather than only the kit's own.
|
|
50
|
+
*/
|
|
51
|
+
export interface AuthInstanceDeps<Plugins extends readonly BetterAuthPlugin[] = readonly BetterAuthPlugin[]> extends ResolvedProviders {
|
|
52
|
+
/** The shared Kysely over the `pithy_auth_*` tables (carries `CamelCasePlugin`). */
|
|
53
|
+
db: AuthDatabase;
|
|
54
|
+
/** The Better-Auth signing/encryption secret, sourced from `@pithy-sh/secrets`. */
|
|
55
|
+
secret: string;
|
|
56
|
+
/** The public base URL of this environment's auth worker (no trailing slash). */
|
|
57
|
+
baseURL: string;
|
|
58
|
+
/** The mount path; must equal the Hono route the handler is mounted under. */
|
|
59
|
+
basePath: string;
|
|
60
|
+
/** Web origins and mobile deep-link schemes allowed as OAuth/redirect targets and for CSRF origin checks. */
|
|
61
|
+
trustedOrigins: string[];
|
|
62
|
+
/** Deliver a magic link or OTP. Enqueues an email job; never sends inline. */
|
|
63
|
+
sendEmail: SendAuthEmail;
|
|
64
|
+
/**
|
|
65
|
+
* The catalog locale this request negotiated, or `null` when nothing did.
|
|
66
|
+
*
|
|
67
|
+
* Threaded through to the translator plugin, which is what puts Better Auth's own refusals in the
|
|
68
|
+
* reader's language (#452). An instance is built per request, so this is that request's locale.
|
|
69
|
+
*/
|
|
70
|
+
locale?: string | null;
|
|
71
|
+
/** Session lifetime in seconds. */
|
|
72
|
+
sessionExpiresIn: number;
|
|
73
|
+
/** How often (seconds) an active session's expiry slides forward. */
|
|
74
|
+
sessionUpdateAge: number;
|
|
75
|
+
/** Magic-link / OTP token lifetime in seconds. */
|
|
76
|
+
verificationExpiresIn: number;
|
|
77
|
+
/** OTP length (digits). */
|
|
78
|
+
otpLength: number;
|
|
79
|
+
/** When true, sign-in never provisions a new user (existing accounts only). */
|
|
80
|
+
disableSignUp: boolean;
|
|
81
|
+
/** Audit seam — emits `auth/*` events. A no-op when the audit capability is absent. */
|
|
82
|
+
emit: AuditEmit;
|
|
83
|
+
/**
|
|
84
|
+
* The adopter's additional Better Auth plugins, from `auth({ plugins: [...] })`. Composed **after**
|
|
85
|
+
* the kit's own, never in place of one — `assertAdditivePlugins` has already refused a list that
|
|
86
|
+
* names one of them.
|
|
87
|
+
*/
|
|
88
|
+
plugins: Plugins;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The concrete return type of `makeAuth` — the Better-Auth instance with Pithy's plugin set, and the
|
|
92
|
+
* adopter's on top of it.
|
|
93
|
+
*
|
|
94
|
+
* Parameterized in the plugin tuple so an adopter can name the instance their own composition produces:
|
|
95
|
+
* `AuthInstance<[ReturnType<typeof organization>]>`. That is the type
|
|
96
|
+
* `inferAdditionalFields<…>()` needs on the client, and the reason the plugin tuple is threaded through
|
|
97
|
+
* `makeAuth` rather than widened to `BetterAuthPlugin[]` at the door.
|
|
98
|
+
*/
|
|
99
|
+
export type AuthInstance<Plugins extends readonly BetterAuthPlugin[] = readonly BetterAuthPlugin[]> = ReturnType<typeof makeAuth<Plugins>>;
|
|
100
|
+
/**
|
|
101
|
+
* Build the Better-Auth instance for one request.
|
|
102
|
+
*
|
|
103
|
+
* Passwordless only — `emailAndPassword` is never enabled. The Kysely adapter wraps our shared
|
|
104
|
+
* `CamelCasePlugin` instance, so Better Auth's camelCase model names + fields map to the snake_case
|
|
105
|
+
* `pithy_auth_*` columns the migration created. Dates are ISO-8601 text on SQLite; ids are WebCrypto
|
|
106
|
+
* UUIDs; rate limiting is durable (D1-backed) since memory limiting is per-isolate on Workers.
|
|
107
|
+
*/
|
|
108
|
+
export declare function makeAuth<const Plugins extends readonly BetterAuthPlugin[]>(deps: AuthInstanceDeps<Plugins>): import("better-auth").Auth<{
|
|
109
|
+
appName: string;
|
|
110
|
+
baseURL: string;
|
|
111
|
+
basePath: string;
|
|
112
|
+
secret: string;
|
|
113
|
+
telemetry: {
|
|
114
|
+
enabled: false;
|
|
115
|
+
};
|
|
116
|
+
trustedOrigins: string[];
|
|
117
|
+
database: {
|
|
118
|
+
db: AuthDatabase;
|
|
119
|
+
type: string;
|
|
120
|
+
transaction: boolean;
|
|
121
|
+
};
|
|
122
|
+
advanced: {
|
|
123
|
+
database: {
|
|
124
|
+
generateId: () => string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
onAPIError: {
|
|
128
|
+
throw: true;
|
|
129
|
+
};
|
|
130
|
+
databaseHooks: {
|
|
131
|
+
user: {
|
|
132
|
+
create: {
|
|
133
|
+
before: (user: {
|
|
134
|
+
id: string;
|
|
135
|
+
createdAt: Date;
|
|
136
|
+
updatedAt: Date;
|
|
137
|
+
email: string;
|
|
138
|
+
emailVerified: boolean;
|
|
139
|
+
name: string;
|
|
140
|
+
image?: string | null | undefined;
|
|
141
|
+
} & Record<string, unknown>) => Promise<void>;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
session: {
|
|
145
|
+
create: {
|
|
146
|
+
before: (session: {
|
|
147
|
+
id: string;
|
|
148
|
+
createdAt: Date;
|
|
149
|
+
updatedAt: Date;
|
|
150
|
+
userId: string;
|
|
151
|
+
expiresAt: Date;
|
|
152
|
+
token: string;
|
|
153
|
+
ipAddress?: string | null | undefined;
|
|
154
|
+
userAgent?: string | null | undefined;
|
|
155
|
+
} & Record<string, unknown>, ctx: import("better-auth").GenericEndpointContext | null) => Promise<{
|
|
156
|
+
data: {
|
|
157
|
+
id: string;
|
|
158
|
+
createdAt: Date;
|
|
159
|
+
updatedAt: Date;
|
|
160
|
+
userId: string;
|
|
161
|
+
expiresAt: Date;
|
|
162
|
+
token: string;
|
|
163
|
+
ipAddress?: string | null | undefined;
|
|
164
|
+
userAgent?: string | null | undefined;
|
|
165
|
+
deviceId: string;
|
|
166
|
+
};
|
|
167
|
+
} | undefined>;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
hooks: {
|
|
172
|
+
/**
|
|
173
|
+
* Refuse a provider this deployment enables and could not resolve, before Better Auth answers it
|
|
174
|
+
* with the 404 it gives a provider nobody configured (#381).
|
|
175
|
+
*
|
|
176
|
+
* **This is what makes degrading not the same as degrading quietly.** The instance was built
|
|
177
|
+
* without the provider, so `socialProviders` does not hold it, so `sign-in/social` would throw
|
|
178
|
+
* `PROVIDER_NOT_FOUND` — a 404 that tells somebody who signs in with GitHub every day that
|
|
179
|
+
* GitHub was never set up. It is the same answer for a fault and for a choice, and the two are
|
|
180
|
+
* not the same fact. This hook answers 503 with its own code instead, and records the attempt.
|
|
181
|
+
*
|
|
182
|
+
* **A `before` hook rather than a Hono route, and that is forced rather than preferred.** The
|
|
183
|
+
* provider is in the request *body*, and the body is Better Auth's to read: a Hono handler ahead
|
|
184
|
+
* of the catch-all would have to consume the stream that the catch-all then hands to
|
|
185
|
+
* `instance.handler(c.req.raw)`. Here the body is already parsed against the endpoint's own
|
|
186
|
+
* schema, and this reads one field out of it.
|
|
187
|
+
*/
|
|
188
|
+
before: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
|
|
189
|
+
after: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
|
|
190
|
+
};
|
|
191
|
+
rateLimit: {
|
|
192
|
+
enabled: true;
|
|
193
|
+
storage: "database";
|
|
194
|
+
modelName: "pithyAuthRateLimit";
|
|
195
|
+
};
|
|
196
|
+
user: {
|
|
197
|
+
modelName: "pithyAuthUsers";
|
|
198
|
+
additionalFields: {
|
|
199
|
+
readonly locale: {
|
|
200
|
+
readonly type: "string";
|
|
201
|
+
readonly required: false;
|
|
202
|
+
readonly input: true;
|
|
203
|
+
readonly validator: {
|
|
204
|
+
readonly input: import("zod").ZodNullable<import("zod").ZodString>;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
session: {
|
|
210
|
+
modelName: "pithyAuthSessions";
|
|
211
|
+
expiresIn: number;
|
|
212
|
+
updateAge: number;
|
|
213
|
+
additionalFields: {
|
|
214
|
+
readonly deviceId: {
|
|
215
|
+
readonly type: "string";
|
|
216
|
+
readonly required: false;
|
|
217
|
+
readonly input: false;
|
|
218
|
+
};
|
|
219
|
+
readonly familyId: {
|
|
220
|
+
readonly type: "string";
|
|
221
|
+
readonly required: false;
|
|
222
|
+
readonly input: false;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
account: {
|
|
227
|
+
modelName: "pithyAuthAccounts";
|
|
228
|
+
accountLinking: {
|
|
229
|
+
enabled: true;
|
|
230
|
+
trustedProviders: ("apple" | "google")[];
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
verification: {
|
|
234
|
+
modelName: "pithyAuthVerifications";
|
|
235
|
+
};
|
|
236
|
+
socialProviders?: Record<string, unknown>;
|
|
237
|
+
plugins: [BetterAuthPlugin, {
|
|
238
|
+
id: "bearer";
|
|
239
|
+
version: string;
|
|
240
|
+
hooks: {
|
|
241
|
+
before: {
|
|
242
|
+
matcher(context: import("better-auth").HookEndpointContext): boolean;
|
|
243
|
+
handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
244
|
+
context: {
|
|
245
|
+
headers: Headers;
|
|
246
|
+
};
|
|
247
|
+
} | undefined>>;
|
|
248
|
+
}[];
|
|
249
|
+
after: {
|
|
250
|
+
matcher(context: import("better-auth").HookEndpointContext): true;
|
|
251
|
+
handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
|
|
252
|
+
}[];
|
|
253
|
+
};
|
|
254
|
+
options: import("better-auth/plugins/bearer").BearerOptions | undefined;
|
|
255
|
+
}, {
|
|
256
|
+
id: "jwt";
|
|
257
|
+
version: string;
|
|
258
|
+
options: NoInfer<import("better-auth/plugins/jwt").JwtOptions>;
|
|
259
|
+
init(ctx: import("better-auth").AuthContext): {
|
|
260
|
+
context: {
|
|
261
|
+
sessionConfig: {
|
|
262
|
+
cookieCacheSigner: import("better-auth").CookieCacheSigner;
|
|
263
|
+
updateAge: number;
|
|
264
|
+
expiresIn: number;
|
|
265
|
+
freshAge: number;
|
|
266
|
+
cookieRefreshCache: false | {
|
|
267
|
+
enabled: true;
|
|
268
|
+
updateAge: number;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
} | undefined;
|
|
273
|
+
endpoints: {
|
|
274
|
+
getJwks: import("better-auth").StrictEndpoint<string, {
|
|
275
|
+
method: "GET";
|
|
276
|
+
metadata: {
|
|
277
|
+
openapi: {
|
|
278
|
+
operationId: string;
|
|
279
|
+
description: string;
|
|
280
|
+
responses: {
|
|
281
|
+
"200": {
|
|
282
|
+
description: string;
|
|
283
|
+
content: {
|
|
284
|
+
"application/json": {
|
|
285
|
+
schema: {
|
|
286
|
+
type: "object";
|
|
287
|
+
properties: {
|
|
288
|
+
keys: {
|
|
289
|
+
type: string;
|
|
290
|
+
description: string;
|
|
291
|
+
items: {
|
|
292
|
+
type: string;
|
|
293
|
+
properties: {
|
|
294
|
+
kid: {
|
|
295
|
+
type: string;
|
|
296
|
+
description: string;
|
|
297
|
+
};
|
|
298
|
+
kty: {
|
|
299
|
+
type: string;
|
|
300
|
+
description: string;
|
|
301
|
+
};
|
|
302
|
+
alg: {
|
|
303
|
+
type: string;
|
|
304
|
+
description: string;
|
|
305
|
+
};
|
|
306
|
+
use: {
|
|
307
|
+
type: string;
|
|
308
|
+
description: string;
|
|
309
|
+
enum: string[];
|
|
310
|
+
nullable: boolean;
|
|
311
|
+
};
|
|
312
|
+
n: {
|
|
313
|
+
type: string;
|
|
314
|
+
description: string;
|
|
315
|
+
nullable: boolean;
|
|
316
|
+
};
|
|
317
|
+
e: {
|
|
318
|
+
type: string;
|
|
319
|
+
description: string;
|
|
320
|
+
nullable: boolean;
|
|
321
|
+
};
|
|
322
|
+
crv: {
|
|
323
|
+
type: string;
|
|
324
|
+
description: string;
|
|
325
|
+
nullable: boolean;
|
|
326
|
+
};
|
|
327
|
+
x: {
|
|
328
|
+
type: string;
|
|
329
|
+
description: string;
|
|
330
|
+
nullable: boolean;
|
|
331
|
+
};
|
|
332
|
+
y: {
|
|
333
|
+
type: string;
|
|
334
|
+
description: string;
|
|
335
|
+
nullable: boolean;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
required: string[];
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
required: string[];
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
}, import("better-auth").JSONWebKeySet>;
|
|
351
|
+
getToken: import("better-auth").StrictEndpoint<"/token", {
|
|
352
|
+
method: "GET";
|
|
353
|
+
requireHeaders: true;
|
|
354
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
355
|
+
session: {
|
|
356
|
+
session: Record<string, any> & {
|
|
357
|
+
id: string;
|
|
358
|
+
createdAt: Date;
|
|
359
|
+
updatedAt: Date;
|
|
360
|
+
userId: string;
|
|
361
|
+
expiresAt: Date;
|
|
362
|
+
token: string;
|
|
363
|
+
ipAddress?: string | null | undefined;
|
|
364
|
+
userAgent?: string | null | undefined;
|
|
365
|
+
};
|
|
366
|
+
user: Record<string, any> & {
|
|
367
|
+
id: string;
|
|
368
|
+
createdAt: Date;
|
|
369
|
+
updatedAt: Date;
|
|
370
|
+
email: string;
|
|
371
|
+
emailVerified: boolean;
|
|
372
|
+
name: string;
|
|
373
|
+
image?: string | null | undefined;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
}>>[];
|
|
377
|
+
metadata: {
|
|
378
|
+
openapi: {
|
|
379
|
+
operationId: string;
|
|
380
|
+
description: string;
|
|
381
|
+
responses: {
|
|
382
|
+
200: {
|
|
383
|
+
description: string;
|
|
384
|
+
content: {
|
|
385
|
+
"application/json": {
|
|
386
|
+
schema: {
|
|
387
|
+
type: "object";
|
|
388
|
+
properties: {
|
|
389
|
+
token: {
|
|
390
|
+
type: string;
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
}, {
|
|
401
|
+
token: string;
|
|
402
|
+
}>;
|
|
403
|
+
signJWT: import("better-auth").StrictEndpoint<string, {
|
|
404
|
+
method: "POST";
|
|
405
|
+
metadata: {
|
|
406
|
+
$Infer: {
|
|
407
|
+
body: {
|
|
408
|
+
payload: import("better-auth").JWTPayload;
|
|
409
|
+
overrideOptions?: import("better-auth/plugins/jwt").JwtOptions | undefined;
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
body: import("zod").ZodObject<{
|
|
414
|
+
payload: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>;
|
|
415
|
+
overrideOptions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
416
|
+
}, import("zod/v4/core").$strip>;
|
|
417
|
+
}, {
|
|
418
|
+
token: string;
|
|
419
|
+
}>;
|
|
420
|
+
verifyJWT: import("better-auth").StrictEndpoint<string, {
|
|
421
|
+
method: "POST";
|
|
422
|
+
metadata: {
|
|
423
|
+
$Infer: {
|
|
424
|
+
body: {
|
|
425
|
+
token: string;
|
|
426
|
+
issuer?: string;
|
|
427
|
+
};
|
|
428
|
+
response: {
|
|
429
|
+
payload: {
|
|
430
|
+
sub: string;
|
|
431
|
+
aud: string;
|
|
432
|
+
[key: string]: any;
|
|
433
|
+
} | null;
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
body: import("zod").ZodObject<{
|
|
438
|
+
token: import("zod").ZodString;
|
|
439
|
+
issuer: import("zod").ZodOptional<import("zod").ZodString>;
|
|
440
|
+
}, import("zod/v4/core").$strip>;
|
|
441
|
+
}, {
|
|
442
|
+
payload: (import("better-auth").JWTPayload & Required<Pick<import("better-auth").JWTPayload, "sub" | "aud">>) | null;
|
|
443
|
+
}>;
|
|
444
|
+
};
|
|
445
|
+
hooks: {
|
|
446
|
+
after: {
|
|
447
|
+
matcher(context: import("better-auth").HookEndpointContext): boolean;
|
|
448
|
+
handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
|
|
449
|
+
}[];
|
|
450
|
+
};
|
|
451
|
+
schema: {
|
|
452
|
+
jwks: {
|
|
453
|
+
fields: {
|
|
454
|
+
publicKey: {
|
|
455
|
+
type: "string";
|
|
456
|
+
required: true;
|
|
457
|
+
};
|
|
458
|
+
privateKey: {
|
|
459
|
+
type: "string";
|
|
460
|
+
required: true;
|
|
461
|
+
};
|
|
462
|
+
createdAt: {
|
|
463
|
+
type: "date";
|
|
464
|
+
required: true;
|
|
465
|
+
};
|
|
466
|
+
expiresAt: {
|
|
467
|
+
type: "date";
|
|
468
|
+
required: false;
|
|
469
|
+
};
|
|
470
|
+
alg: {
|
|
471
|
+
type: "string";
|
|
472
|
+
required: false;
|
|
473
|
+
};
|
|
474
|
+
crv: {
|
|
475
|
+
type: "string";
|
|
476
|
+
required: false;
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
}, {
|
|
482
|
+
id: "magic-link";
|
|
483
|
+
version: string;
|
|
484
|
+
endpoints: {
|
|
485
|
+
signInMagicLink: import("better-auth").StrictEndpoint<"/sign-in/magic-link", {
|
|
486
|
+
method: "POST";
|
|
487
|
+
requireHeaders: true;
|
|
488
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>[];
|
|
489
|
+
body: import("zod").ZodObject<{
|
|
490
|
+
email: import("zod").ZodEmail;
|
|
491
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
492
|
+
callbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
493
|
+
newUserCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
494
|
+
errorCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
495
|
+
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
496
|
+
}, import("zod/v4/core").$strip>;
|
|
497
|
+
metadata: {
|
|
498
|
+
openapi: {
|
|
499
|
+
operationId: string;
|
|
500
|
+
description: string;
|
|
501
|
+
responses: {
|
|
502
|
+
200: {
|
|
503
|
+
description: string;
|
|
504
|
+
content: {
|
|
505
|
+
"application/json": {
|
|
506
|
+
schema: {
|
|
507
|
+
type: "object";
|
|
508
|
+
properties: {
|
|
509
|
+
status: {
|
|
510
|
+
type: string;
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
}, {
|
|
521
|
+
status: boolean;
|
|
522
|
+
}>;
|
|
523
|
+
magicLinkVerify: import("better-auth").StrictEndpoint<"/magic-link/verify", {
|
|
524
|
+
method: "GET";
|
|
525
|
+
query: import("zod").ZodObject<{
|
|
526
|
+
token: import("zod").ZodString;
|
|
527
|
+
callbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
528
|
+
errorCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
529
|
+
newUserCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
530
|
+
}, import("zod/v4/core").$strip>;
|
|
531
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>[];
|
|
532
|
+
requireHeaders: true;
|
|
533
|
+
metadata: {
|
|
534
|
+
openapi: {
|
|
535
|
+
operationId: string;
|
|
536
|
+
description: string;
|
|
537
|
+
responses: {
|
|
538
|
+
200: {
|
|
539
|
+
description: string;
|
|
540
|
+
content: {
|
|
541
|
+
"application/json": {
|
|
542
|
+
schema: {
|
|
543
|
+
type: "object";
|
|
544
|
+
properties: {
|
|
545
|
+
session: {
|
|
546
|
+
$ref: string;
|
|
547
|
+
};
|
|
548
|
+
user: {
|
|
549
|
+
$ref: string;
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
}, {
|
|
560
|
+
token: string;
|
|
561
|
+
user: {
|
|
562
|
+
id: string;
|
|
563
|
+
createdAt: Date;
|
|
564
|
+
updatedAt: Date;
|
|
565
|
+
email: string;
|
|
566
|
+
emailVerified: boolean;
|
|
567
|
+
name: string;
|
|
568
|
+
image?: string | null | undefined;
|
|
569
|
+
};
|
|
570
|
+
session: {
|
|
571
|
+
id: string;
|
|
572
|
+
createdAt: Date;
|
|
573
|
+
updatedAt: Date;
|
|
574
|
+
userId: string;
|
|
575
|
+
expiresAt: Date;
|
|
576
|
+
token: string;
|
|
577
|
+
ipAddress?: string | null | undefined;
|
|
578
|
+
userAgent?: string | null | undefined;
|
|
579
|
+
};
|
|
580
|
+
}>;
|
|
581
|
+
};
|
|
582
|
+
rateLimit: {
|
|
583
|
+
pathMatcher(path: string): boolean;
|
|
584
|
+
window: number;
|
|
585
|
+
max: number;
|
|
586
|
+
}[];
|
|
587
|
+
options: import("better-auth/plugins/magic-link").MagicLinkOptions;
|
|
588
|
+
}, {
|
|
589
|
+
id: "email-otp";
|
|
590
|
+
version: string;
|
|
591
|
+
init(ctx: import("better-auth").AuthContext): {
|
|
592
|
+
options: {
|
|
593
|
+
emailVerification: {
|
|
594
|
+
sendVerificationEmail(data: {
|
|
595
|
+
user: import("better-auth").User;
|
|
596
|
+
url: string;
|
|
597
|
+
token: string;
|
|
598
|
+
}, request: Request | undefined): Promise<void>;
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
} | undefined;
|
|
602
|
+
endpoints: {
|
|
603
|
+
sendVerificationOTP: import("better-auth").StrictEndpoint<"/email-otp/send-verification-otp", {
|
|
604
|
+
method: "POST";
|
|
605
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>[];
|
|
606
|
+
body: import("zod").ZodObject<{
|
|
607
|
+
email: import("zod").ZodString;
|
|
608
|
+
type: import("zod").ZodEnum<{
|
|
609
|
+
"sign-in": "sign-in";
|
|
610
|
+
"change-email": "change-email";
|
|
611
|
+
"email-verification": "email-verification";
|
|
612
|
+
"forget-password": "forget-password";
|
|
613
|
+
}>;
|
|
614
|
+
}, import("zod/v4/core").$strip>;
|
|
615
|
+
metadata: {
|
|
616
|
+
openapi: {
|
|
617
|
+
operationId: string;
|
|
618
|
+
description: string;
|
|
619
|
+
responses: {
|
|
620
|
+
200: {
|
|
621
|
+
description: string;
|
|
622
|
+
content: {
|
|
623
|
+
"application/json": {
|
|
624
|
+
schema: {
|
|
625
|
+
type: "object";
|
|
626
|
+
properties: {
|
|
627
|
+
success: {
|
|
628
|
+
type: string;
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
};
|
|
638
|
+
}, {
|
|
639
|
+
success: boolean;
|
|
640
|
+
}>;
|
|
641
|
+
createVerificationOTP: import("better-auth").StrictEndpoint<string, {
|
|
642
|
+
method: "POST";
|
|
643
|
+
body: import("zod").ZodObject<{
|
|
644
|
+
email: import("zod").ZodString;
|
|
645
|
+
type: import("zod").ZodEnum<{
|
|
646
|
+
"sign-in": "sign-in";
|
|
647
|
+
"change-email": "change-email";
|
|
648
|
+
"email-verification": "email-verification";
|
|
649
|
+
"forget-password": "forget-password";
|
|
650
|
+
}>;
|
|
651
|
+
}, import("zod/v4/core").$strip>;
|
|
652
|
+
metadata: {
|
|
653
|
+
openapi: {
|
|
654
|
+
operationId: string;
|
|
655
|
+
description: string;
|
|
656
|
+
responses: {
|
|
657
|
+
200: {
|
|
658
|
+
description: string;
|
|
659
|
+
content: {
|
|
660
|
+
"application/json": {
|
|
661
|
+
schema: {
|
|
662
|
+
type: "string";
|
|
663
|
+
};
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
}, string>;
|
|
671
|
+
getVerificationOTP: import("better-auth").StrictEndpoint<string, {
|
|
672
|
+
method: "GET";
|
|
673
|
+
query: import("zod").ZodObject<{
|
|
674
|
+
email: import("zod").ZodString;
|
|
675
|
+
type: import("zod").ZodEnum<{
|
|
676
|
+
"sign-in": "sign-in";
|
|
677
|
+
"change-email": "change-email";
|
|
678
|
+
"email-verification": "email-verification";
|
|
679
|
+
"forget-password": "forget-password";
|
|
680
|
+
}>;
|
|
681
|
+
}, import("zod/v4/core").$strip>;
|
|
682
|
+
metadata: {
|
|
683
|
+
openapi: {
|
|
684
|
+
operationId: string;
|
|
685
|
+
description: string;
|
|
686
|
+
responses: {
|
|
687
|
+
"200": {
|
|
688
|
+
description: string;
|
|
689
|
+
content: {
|
|
690
|
+
"application/json": {
|
|
691
|
+
schema: {
|
|
692
|
+
type: "object";
|
|
693
|
+
properties: {
|
|
694
|
+
otp: {
|
|
695
|
+
type: string;
|
|
696
|
+
nullable: boolean;
|
|
697
|
+
description: string;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
required: string[];
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
}, {
|
|
709
|
+
otp: null;
|
|
710
|
+
} | {
|
|
711
|
+
otp: string;
|
|
712
|
+
}>;
|
|
713
|
+
checkVerificationOTP: import("better-auth").StrictEndpoint<"/email-otp/check-verification-otp", {
|
|
714
|
+
method: "POST";
|
|
715
|
+
body: import("zod").ZodObject<{
|
|
716
|
+
email: import("zod").ZodString;
|
|
717
|
+
type: import("zod").ZodEnum<{
|
|
718
|
+
"sign-in": "sign-in";
|
|
719
|
+
"change-email": "change-email";
|
|
720
|
+
"email-verification": "email-verification";
|
|
721
|
+
"forget-password": "forget-password";
|
|
722
|
+
}>;
|
|
723
|
+
otp: import("zod").ZodString;
|
|
724
|
+
}, import("zod/v4/core").$strip>;
|
|
725
|
+
metadata: {
|
|
726
|
+
openapi: {
|
|
727
|
+
operationId: string;
|
|
728
|
+
description: string;
|
|
729
|
+
responses: {
|
|
730
|
+
200: {
|
|
731
|
+
description: string;
|
|
732
|
+
content: {
|
|
733
|
+
"application/json": {
|
|
734
|
+
schema: {
|
|
735
|
+
type: "object";
|
|
736
|
+
properties: {
|
|
737
|
+
success: {
|
|
738
|
+
type: string;
|
|
739
|
+
};
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
};
|
|
748
|
+
}, {
|
|
749
|
+
success: boolean;
|
|
750
|
+
}>;
|
|
751
|
+
verifyEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/verify-email", {
|
|
752
|
+
method: "POST";
|
|
753
|
+
body: import("zod").ZodObject<{
|
|
754
|
+
email: import("zod").ZodString;
|
|
755
|
+
otp: import("zod").ZodString;
|
|
756
|
+
}, import("zod/v4/core").$strip>;
|
|
757
|
+
metadata: {
|
|
758
|
+
openapi: {
|
|
759
|
+
description: string;
|
|
760
|
+
responses: {
|
|
761
|
+
200: {
|
|
762
|
+
description: string;
|
|
763
|
+
content: {
|
|
764
|
+
"application/json": {
|
|
765
|
+
schema: {
|
|
766
|
+
type: "object";
|
|
767
|
+
properties: {
|
|
768
|
+
status: {
|
|
769
|
+
type: string;
|
|
770
|
+
description: string;
|
|
771
|
+
enum: boolean[];
|
|
772
|
+
};
|
|
773
|
+
token: {
|
|
774
|
+
type: string;
|
|
775
|
+
nullable: boolean;
|
|
776
|
+
description: string;
|
|
777
|
+
};
|
|
778
|
+
user: {
|
|
779
|
+
$ref: string;
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
required: string[];
|
|
783
|
+
};
|
|
784
|
+
};
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
};
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
}, {
|
|
791
|
+
status: boolean;
|
|
792
|
+
token: string;
|
|
793
|
+
user: {
|
|
794
|
+
id: string;
|
|
795
|
+
createdAt: Date;
|
|
796
|
+
updatedAt: Date;
|
|
797
|
+
email: string;
|
|
798
|
+
emailVerified: boolean;
|
|
799
|
+
name: string;
|
|
800
|
+
image?: string | null | undefined;
|
|
801
|
+
} & Record<string, any>;
|
|
802
|
+
} | {
|
|
803
|
+
status: boolean;
|
|
804
|
+
token: null;
|
|
805
|
+
user: {
|
|
806
|
+
id: string;
|
|
807
|
+
createdAt: Date;
|
|
808
|
+
updatedAt: Date;
|
|
809
|
+
email: string;
|
|
810
|
+
emailVerified: boolean;
|
|
811
|
+
name: string;
|
|
812
|
+
image?: string | null | undefined;
|
|
813
|
+
} & Record<string, any>;
|
|
814
|
+
}>;
|
|
815
|
+
signInEmailOTP: import("better-auth").StrictEndpoint<"/sign-in/email-otp", {
|
|
816
|
+
method: "POST";
|
|
817
|
+
body: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
818
|
+
email: import("zod").ZodString;
|
|
819
|
+
otp: import("zod").ZodString;
|
|
820
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
821
|
+
image: import("zod").ZodOptional<import("zod").ZodString>;
|
|
822
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
823
|
+
metadata: {
|
|
824
|
+
openapi: {
|
|
825
|
+
operationId: string;
|
|
826
|
+
description: string;
|
|
827
|
+
responses: {
|
|
828
|
+
200: {
|
|
829
|
+
description: string;
|
|
830
|
+
content: {
|
|
831
|
+
"application/json": {
|
|
832
|
+
schema: {
|
|
833
|
+
type: "object";
|
|
834
|
+
properties: {
|
|
835
|
+
token: {
|
|
836
|
+
type: string;
|
|
837
|
+
description: string;
|
|
838
|
+
};
|
|
839
|
+
user: {
|
|
840
|
+
$ref: string;
|
|
841
|
+
};
|
|
842
|
+
};
|
|
843
|
+
required: string[];
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
};
|
|
851
|
+
}, {
|
|
852
|
+
token: string;
|
|
853
|
+
user: {
|
|
854
|
+
id: string;
|
|
855
|
+
createdAt: Date;
|
|
856
|
+
updatedAt: Date;
|
|
857
|
+
email: string;
|
|
858
|
+
emailVerified: boolean;
|
|
859
|
+
name: string;
|
|
860
|
+
image?: string | null | undefined;
|
|
861
|
+
};
|
|
862
|
+
}>;
|
|
863
|
+
requestPasswordResetEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/request-password-reset", {
|
|
864
|
+
method: "POST";
|
|
865
|
+
body: import("zod").ZodObject<{
|
|
866
|
+
email: import("zod").ZodString;
|
|
867
|
+
}, import("zod/v4/core").$strip>;
|
|
868
|
+
metadata: {
|
|
869
|
+
openapi: {
|
|
870
|
+
operationId: string;
|
|
871
|
+
description: string;
|
|
872
|
+
responses: {
|
|
873
|
+
200: {
|
|
874
|
+
description: string;
|
|
875
|
+
content: {
|
|
876
|
+
"application/json": {
|
|
877
|
+
schema: {
|
|
878
|
+
type: "object";
|
|
879
|
+
properties: {
|
|
880
|
+
success: {
|
|
881
|
+
type: string;
|
|
882
|
+
description: string;
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
};
|
|
890
|
+
};
|
|
891
|
+
};
|
|
892
|
+
}, {
|
|
893
|
+
success: boolean;
|
|
894
|
+
}>;
|
|
895
|
+
forgetPasswordEmailOTP: import("better-auth").StrictEndpoint<"/forget-password/email-otp", {
|
|
896
|
+
method: "POST";
|
|
897
|
+
body: import("zod").ZodObject<{
|
|
898
|
+
email: import("zod").ZodString;
|
|
899
|
+
}, import("zod/v4/core").$strip>;
|
|
900
|
+
metadata: {
|
|
901
|
+
openapi: {
|
|
902
|
+
operationId: string;
|
|
903
|
+
description: string;
|
|
904
|
+
responses: {
|
|
905
|
+
200: {
|
|
906
|
+
description: string;
|
|
907
|
+
content: {
|
|
908
|
+
"application/json": {
|
|
909
|
+
schema: {
|
|
910
|
+
type: "object";
|
|
911
|
+
properties: {
|
|
912
|
+
success: {
|
|
913
|
+
type: string;
|
|
914
|
+
description: string;
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
};
|
|
918
|
+
};
|
|
919
|
+
};
|
|
920
|
+
};
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
};
|
|
924
|
+
}, {
|
|
925
|
+
success: boolean;
|
|
926
|
+
}>;
|
|
927
|
+
resetPasswordEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/reset-password", {
|
|
928
|
+
method: "POST";
|
|
929
|
+
body: import("zod").ZodObject<{
|
|
930
|
+
email: import("zod").ZodString;
|
|
931
|
+
otp: import("zod").ZodString;
|
|
932
|
+
password: import("zod").ZodString;
|
|
933
|
+
}, import("zod/v4/core").$strip>;
|
|
934
|
+
metadata: {
|
|
935
|
+
openapi: {
|
|
936
|
+
operationId: string;
|
|
937
|
+
description: string;
|
|
938
|
+
responses: {
|
|
939
|
+
200: {
|
|
940
|
+
description: string;
|
|
941
|
+
content: {
|
|
942
|
+
"application/json": {
|
|
943
|
+
schema: {
|
|
944
|
+
type: "object";
|
|
945
|
+
properties: {
|
|
946
|
+
success: {
|
|
947
|
+
type: string;
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
};
|
|
957
|
+
}, {
|
|
958
|
+
success: boolean;
|
|
959
|
+
}>;
|
|
960
|
+
requestEmailChangeEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/request-email-change", {
|
|
961
|
+
method: "POST";
|
|
962
|
+
body: import("zod").ZodObject<{
|
|
963
|
+
newEmail: import("zod").ZodString;
|
|
964
|
+
otp: import("zod").ZodOptional<import("zod").ZodString>;
|
|
965
|
+
}, import("zod/v4/core").$strip>;
|
|
966
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
967
|
+
session: {
|
|
968
|
+
session: Record<string, any> & {
|
|
969
|
+
id: string;
|
|
970
|
+
createdAt: Date;
|
|
971
|
+
updatedAt: Date;
|
|
972
|
+
userId: string;
|
|
973
|
+
expiresAt: Date;
|
|
974
|
+
token: string;
|
|
975
|
+
ipAddress?: string | null | undefined;
|
|
976
|
+
userAgent?: string | null | undefined;
|
|
977
|
+
};
|
|
978
|
+
user: Record<string, any> & {
|
|
979
|
+
id: string;
|
|
980
|
+
createdAt: Date;
|
|
981
|
+
updatedAt: Date;
|
|
982
|
+
email: string;
|
|
983
|
+
emailVerified: boolean;
|
|
984
|
+
name: string;
|
|
985
|
+
image?: string | null | undefined;
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
}>>[];
|
|
989
|
+
metadata: {
|
|
990
|
+
openapi: {
|
|
991
|
+
operationId: string;
|
|
992
|
+
description: string;
|
|
993
|
+
responses: {
|
|
994
|
+
200: {
|
|
995
|
+
description: string;
|
|
996
|
+
content: {
|
|
997
|
+
"application/json": {
|
|
998
|
+
schema: {
|
|
999
|
+
type: "object";
|
|
1000
|
+
properties: {
|
|
1001
|
+
success: {
|
|
1002
|
+
type: string;
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
};
|
|
1009
|
+
};
|
|
1010
|
+
};
|
|
1011
|
+
};
|
|
1012
|
+
}, {
|
|
1013
|
+
success: boolean;
|
|
1014
|
+
}>;
|
|
1015
|
+
changeEmailEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/change-email", {
|
|
1016
|
+
method: "POST";
|
|
1017
|
+
body: import("zod").ZodObject<{
|
|
1018
|
+
newEmail: import("zod").ZodString;
|
|
1019
|
+
otp: import("zod").ZodString;
|
|
1020
|
+
}, import("zod/v4/core").$strip>;
|
|
1021
|
+
use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
1022
|
+
session: {
|
|
1023
|
+
session: Record<string, any> & {
|
|
1024
|
+
id: string;
|
|
1025
|
+
createdAt: Date;
|
|
1026
|
+
updatedAt: Date;
|
|
1027
|
+
userId: string;
|
|
1028
|
+
expiresAt: Date;
|
|
1029
|
+
token: string;
|
|
1030
|
+
ipAddress?: string | null | undefined;
|
|
1031
|
+
userAgent?: string | null | undefined;
|
|
1032
|
+
};
|
|
1033
|
+
user: Record<string, any> & {
|
|
1034
|
+
id: string;
|
|
1035
|
+
createdAt: Date;
|
|
1036
|
+
updatedAt: Date;
|
|
1037
|
+
email: string;
|
|
1038
|
+
emailVerified: boolean;
|
|
1039
|
+
name: string;
|
|
1040
|
+
image?: string | null | undefined;
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
}>>[];
|
|
1044
|
+
metadata: {
|
|
1045
|
+
openapi: {
|
|
1046
|
+
operationId: string;
|
|
1047
|
+
description: string;
|
|
1048
|
+
responses: {
|
|
1049
|
+
200: {
|
|
1050
|
+
description: string;
|
|
1051
|
+
content: {
|
|
1052
|
+
"application/json": {
|
|
1053
|
+
schema: {
|
|
1054
|
+
type: "object";
|
|
1055
|
+
properties: {
|
|
1056
|
+
success: {
|
|
1057
|
+
type: string;
|
|
1058
|
+
};
|
|
1059
|
+
};
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
};
|
|
1065
|
+
};
|
|
1066
|
+
};
|
|
1067
|
+
}, {
|
|
1068
|
+
success: boolean;
|
|
1069
|
+
}>;
|
|
1070
|
+
};
|
|
1071
|
+
hooks: {
|
|
1072
|
+
after: {
|
|
1073
|
+
matcher(context: import("better-auth").HookEndpointContext): boolean;
|
|
1074
|
+
handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
|
|
1075
|
+
}[];
|
|
1076
|
+
};
|
|
1077
|
+
rateLimit: ({
|
|
1078
|
+
pathMatcher(path: string): path is "/email-otp/send-verification-otp";
|
|
1079
|
+
window: number;
|
|
1080
|
+
max: number;
|
|
1081
|
+
} | {
|
|
1082
|
+
pathMatcher(path: string): path is "/email-otp/check-verification-otp";
|
|
1083
|
+
window: number;
|
|
1084
|
+
max: number;
|
|
1085
|
+
} | {
|
|
1086
|
+
pathMatcher(path: string): path is "/email-otp/verify-email";
|
|
1087
|
+
window: number;
|
|
1088
|
+
max: number;
|
|
1089
|
+
} | {
|
|
1090
|
+
pathMatcher(path: string): path is "/sign-in/email-otp";
|
|
1091
|
+
window: number;
|
|
1092
|
+
max: number;
|
|
1093
|
+
} | {
|
|
1094
|
+
pathMatcher(path: string): path is "/email-otp/request-password-reset";
|
|
1095
|
+
window: number;
|
|
1096
|
+
max: number;
|
|
1097
|
+
} | {
|
|
1098
|
+
pathMatcher(path: string): path is "/email-otp/reset-password";
|
|
1099
|
+
window: number;
|
|
1100
|
+
max: number;
|
|
1101
|
+
} | {
|
|
1102
|
+
pathMatcher(path: string): path is "/forget-password/email-otp";
|
|
1103
|
+
window: number;
|
|
1104
|
+
max: number;
|
|
1105
|
+
} | {
|
|
1106
|
+
pathMatcher(path: string): path is "/email-otp/request-email-change";
|
|
1107
|
+
window: number;
|
|
1108
|
+
max: number;
|
|
1109
|
+
} | {
|
|
1110
|
+
pathMatcher(path: string): path is "/email-otp/change-email";
|
|
1111
|
+
window: number;
|
|
1112
|
+
max: number;
|
|
1113
|
+
})[];
|
|
1114
|
+
options: import("better-auth/plugins/email-otp").EmailOTPOptions;
|
|
1115
|
+
$ERROR_CODES: {
|
|
1116
|
+
OTP_EXPIRED: import("better-auth").RawError<"OTP_EXPIRED">;
|
|
1117
|
+
INVALID_OTP: import("better-auth").RawError<"INVALID_OTP">;
|
|
1118
|
+
TOO_MANY_ATTEMPTS: import("better-auth").RawError<"TOO_MANY_ATTEMPTS">;
|
|
1119
|
+
};
|
|
1120
|
+
}, ...Plugins];
|
|
1121
|
+
}>;
|
|
1122
|
+
//# sourceMappingURL=auth.d.ts.map
|