@jgb-solutions/kit 0.1.1 → 0.2.1

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/auth.d.ts ADDED
@@ -0,0 +1,2209 @@
1
+ import type { BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitStorage } from 'better-auth';
2
+ import { type AdminOptions } from 'better-auth/plugins/admin';
3
+ import { type AuthUser } from './auth/rules';
4
+ type Env = Record<string, string | undefined>;
5
+ export type GoogleSettings = {
6
+ /** The web client first, then the mobile apps' clients (their ID tokens name them as audience). */
7
+ clientId: string[];
8
+ clientSecret: string;
9
+ };
10
+ export type AuthSettings = {
11
+ secret: string;
12
+ /** Public sign-up: on unless SIGN_UP=off. Existing accounts always sign in. */
13
+ signUp: boolean;
14
+ /** Rate limits: always on, except on the E2E test server (every test comes from 127.0.0.1). */
15
+ rateLimit: boolean;
16
+ /** Addresses whose new accounts start as admin when created with a confirmed address (Google), lower-cased. */
17
+ adminEmails: string[];
18
+ /** "Continue with Google": on only when GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET are both set. */
19
+ google: GoogleSettings | null;
20
+ };
21
+ /**
22
+ * Sign-in settings from the environment, the same on every host: BETTER_AUTH_SECRET, SIGN_UP,
23
+ * ADMIN_EMAILS, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET and GOOGLE_MOBILE_CLIENT_IDS (comma-separated:
24
+ * the Android and iOS clients). E2E=1 marks the E2E test server: its stand-in secret and its rate
25
+ * limits off are refused on a production server that listens beyond this machine (NODE_ENV=production
26
+ * with HOST unset or not a loopback address), so a stray E2E=1 can't start production with a public
27
+ * secret. E2E servers run a production build on 127.0.0.1. Throws without a secret.
28
+ */
29
+ export declare function authSettings(env: Env): AuthSettings;
30
+ /**
31
+ * The role a new account starts with: `adminRole` for an address in ADMIN_EMAILS, but only when the
32
+ * address is confirmed (Google sets `emailVerified` from its `email_verified`; a sign-up with an email
33
+ * address never does, since no email is sent). Otherwise anyone could sign up first with an admin's
34
+ * address and take the role. Else `defaultRole`.
35
+ */
36
+ export declare function roleForNewUser<R extends string>(user: {
37
+ email: string;
38
+ emailVerified?: unknown;
39
+ }, adminEmails: readonly string[], defaultRole: R, adminRole: R): R;
40
+ /**
41
+ * Better Auth's `baseURL`: the request's own host, but only the site's or a local one; anything else
42
+ * falls back to the site. A forged Host header can't choose the passkeys' relying party or the
43
+ * address in a callback.
44
+ */
45
+ export declare function trustedBaseUrl(siteUrl: string, localHosts?: readonly string[]): {
46
+ allowedHosts: string[];
47
+ protocol: "auto";
48
+ fallback: string;
49
+ };
50
+ /** An Android signing certificate's SHA-256 (`AB:CD:…`) as WebAuthn reports it: `android:apk-key-hash:<base64url>`. */
51
+ export declare function androidOrigin(sha256: string): string;
52
+ /**
53
+ * The Digital Asset Links statement for `/.well-known/assetlinks.json`: the Android app opens the
54
+ * site's links and uses its passkeys. The package name and certificates are the app's own.
55
+ */
56
+ export declare function assetLinks(packageName: string, sha256Fingerprints: readonly string[]): {
57
+ relation: string[];
58
+ target: {
59
+ namespace: string;
60
+ package_name: string;
61
+ sha256_cert_fingerprints: string[];
62
+ };
63
+ }[];
64
+ /**
65
+ * Where passkeys may be used: the site, the local origins development and E2E use (a localhost page
66
+ * can never use the real site's passkeys), and the Android app's certificates.
67
+ */
68
+ export declare function passkeyOrigins(siteUrl: string, options?: {
69
+ local?: readonly string[];
70
+ androidCertSha256?: readonly string[];
71
+ }): string[];
72
+ /** Per-path limits on top of Better Auth's default (60 requests a minute): sign-in and sign-up attempts. */
73
+ export declare const RATE_LIMIT_RULES: {
74
+ readonly '/sign-in/email': {
75
+ readonly window: 60;
76
+ readonly max: 10;
77
+ };
78
+ readonly '/sign-in/username': {
79
+ readonly window: 60;
80
+ readonly max: 10;
81
+ };
82
+ readonly '/sign-up/email': {
83
+ readonly window: number;
84
+ readonly max: 5;
85
+ };
86
+ readonly '/sign-in/social': {
87
+ readonly window: 60;
88
+ readonly max: 10;
89
+ };
90
+ readonly '/callback/*': {
91
+ readonly window: 60;
92
+ readonly max: 10;
93
+ };
94
+ readonly '/passkey/*': {
95
+ readonly window: 60;
96
+ readonly max: 20;
97
+ };
98
+ readonly '/change-password': {
99
+ readonly window: 60;
100
+ readonly max: 5;
101
+ };
102
+ readonly '/set-password': {
103
+ readonly window: 60;
104
+ readonly max: 5;
105
+ };
106
+ readonly '/delete-user': {
107
+ readonly window: 60;
108
+ readonly max: 5;
109
+ };
110
+ };
111
+ /** A counter store: Redis, Dragonfly, Workers KV with a Durable Object, or anything with an atomic increment. */
112
+ export type CounterStore = {
113
+ /** Adds 1 to `key` and returns the new count; a new key expires after `ttlSeconds`. */
114
+ incr(key: string, ttlSeconds: number): Promise<number>;
115
+ };
116
+ /**
117
+ * Rate-limit counts in a counter store (one increment per attempt, on a key per fixed window), never
118
+ * as a database row per attempt. When the store can't answer, the attempt is let through and logged:
119
+ * the password hash's cost still slows guessing, and sign-in never goes down with the cache.
120
+ */
121
+ export declare function counterRateLimit(store: () => CounterStore, now?: () => number): BetterAuthRateLimitStorage;
122
+ /**
123
+ * Account linking, "merge only confirmed" (owner, 2026-11-24):
124
+ *
125
+ * - **Signing in with Google** joins an existing account with the same address only when both
126
+ * addresses are confirmed: Google's (`email_verified`; Google isn't a trusted provider) and the
127
+ * account's own. The app never sends email, so an account's address is confirmed only when it was
128
+ * made with Google or by an admin. Otherwise Better Auth refuses (`ACCOUNT_NOT_LINKED` after
129
+ * `authErrorCode`): someone could have signed up first with another person's address and a password
130
+ * they know. The person signs in with their password and connects Google from their account page.
131
+ * - **Connecting Google while signed in** (Better Auth's `linkSocial`) proves both sides, so the Google
132
+ * address may differ from the account's: accounts made with a username have a placeholder address
133
+ * that could never match.
134
+ *
135
+ * The account keeps its name and picture (afterAccountSaved adds Google's picture if it had none).
136
+ */
137
+ export declare const CONFIRMED_ACCOUNT_LINKING: {
138
+ enabled: boolean;
139
+ trustedProviders: string[];
140
+ requireLocalEmailVerified: boolean;
141
+ allowDifferentEmails: boolean;
142
+ updateUserInfoOnLink: boolean;
143
+ };
144
+ /** Better Auth's Google provider from the settings. Closing sign-up closes it for Google too. */
145
+ export declare function googleProvider(google: GoogleSettings, options: {
146
+ signUp: boolean;
147
+ }): {
148
+ clientId: string[];
149
+ clientSecret: string;
150
+ disableImplicitSignUp: boolean;
151
+ prompt: "select_account";
152
+ };
153
+ /**
154
+ * The first free username for a new account made without one (Google), from its name. `taken` answers
155
+ * which of the candidates are used (one query per round). After three rounds, a random one.
156
+ */
157
+ export declare function freeUsername(name: string | null | undefined, email: string | null | undefined, taken: (candidates: string[]) => Promise<ReadonlySet<string>>, fallback: string): Promise<string>;
158
+ /** The picture in a Google ID token (already verified by Better Auth), when it is an https address of at most 2,000 characters. */
159
+ export declare function pictureFromIdToken(idToken: string | null | undefined): string | null;
160
+ /** The part of Better Auth's internal adapter `afterAccountSaved` uses. */
161
+ export type AccountAdapter = {
162
+ findAccounts(userId: string): Promise<{
163
+ providerId: string;
164
+ }[]>;
165
+ deleteUserSessions(userId: string): Promise<unknown>;
166
+ listSessions(userId: string): Promise<{
167
+ token: string;
168
+ }[]>;
169
+ deleteSessions(tokens: string[]): Promise<unknown>;
170
+ findUserById(userId: string): Promise<{
171
+ image?: string | null | undefined;
172
+ } | null>;
173
+ updateUser(userId: string, data: {
174
+ image: string;
175
+ }): Promise<unknown>;
176
+ };
177
+ /**
178
+ * After an account row is saved: when it is Google joining an account that already had another way
179
+ * in, the account's other sessions end (a session someone else held doesn't carry on), and the account
180
+ * takes Google's picture if it had none. `keepSessionToken` is the session of the person connecting
181
+ * Google from their account page, which stays; a Google sign-in that joins an account ends them all
182
+ * and gets its own right after. Returns whether it was such a join.
183
+ */
184
+ export declare function afterAccountSaved(account: {
185
+ providerId: string;
186
+ userId: string;
187
+ idToken?: string | null | undefined;
188
+ }, adapter: AccountAdapter, keepSessionToken?: string | null): Promise<boolean>;
189
+ /** The part of Better Auth's endpoint context the account hook reads. */
190
+ type AccountHookContext = {
191
+ context: {
192
+ internalAdapter: AccountAdapter;
193
+ session?: {
194
+ session: {
195
+ token: string;
196
+ };
197
+ } | null;
198
+ authCookies: {
199
+ sessionToken: {
200
+ name: string;
201
+ };
202
+ };
203
+ secret: string;
204
+ };
205
+ getSignedCookie(name: string, secret: string): Promise<string | null | false | undefined>;
206
+ };
207
+ /**
208
+ * A readable "signed in" cookie (no secret in it), set with every new session and cleared at sign-out
209
+ * and account deletion. Cached public pages read it to decide whether to ask for the account. It may
210
+ * outlive the session; the account call then answers no user and the page clears it.
211
+ */
212
+ export declare function signedInFlagHook(name: string, maxAgeSeconds?: number): import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
213
+ /**
214
+ * The request as visitors made it. Behind a tunnel or proxy that ends HTTPS, a request for the site
215
+ * arrives as `http://`; Better Auth builds its own address from the request, and Google refuses a
216
+ * token exchange whose redirect address changed ("redirect_uri_mismatch"). Requests for the site get
217
+ * its protocol back; other hosts stay as they are.
218
+ */
219
+ export declare function asPublicRequest(request: Request, siteUrl: string): Request;
220
+ /** How passwords are hashed: Bun's argon2id on Bun (`@jgb-solutions/kit/auth/bun`), Better Auth's scrypt elsewhere. */
221
+ export type PasswordHasher = {
222
+ hash(password: string): Promise<string>;
223
+ verify(input: {
224
+ hash: string;
225
+ password: string;
226
+ }): Promise<boolean>;
227
+ };
228
+ /** Better Auth's session user, with the fields the username and admin plugins add. */
229
+ export type SessionUser = {
230
+ id: string;
231
+ name: string;
232
+ email: string;
233
+ image?: string | null | undefined;
234
+ username?: string | null | undefined;
235
+ displayUsername?: string | null | undefined;
236
+ role?: string | null | undefined;
237
+ banned?: boolean | null | undefined;
238
+ };
239
+ /** The signed-in person from a session's user, or null for none or a suspended account. */
240
+ export declare function toAuthUser<Role extends string>(user: SessionUser | null | undefined, roleOf: (stored: string | null | undefined) => Role): AuthUser<Role> | null;
241
+ export type StandardAuthInput<A extends AdminOptions> = {
242
+ /** The app's name, shown by passkey managers. */
243
+ appName: string;
244
+ /** The site's public address, `https://…`. */
245
+ siteUrl: string;
246
+ settings: AuthSettings;
247
+ /** Better Auth's database: `drizzleAdapter(db, { provider: 'sqlite', schema })`, or a `bun:sqlite` database. */
248
+ database: BetterAuthOptions['database'];
249
+ /** The admin plugin's access control and roles: `{ ac, roles, defaultRole: 'user', adminRoles: ['admin'] }`. */
250
+ admin: A & {
251
+ defaultRole: string;
252
+ adminRoles: string[];
253
+ };
254
+ /** Which of these usernames are used: one query, for a new Google account's username. */
255
+ takenUsernames: (candidates: string[]) => Promise<ReadonlySet<string>>;
256
+ /** The username base when a name gives too little ("listener", "member"…). */
257
+ usernameFallback: string;
258
+ /**
259
+ * Which origins may use passkeys. `'listed'` (the default): the site, `localOrigins` and the Android
260
+ * app (`androidCertSha256`). `'request'`: the request's own origin, which `trustedBaseUrl` limits to
261
+ * the site and local hosts, so the site, previews and any local port work, each with its own
262
+ * passkeys. `'request'` can't serve the Android app.
263
+ */
264
+ passkeyOrigin?: 'listed' | 'request';
265
+ /** Local origins allowed to use passkeys (development and E2E) with `passkeyOrigin: 'listed'`: `['http://localhost:5173']`. */
266
+ localOrigins?: readonly string[];
267
+ /** The Android app's signing certificates (SHA-256, `AB:CD:…`), for passkeys in the app. */
268
+ androidCertSha256?: readonly string[];
269
+ /** Where rate-limit counts go: `counterRateLimit(store)`. Without it, Better Auth's database storage. */
270
+ rateLimitStorage?: BetterAuthRateLimitStorage;
271
+ /** Bun's argon2id (`@jgb-solutions/kit/auth/bun`); without it, Better Auth's scrypt. */
272
+ password?: PasswordHasher;
273
+ /** The name of a readable "signed in" cookie, when cached public pages need one. */
274
+ signedInFlag?: string;
275
+ /** Removes the account's own data before it is deleted. Without it, accounts can't delete themselves. */
276
+ beforeDeleteUser?: (user: {
277
+ id: string;
278
+ }) => Promise<void>;
279
+ /** Sessions last this many days (30), renewed once a day while in use. */
280
+ sessionDays?: number;
281
+ /** IP headers for rate limits, in order: only ones your proxy sets (`cf-connecting-ip` by default). */
282
+ ipAddressHeaders?: string[];
283
+ /** The app's own plugins, after the standard ones. */
284
+ plugins?: BetterAuthPlugin[];
285
+ /** Must stay last: `tanstackStartCookies()` on TanStack Start, so server functions can set cookies. */
286
+ lastPlugin?: BetterAuthPlugin;
287
+ };
288
+ /**
289
+ * The standard Better Auth options, for `betterAuth(standardAuthOptions({...}))`: username and email
290
+ * sign-in with a password (no email ever sent: nothing to verify, no reset link), passkeys, Google
291
+ * when its keys are set (it joins only confirmed accounts; a username from the name), roles through the admin
292
+ * plugin with the first admins from ADMIN_EMAILS (confirmed addresses only), the bearer plugin for the mobile app, rate limits,
293
+ * 30-day sessions and a 5-minute cookie cache.
294
+ */
295
+ export declare function standardAuthOptions<A extends AdminOptions>(input: StandardAuthInput<A>): {
296
+ advanced: {
297
+ ipAddress: {
298
+ ipAddressHeaders: string[];
299
+ };
300
+ };
301
+ plugins: [{
302
+ id: "username";
303
+ version: string;
304
+ init(ctx: import("better-auth").AuthContext): {
305
+ options: {
306
+ databaseHooks: {
307
+ user: {
308
+ create: {
309
+ before(user: {
310
+ id: string;
311
+ createdAt: Date;
312
+ updatedAt: Date;
313
+ email: string;
314
+ emailVerified: boolean;
315
+ name: string;
316
+ image?: string | null | undefined;
317
+ } & Record<string, unknown>, context: import("better-auth").GenericEndpointContext | null): Promise<{
318
+ data: {
319
+ displayUsername?: string | undefined;
320
+ username: string;
321
+ id: string;
322
+ createdAt: Date;
323
+ updatedAt: Date;
324
+ email: string;
325
+ emailVerified: boolean;
326
+ name: string;
327
+ image?: string | null | undefined;
328
+ };
329
+ } | {
330
+ data: {
331
+ displayUsername?: string | undefined;
332
+ id: string;
333
+ createdAt: Date;
334
+ updatedAt: Date;
335
+ email: string;
336
+ emailVerified: boolean;
337
+ name: string;
338
+ image?: string | null | undefined;
339
+ };
340
+ }>;
341
+ };
342
+ update: {
343
+ before(user: Partial<{
344
+ id: string;
345
+ createdAt: Date;
346
+ updatedAt: Date;
347
+ email: string;
348
+ emailVerified: boolean;
349
+ name: string;
350
+ image?: string | null | undefined;
351
+ }> & Record<string, unknown>, context: import("better-auth").GenericEndpointContext | null): Promise<{
352
+ data: {
353
+ displayUsername?: string | undefined;
354
+ username: string;
355
+ id?: string | undefined;
356
+ createdAt?: Date | undefined;
357
+ updatedAt?: Date | undefined;
358
+ email?: string | undefined;
359
+ emailVerified?: boolean | undefined;
360
+ name?: string | undefined;
361
+ image?: string | null | undefined;
362
+ };
363
+ } | {
364
+ data: {
365
+ displayUsername?: string | undefined;
366
+ id?: string | undefined;
367
+ createdAt?: Date | undefined;
368
+ updatedAt?: Date | undefined;
369
+ email?: string | undefined;
370
+ emailVerified?: boolean | undefined;
371
+ name?: string | undefined;
372
+ image?: string | null | undefined;
373
+ };
374
+ }>;
375
+ };
376
+ };
377
+ };
378
+ };
379
+ };
380
+ endpoints: {
381
+ signInUsername: import("better-call").StrictEndpoint<"/sign-in/username", {
382
+ method: "POST";
383
+ body: import("zod").ZodObject<{
384
+ username: import("zod").ZodString;
385
+ password: import("zod").ZodString;
386
+ rememberMe: import("zod").ZodOptional<import("zod").ZodBoolean>;
387
+ callbackURL: import("zod").ZodOptional<import("zod").ZodString>;
388
+ }, import("zod/v4/core").$strip>;
389
+ metadata: {
390
+ openapi: {
391
+ summary: string;
392
+ description: string;
393
+ responses: {
394
+ 200: {
395
+ description: string;
396
+ content: {
397
+ "application/json": {
398
+ schema: {
399
+ type: "object";
400
+ properties: {
401
+ redirect: {
402
+ type: string;
403
+ description: string;
404
+ };
405
+ token: {
406
+ type: string;
407
+ description: string;
408
+ };
409
+ url: {
410
+ type: string;
411
+ nullable: boolean;
412
+ description: string;
413
+ };
414
+ user: {
415
+ $ref: string;
416
+ };
417
+ };
418
+ required: string[];
419
+ };
420
+ };
421
+ };
422
+ };
423
+ 422: {
424
+ description: string;
425
+ content: {
426
+ "application/json": {
427
+ schema: {
428
+ type: "object";
429
+ properties: {
430
+ message: {
431
+ type: string;
432
+ };
433
+ };
434
+ };
435
+ };
436
+ };
437
+ };
438
+ };
439
+ };
440
+ };
441
+ }, {
442
+ redirect: boolean;
443
+ token: string;
444
+ url: string | undefined;
445
+ user: {
446
+ id: string;
447
+ createdAt: Date;
448
+ updatedAt: Date;
449
+ email: string;
450
+ emailVerified: boolean;
451
+ name: string;
452
+ image?: string | null | undefined;
453
+ } & {
454
+ username: string;
455
+ displayUsername: string;
456
+ };
457
+ }>;
458
+ isUsernameAvailable: import("better-call").StrictEndpoint<"/is-username-available", {
459
+ method: "POST";
460
+ body: import("zod").ZodObject<{
461
+ username: import("zod").ZodString;
462
+ }, import("zod/v4/core").$strip>;
463
+ }, {
464
+ available: boolean;
465
+ }>;
466
+ };
467
+ schema: {
468
+ user: {
469
+ fields: {
470
+ username: {
471
+ type: "string";
472
+ required: false;
473
+ sortable: true;
474
+ unique: true;
475
+ returned: true;
476
+ transform: {
477
+ input(value: import("better-auth").DBPrimitive): string | number | boolean | Date | unknown[] | Record<string, unknown> | null | undefined;
478
+ };
479
+ };
480
+ displayUsername: {
481
+ type: "string";
482
+ required: false;
483
+ transform: {
484
+ input(value: import("better-auth").DBPrimitive): string | number | boolean | Date | unknown[] | Record<string, unknown> | null | undefined;
485
+ };
486
+ };
487
+ };
488
+ };
489
+ };
490
+ hooks: {
491
+ before: {
492
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
493
+ handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
494
+ }[];
495
+ };
496
+ options: import("better-auth/plugins").UsernameOptions | undefined;
497
+ $ERROR_CODES: {
498
+ EMAIL_NOT_VERIFIED: import("better-auth").RawError<"EMAIL_NOT_VERIFIED">;
499
+ UNEXPECTED_ERROR: import("better-auth").RawError<"UNEXPECTED_ERROR">;
500
+ INVALID_USERNAME_OR_PASSWORD: import("better-auth").RawError<"INVALID_USERNAME_OR_PASSWORD">;
501
+ USERNAME_IS_ALREADY_TAKEN: import("better-auth").RawError<"USERNAME_IS_ALREADY_TAKEN">;
502
+ USERNAME_TOO_SHORT: import("better-auth").RawError<"USERNAME_TOO_SHORT">;
503
+ USERNAME_TOO_LONG: import("better-auth").RawError<"USERNAME_TOO_LONG">;
504
+ INVALID_USERNAME: import("better-auth").RawError<"INVALID_USERNAME">;
505
+ INVALID_DISPLAY_USERNAME: import("better-auth").RawError<"INVALID_DISPLAY_USERNAME">;
506
+ USERNAME_IS_IMMUTABLE: import("better-auth").RawError<"USERNAME_IS_IMMUTABLE">;
507
+ };
508
+ }, {
509
+ id: "passkey";
510
+ version: string;
511
+ init(ctx: import("better-auth").AuthContext): {
512
+ context: {
513
+ passkeyBaseURLFromRequest: boolean;
514
+ passkeyWildcardCoversRpID: boolean;
515
+ };
516
+ };
517
+ endpoints: {
518
+ generatePasskeyRegistrationOptions: import("better-call").StrictEndpoint<"/passkey/generate-register-options", {
519
+ method: "GET";
520
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
521
+ session: {
522
+ session: Record<string, any> & {
523
+ id: string;
524
+ createdAt: Date;
525
+ updatedAt: Date;
526
+ userId: string;
527
+ expiresAt: Date;
528
+ token: string;
529
+ ipAddress?: string | null | undefined;
530
+ userAgent?: string | null | undefined;
531
+ };
532
+ user: Record<string, any> & {
533
+ id: string;
534
+ createdAt: Date;
535
+ updatedAt: Date;
536
+ email: string;
537
+ emailVerified: boolean;
538
+ name: string;
539
+ image?: string | null | undefined;
540
+ };
541
+ };
542
+ }>>[];
543
+ query: import("zod").ZodOptional<import("zod").ZodObject<{
544
+ authenticatorAttachment: import("zod").ZodOptional<import("zod").ZodEnum<{
545
+ platform: "platform";
546
+ "cross-platform": "cross-platform";
547
+ }>>;
548
+ name: import("zod").ZodOptional<import("zod").ZodString>;
549
+ context: import("zod").ZodOptional<import("zod").ZodString>;
550
+ }, import("zod/v4/core").$strip>>;
551
+ metadata: {
552
+ openapi: {
553
+ operationId: string;
554
+ description: string;
555
+ parameters: import("better-call").OpenAPIParameter[];
556
+ responses: {
557
+ 200: {
558
+ description: string;
559
+ content: {
560
+ "application/json": {
561
+ schema: {
562
+ type: "object";
563
+ properties: {
564
+ challenge: {
565
+ type: string;
566
+ };
567
+ rp: {
568
+ type: string;
569
+ properties: {
570
+ name: {
571
+ type: string;
572
+ };
573
+ id: {
574
+ type: string;
575
+ };
576
+ };
577
+ };
578
+ user: {
579
+ type: string;
580
+ properties: {
581
+ id: {
582
+ type: string;
583
+ };
584
+ name: {
585
+ type: string;
586
+ };
587
+ displayName: {
588
+ type: string;
589
+ };
590
+ };
591
+ };
592
+ pubKeyCredParams: {
593
+ type: string;
594
+ items: {
595
+ type: string;
596
+ properties: {
597
+ type: {
598
+ type: string;
599
+ };
600
+ alg: {
601
+ type: string;
602
+ };
603
+ };
604
+ };
605
+ };
606
+ timeout: {
607
+ type: string;
608
+ };
609
+ excludeCredentials: {
610
+ type: string;
611
+ items: {
612
+ type: string;
613
+ properties: {
614
+ id: {
615
+ type: string;
616
+ };
617
+ type: {
618
+ type: string;
619
+ };
620
+ transports: {
621
+ type: string;
622
+ items: {
623
+ type: string;
624
+ };
625
+ };
626
+ };
627
+ };
628
+ };
629
+ authenticatorSelection: {
630
+ type: string;
631
+ properties: {
632
+ authenticatorAttachment: {
633
+ type: string;
634
+ };
635
+ requireResidentKey: {
636
+ type: string;
637
+ };
638
+ userVerification: {
639
+ type: string;
640
+ };
641
+ };
642
+ };
643
+ attestation: {
644
+ type: string;
645
+ };
646
+ extensions: {
647
+ type: string;
648
+ };
649
+ };
650
+ };
651
+ };
652
+ };
653
+ };
654
+ };
655
+ };
656
+ };
657
+ }, import("@simplewebauthn/server").PublicKeyCredentialCreationOptionsJSON>;
658
+ generatePasskeyAuthenticationOptions: import("better-call").StrictEndpoint<"/passkey/generate-authenticate-options", {
659
+ method: "GET";
660
+ metadata: {
661
+ openapi: {
662
+ operationId: string;
663
+ description: string;
664
+ responses: {
665
+ 200: {
666
+ description: string;
667
+ content: {
668
+ "application/json": {
669
+ schema: {
670
+ type: "object";
671
+ properties: {
672
+ challenge: {
673
+ type: string;
674
+ };
675
+ rp: {
676
+ type: string;
677
+ properties: {
678
+ name: {
679
+ type: string;
680
+ };
681
+ id: {
682
+ type: string;
683
+ };
684
+ };
685
+ };
686
+ user: {
687
+ type: string;
688
+ properties: {
689
+ id: {
690
+ type: string;
691
+ };
692
+ name: {
693
+ type: string;
694
+ };
695
+ displayName: {
696
+ type: string;
697
+ };
698
+ };
699
+ };
700
+ timeout: {
701
+ type: string;
702
+ };
703
+ allowCredentials: {
704
+ type: string;
705
+ items: {
706
+ type: string;
707
+ properties: {
708
+ id: {
709
+ type: string;
710
+ };
711
+ type: {
712
+ type: string;
713
+ };
714
+ transports: {
715
+ type: string;
716
+ items: {
717
+ type: string;
718
+ };
719
+ };
720
+ };
721
+ };
722
+ };
723
+ userVerification: {
724
+ type: string;
725
+ };
726
+ authenticatorSelection: {
727
+ type: string;
728
+ properties: {
729
+ authenticatorAttachment: {
730
+ type: string;
731
+ };
732
+ requireResidentKey: {
733
+ type: string;
734
+ };
735
+ userVerification: {
736
+ type: string;
737
+ };
738
+ };
739
+ };
740
+ extensions: {
741
+ type: string;
742
+ };
743
+ };
744
+ };
745
+ };
746
+ };
747
+ };
748
+ };
749
+ };
750
+ };
751
+ }, import("@simplewebauthn/server").PublicKeyCredentialRequestOptionsJSON>;
752
+ verifyPasskeyRegistration: import("better-call").StrictEndpoint<"/passkey/verify-registration", {
753
+ method: "POST";
754
+ body: import("zod").ZodObject<{
755
+ response: import("zod").ZodAny;
756
+ name: import("zod").ZodOptional<import("zod").ZodString>;
757
+ createSession: import("zod").ZodOptional<import("zod").ZodBoolean>;
758
+ }, import("zod/v4/core").$strip>;
759
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
760
+ session: {
761
+ session: Record<string, any> & {
762
+ id: string;
763
+ createdAt: Date;
764
+ updatedAt: Date;
765
+ userId: string;
766
+ expiresAt: Date;
767
+ token: string;
768
+ ipAddress?: string | null | undefined;
769
+ userAgent?: string | null | undefined;
770
+ };
771
+ user: Record<string, any> & {
772
+ id: string;
773
+ createdAt: Date;
774
+ updatedAt: Date;
775
+ email: string;
776
+ emailVerified: boolean;
777
+ name: string;
778
+ image?: string | null | undefined;
779
+ };
780
+ };
781
+ }>>[];
782
+ metadata: {
783
+ openapi: {
784
+ operationId: string;
785
+ description: string;
786
+ responses: {
787
+ 200: {
788
+ description: string;
789
+ content: {
790
+ "application/json": {
791
+ schema: {
792
+ readonly type: "object";
793
+ readonly allOf: readonly [{
794
+ readonly $ref: "#/components/schemas/Passkey";
795
+ }, {
796
+ readonly type: "object";
797
+ readonly properties: {
798
+ readonly session: {
799
+ readonly $ref: "#/components/schemas/Session";
800
+ };
801
+ readonly user: {
802
+ readonly $ref: "#/components/schemas/User";
803
+ };
804
+ };
805
+ }];
806
+ };
807
+ };
808
+ };
809
+ };
810
+ 400: {
811
+ description: string;
812
+ };
813
+ };
814
+ };
815
+ };
816
+ }, import("@better-auth/passkey").Passkey>;
817
+ verifyPasskeyAuthentication: import("better-call").StrictEndpoint<"/passkey/verify-authentication", {
818
+ method: "POST";
819
+ body: import("zod").ZodObject<{
820
+ response: import("zod").ZodRecord<import("zod").ZodAny, import("zod").ZodAny>;
821
+ }, import("zod/v4/core").$strip>;
822
+ metadata: {
823
+ openapi: {
824
+ operationId: string;
825
+ description: string;
826
+ responses: {
827
+ 200: {
828
+ description: string;
829
+ content: {
830
+ "application/json": {
831
+ schema: {
832
+ type: "object";
833
+ properties: {
834
+ session: {
835
+ $ref: string;
836
+ };
837
+ user: {
838
+ $ref: string;
839
+ };
840
+ };
841
+ };
842
+ };
843
+ };
844
+ };
845
+ };
846
+ };
847
+ $Infer: {
848
+ body: {
849
+ response: import("@simplewebauthn/server").AuthenticationResponseJSON;
850
+ };
851
+ };
852
+ };
853
+ }, {
854
+ session: {
855
+ id: string;
856
+ createdAt: Date;
857
+ updatedAt: Date;
858
+ userId: string;
859
+ expiresAt: Date;
860
+ token: string;
861
+ ipAddress?: string | null | undefined;
862
+ userAgent?: string | null | undefined;
863
+ };
864
+ user: {
865
+ id: string;
866
+ createdAt: Date;
867
+ updatedAt: Date;
868
+ email: string;
869
+ emailVerified: boolean;
870
+ name: string;
871
+ image?: string | null | undefined;
872
+ };
873
+ }>;
874
+ listPasskeys: import("better-call").StrictEndpoint<"/passkey/list-user-passkeys", {
875
+ method: "GET";
876
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
877
+ session: {
878
+ session: Record<string, any> & {
879
+ id: string;
880
+ createdAt: Date;
881
+ updatedAt: Date;
882
+ userId: string;
883
+ expiresAt: Date;
884
+ token: string;
885
+ ipAddress?: string | null | undefined;
886
+ userAgent?: string | null | undefined;
887
+ };
888
+ user: Record<string, any> & {
889
+ id: string;
890
+ createdAt: Date;
891
+ updatedAt: Date;
892
+ email: string;
893
+ emailVerified: boolean;
894
+ name: string;
895
+ image?: string | null | undefined;
896
+ };
897
+ };
898
+ }>>[];
899
+ metadata: {
900
+ openapi: {
901
+ description: string;
902
+ responses: {
903
+ "200": {
904
+ description: string;
905
+ content: {
906
+ "application/json": {
907
+ schema: {
908
+ type: "array";
909
+ items: {
910
+ $ref: string;
911
+ required: string[];
912
+ };
913
+ description: string;
914
+ };
915
+ };
916
+ };
917
+ };
918
+ };
919
+ };
920
+ };
921
+ }, import("@better-auth/passkey").Passkey[]>;
922
+ deletePasskey: import("better-call").StrictEndpoint<"/passkey/delete-passkey", {
923
+ method: "POST";
924
+ body: import("zod").ZodObject<{
925
+ id: import("zod").ZodString;
926
+ }, import("zod/v4/core").$strip>;
927
+ use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
928
+ session: {
929
+ session: Record<string, any> & {
930
+ id: string;
931
+ createdAt: Date;
932
+ updatedAt: Date;
933
+ userId: string;
934
+ expiresAt: Date;
935
+ token: string;
936
+ ipAddress?: string | null | undefined;
937
+ userAgent?: string | null | undefined;
938
+ };
939
+ user: Record<string, any> & {
940
+ id: string;
941
+ createdAt: Date;
942
+ updatedAt: Date;
943
+ email: string;
944
+ emailVerified: boolean;
945
+ name: string;
946
+ image?: string | null | undefined;
947
+ };
948
+ };
949
+ }>> | import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
950
+ verifiedResource: {};
951
+ }>>)[];
952
+ metadata: {
953
+ openapi: {
954
+ description: string;
955
+ responses: {
956
+ "200": {
957
+ description: string;
958
+ content: {
959
+ "application/json": {
960
+ schema: {
961
+ type: "object";
962
+ properties: {
963
+ status: {
964
+ type: string;
965
+ description: string;
966
+ };
967
+ };
968
+ required: string[];
969
+ };
970
+ };
971
+ };
972
+ };
973
+ };
974
+ };
975
+ };
976
+ }, {
977
+ status: boolean;
978
+ }>;
979
+ updatePasskey: import("better-call").StrictEndpoint<"/passkey/update-passkey", {
980
+ method: "POST";
981
+ body: import("zod").ZodObject<{
982
+ id: import("zod").ZodString;
983
+ name: import("zod").ZodString;
984
+ }, import("zod/v4/core").$strip>;
985
+ use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
986
+ session: {
987
+ session: Record<string, any> & {
988
+ id: string;
989
+ createdAt: Date;
990
+ updatedAt: Date;
991
+ userId: string;
992
+ expiresAt: Date;
993
+ token: string;
994
+ ipAddress?: string | null | undefined;
995
+ userAgent?: string | null | undefined;
996
+ };
997
+ user: Record<string, any> & {
998
+ id: string;
999
+ createdAt: Date;
1000
+ updatedAt: Date;
1001
+ email: string;
1002
+ emailVerified: boolean;
1003
+ name: string;
1004
+ image?: string | null | undefined;
1005
+ };
1006
+ };
1007
+ }>> | import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1008
+ verifiedResource: {};
1009
+ }>>)[];
1010
+ metadata: {
1011
+ openapi: {
1012
+ description: string;
1013
+ responses: {
1014
+ "200": {
1015
+ description: string;
1016
+ content: {
1017
+ "application/json": {
1018
+ schema: {
1019
+ type: "object";
1020
+ properties: {
1021
+ passkey: {
1022
+ $ref: string;
1023
+ };
1024
+ };
1025
+ required: string[];
1026
+ };
1027
+ };
1028
+ };
1029
+ };
1030
+ };
1031
+ };
1032
+ };
1033
+ }, {
1034
+ passkey: import("@better-auth/passkey").Passkey;
1035
+ }>;
1036
+ };
1037
+ schema: {
1038
+ passkey: {
1039
+ fields: {
1040
+ name: {
1041
+ type: "string";
1042
+ required: false;
1043
+ };
1044
+ publicKey: {
1045
+ type: "string";
1046
+ required: true;
1047
+ };
1048
+ userId: {
1049
+ type: "string";
1050
+ references: {
1051
+ model: string;
1052
+ field: string;
1053
+ };
1054
+ required: true;
1055
+ index: true;
1056
+ };
1057
+ credentialID: {
1058
+ type: "string";
1059
+ required: true;
1060
+ index: true;
1061
+ };
1062
+ counter: {
1063
+ type: "number";
1064
+ required: true;
1065
+ };
1066
+ deviceType: {
1067
+ type: "string";
1068
+ required: true;
1069
+ };
1070
+ backedUp: {
1071
+ type: "boolean";
1072
+ required: true;
1073
+ };
1074
+ transports: {
1075
+ type: "string";
1076
+ required: false;
1077
+ };
1078
+ createdAt: {
1079
+ type: "date";
1080
+ required: false;
1081
+ };
1082
+ aaguid: {
1083
+ type: "string";
1084
+ required: false;
1085
+ };
1086
+ };
1087
+ };
1088
+ };
1089
+ $ERROR_CODES: {
1090
+ ORIGIN_NOT_CONFIGURED: import("better-auth").RawError<"ORIGIN_NOT_CONFIGURED">;
1091
+ CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
1092
+ YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
1093
+ FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
1094
+ PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
1095
+ AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
1096
+ UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
1097
+ USER_NOT_FOUND: import("better-auth").RawError<"USER_NOT_FOUND">;
1098
+ FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
1099
+ PREVIOUSLY_REGISTERED: import("better-auth").RawError<"PREVIOUSLY_REGISTERED">;
1100
+ REGISTRATION_CANCELLED: import("better-auth").RawError<"REGISTRATION_CANCELLED">;
1101
+ AUTH_CANCELLED: import("better-auth").RawError<"AUTH_CANCELLED">;
1102
+ UNKNOWN_ERROR: import("better-auth").RawError<"UNKNOWN_ERROR">;
1103
+ SESSION_REQUIRED: import("better-auth").RawError<"SESSION_REQUIRED">;
1104
+ RESOLVE_USER_REQUIRED: import("better-auth").RawError<"RESOLVE_USER_REQUIRED">;
1105
+ RESOLVED_USER_INVALID: import("better-auth").RawError<"RESOLVED_USER_INVALID">;
1106
+ };
1107
+ options: import("@better-auth/passkey").PasskeyOptions | undefined;
1108
+ }, {
1109
+ id: "admin";
1110
+ version: string;
1111
+ init(authContext: import("better-auth").AuthContext): {
1112
+ options: {
1113
+ databaseHooks: {
1114
+ user: {
1115
+ create: {
1116
+ before(user: {
1117
+ id: string;
1118
+ createdAt: Date;
1119
+ updatedAt: Date;
1120
+ email: string;
1121
+ emailVerified: boolean;
1122
+ name: string;
1123
+ image?: string | null | undefined;
1124
+ } & Record<string, unknown>): Promise<{
1125
+ data: {
1126
+ id: string;
1127
+ createdAt: Date;
1128
+ updatedAt: Date;
1129
+ email: string;
1130
+ emailVerified: boolean;
1131
+ name: string;
1132
+ image?: string | null | undefined;
1133
+ role: string;
1134
+ };
1135
+ }>;
1136
+ };
1137
+ };
1138
+ session: {
1139
+ create: {
1140
+ before(session: {
1141
+ id: string;
1142
+ createdAt: Date;
1143
+ updatedAt: Date;
1144
+ userId: string;
1145
+ expiresAt: Date;
1146
+ token: string;
1147
+ ipAddress?: string | null | undefined;
1148
+ userAgent?: string | null | undefined;
1149
+ } & Record<string, unknown>, ctx: import("better-auth").GenericEndpointContext | null): Promise<void>;
1150
+ };
1151
+ };
1152
+ };
1153
+ };
1154
+ };
1155
+ hooks: {
1156
+ after: {
1157
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
1158
+ handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<import("better-auth/plugins").SessionWithImpersonatedBy[] | undefined>>;
1159
+ }[];
1160
+ };
1161
+ endpoints: {
1162
+ setRole: import("better-call").StrictEndpoint<"/admin/set-role", {
1163
+ method: "POST";
1164
+ body: import("zod").ZodObject<{
1165
+ userId: import("zod").ZodCoercedString<unknown>;
1166
+ role: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>;
1167
+ }, import("zod/v4/core").$strip>;
1168
+ requireHeaders: true;
1169
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1170
+ session: {
1171
+ user: import("better-auth/plugins").UserWithRole;
1172
+ session: {
1173
+ id: string;
1174
+ createdAt: Date;
1175
+ updatedAt: Date;
1176
+ userId: string;
1177
+ expiresAt: Date;
1178
+ token: string;
1179
+ ipAddress?: string | null | undefined;
1180
+ userAgent?: string | null | undefined;
1181
+ };
1182
+ };
1183
+ }>>[];
1184
+ metadata: {
1185
+ openapi: {
1186
+ operationId: string;
1187
+ summary: string;
1188
+ description: string;
1189
+ responses: {
1190
+ 200: {
1191
+ description: string;
1192
+ content: {
1193
+ "application/json": {
1194
+ schema: {
1195
+ type: "object";
1196
+ properties: {
1197
+ user: {
1198
+ $ref: string;
1199
+ };
1200
+ };
1201
+ };
1202
+ };
1203
+ };
1204
+ };
1205
+ };
1206
+ };
1207
+ $Infer: {
1208
+ body: {
1209
+ userId: string;
1210
+ role: import("better-auth/plugins").InferAdminRolesFromOption<A & {
1211
+ defaultRole: string;
1212
+ adminRoles: string[];
1213
+ } & Required<Pick<AdminOptions, "defaultRole" | "adminRoles" | "bannedUserMessage">>> | import("better-auth/plugins").InferAdminRolesFromOption<A & {
1214
+ defaultRole: string;
1215
+ adminRoles: string[];
1216
+ } & Required<Pick<AdminOptions, "defaultRole" | "adminRoles" | "bannedUserMessage">>>[];
1217
+ };
1218
+ };
1219
+ };
1220
+ }, {
1221
+ user: import("better-auth/plugins").UserWithRole;
1222
+ }>;
1223
+ getUser: import("better-call").StrictEndpoint<"/admin/get-user", {
1224
+ method: "GET";
1225
+ query: import("zod").ZodObject<{
1226
+ id: import("zod").ZodString;
1227
+ }, import("zod/v4/core").$strip>;
1228
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1229
+ session: {
1230
+ user: import("better-auth/plugins").UserWithRole;
1231
+ session: {
1232
+ id: string;
1233
+ createdAt: Date;
1234
+ updatedAt: Date;
1235
+ userId: string;
1236
+ expiresAt: Date;
1237
+ token: string;
1238
+ ipAddress?: string | null | undefined;
1239
+ userAgent?: string | null | undefined;
1240
+ };
1241
+ };
1242
+ }>>[];
1243
+ metadata: {
1244
+ openapi: {
1245
+ operationId: string;
1246
+ summary: string;
1247
+ description: string;
1248
+ responses: {
1249
+ 200: {
1250
+ description: string;
1251
+ content: {
1252
+ "application/json": {
1253
+ schema: {
1254
+ type: "object";
1255
+ properties: {
1256
+ user: {
1257
+ $ref: string;
1258
+ };
1259
+ };
1260
+ };
1261
+ };
1262
+ };
1263
+ };
1264
+ };
1265
+ };
1266
+ };
1267
+ }, import("better-auth/plugins").UserWithRole>;
1268
+ createUser: import("better-call").StrictEndpoint<"/admin/create-user", {
1269
+ method: "POST";
1270
+ body: import("zod").ZodObject<{
1271
+ email: import("zod").ZodString;
1272
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1273
+ name: import("zod").ZodString;
1274
+ role: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
1275
+ data: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
1276
+ }, import("zod/v4/core").$strip>;
1277
+ metadata: {
1278
+ openapi: {
1279
+ operationId: string;
1280
+ summary: string;
1281
+ description: string;
1282
+ responses: {
1283
+ 200: {
1284
+ description: string;
1285
+ content: {
1286
+ "application/json": {
1287
+ schema: {
1288
+ type: "object";
1289
+ properties: {
1290
+ user: {
1291
+ $ref: string;
1292
+ };
1293
+ };
1294
+ };
1295
+ };
1296
+ };
1297
+ };
1298
+ };
1299
+ };
1300
+ $Infer: {
1301
+ body: {
1302
+ email: string;
1303
+ password?: string | undefined;
1304
+ name: string;
1305
+ role?: import("better-auth/plugins").InferAdminRolesFromOption<A & {
1306
+ defaultRole: string;
1307
+ adminRoles: string[];
1308
+ } & Required<Pick<AdminOptions, "defaultRole" | "adminRoles" | "bannedUserMessage">>> | import("better-auth/plugins").InferAdminRolesFromOption<A & {
1309
+ defaultRole: string;
1310
+ adminRoles: string[];
1311
+ } & Required<Pick<AdminOptions, "defaultRole" | "adminRoles" | "bannedUserMessage">>>[] | undefined;
1312
+ data?: Record<string, any> | undefined;
1313
+ };
1314
+ };
1315
+ };
1316
+ }, {
1317
+ user: import("better-auth/plugins").UserWithRole;
1318
+ }>;
1319
+ adminUpdateUser: import("better-call").StrictEndpoint<"/admin/update-user", {
1320
+ method: "POST";
1321
+ body: import("zod").ZodObject<{
1322
+ userId: import("zod").ZodCoercedString<unknown>;
1323
+ data: import("zod").ZodRecord<import("zod").ZodAny, import("zod").ZodAny>;
1324
+ }, import("zod/v4/core").$strip>;
1325
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1326
+ session: {
1327
+ user: import("better-auth/plugins").UserWithRole;
1328
+ session: {
1329
+ id: string;
1330
+ createdAt: Date;
1331
+ updatedAt: Date;
1332
+ userId: string;
1333
+ expiresAt: Date;
1334
+ token: string;
1335
+ ipAddress?: string | null | undefined;
1336
+ userAgent?: string | null | undefined;
1337
+ };
1338
+ };
1339
+ }>>[];
1340
+ metadata: {
1341
+ openapi: {
1342
+ operationId: string;
1343
+ summary: string;
1344
+ description: string;
1345
+ responses: {
1346
+ 200: {
1347
+ description: string;
1348
+ content: {
1349
+ "application/json": {
1350
+ schema: {
1351
+ type: "object";
1352
+ properties: {
1353
+ user: {
1354
+ $ref: string;
1355
+ };
1356
+ };
1357
+ };
1358
+ };
1359
+ };
1360
+ };
1361
+ };
1362
+ };
1363
+ };
1364
+ }, import("better-auth/plugins").UserWithRole>;
1365
+ listUsers: import("better-call").StrictEndpoint<"/admin/list-users", {
1366
+ method: "GET";
1367
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1368
+ session: {
1369
+ user: import("better-auth/plugins").UserWithRole;
1370
+ session: {
1371
+ id: string;
1372
+ createdAt: Date;
1373
+ updatedAt: Date;
1374
+ userId: string;
1375
+ expiresAt: Date;
1376
+ token: string;
1377
+ ipAddress?: string | null | undefined;
1378
+ userAgent?: string | null | undefined;
1379
+ };
1380
+ };
1381
+ }>>[];
1382
+ query: import("zod").ZodObject<{
1383
+ searchValue: import("zod").ZodOptional<import("zod").ZodString>;
1384
+ searchField: import("zod").ZodOptional<import("zod").ZodEnum<{
1385
+ email: "email";
1386
+ name: "name";
1387
+ }>>;
1388
+ searchOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
1389
+ contains: "contains";
1390
+ starts_with: "starts_with";
1391
+ ends_with: "ends_with";
1392
+ }>>;
1393
+ limit: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
1394
+ offset: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
1395
+ sortBy: import("zod").ZodOptional<import("zod").ZodString>;
1396
+ sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
1397
+ asc: "asc";
1398
+ desc: "desc";
1399
+ }>>;
1400
+ filterField: import("zod").ZodOptional<import("zod").ZodString>;
1401
+ filterValue: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, import("zod").ZodBoolean]>, import("zod").ZodArray<import("zod").ZodString>]>, import("zod").ZodArray<import("zod").ZodNumber>]>>;
1402
+ filterOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
1403
+ in: "in";
1404
+ lte: "lte";
1405
+ eq: "eq";
1406
+ ne: "ne";
1407
+ lt: "lt";
1408
+ gt: "gt";
1409
+ gte: "gte";
1410
+ not_in: "not_in";
1411
+ contains: "contains";
1412
+ starts_with: "starts_with";
1413
+ ends_with: "ends_with";
1414
+ }>>;
1415
+ }, import("zod/v4/core").$strip>;
1416
+ metadata: {
1417
+ openapi: {
1418
+ operationId: string;
1419
+ summary: string;
1420
+ description: string;
1421
+ responses: {
1422
+ 200: {
1423
+ description: string;
1424
+ content: {
1425
+ "application/json": {
1426
+ schema: {
1427
+ type: "object";
1428
+ properties: {
1429
+ users: {
1430
+ type: string;
1431
+ items: {
1432
+ $ref: string;
1433
+ };
1434
+ };
1435
+ total: {
1436
+ type: string;
1437
+ };
1438
+ limit: {
1439
+ type: string;
1440
+ };
1441
+ offset: {
1442
+ type: string;
1443
+ };
1444
+ };
1445
+ required: string[];
1446
+ };
1447
+ };
1448
+ };
1449
+ };
1450
+ };
1451
+ };
1452
+ };
1453
+ }, {
1454
+ users: import("better-auth/plugins").UserWithRole[];
1455
+ total: number;
1456
+ }>;
1457
+ listUserSessions: import("better-call").StrictEndpoint<"/admin/list-user-sessions", {
1458
+ method: "POST";
1459
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1460
+ session: {
1461
+ user: import("better-auth/plugins").UserWithRole;
1462
+ session: {
1463
+ id: string;
1464
+ createdAt: Date;
1465
+ updatedAt: Date;
1466
+ userId: string;
1467
+ expiresAt: Date;
1468
+ token: string;
1469
+ ipAddress?: string | null | undefined;
1470
+ userAgent?: string | null | undefined;
1471
+ };
1472
+ };
1473
+ }>>[];
1474
+ body: import("zod").ZodObject<{
1475
+ userId: import("zod").ZodCoercedString<unknown>;
1476
+ }, import("zod/v4/core").$strip>;
1477
+ metadata: {
1478
+ openapi: {
1479
+ operationId: string;
1480
+ summary: string;
1481
+ description: string;
1482
+ responses: {
1483
+ 200: {
1484
+ description: string;
1485
+ content: {
1486
+ "application/json": {
1487
+ schema: {
1488
+ type: "object";
1489
+ properties: {
1490
+ sessions: {
1491
+ type: string;
1492
+ items: {
1493
+ $ref: string;
1494
+ };
1495
+ };
1496
+ };
1497
+ };
1498
+ };
1499
+ };
1500
+ };
1501
+ };
1502
+ };
1503
+ };
1504
+ }, {
1505
+ sessions: import("better-auth/plugins").SessionWithImpersonatedBy[];
1506
+ }>;
1507
+ unbanUser: import("better-call").StrictEndpoint<"/admin/unban-user", {
1508
+ method: "POST";
1509
+ body: import("zod").ZodObject<{
1510
+ userId: import("zod").ZodCoercedString<unknown>;
1511
+ }, import("zod/v4/core").$strip>;
1512
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1513
+ session: {
1514
+ user: import("better-auth/plugins").UserWithRole;
1515
+ session: {
1516
+ id: string;
1517
+ createdAt: Date;
1518
+ updatedAt: Date;
1519
+ userId: string;
1520
+ expiresAt: Date;
1521
+ token: string;
1522
+ ipAddress?: string | null | undefined;
1523
+ userAgent?: string | null | undefined;
1524
+ };
1525
+ };
1526
+ }>>[];
1527
+ metadata: {
1528
+ openapi: {
1529
+ operationId: string;
1530
+ summary: string;
1531
+ description: string;
1532
+ responses: {
1533
+ 200: {
1534
+ description: string;
1535
+ content: {
1536
+ "application/json": {
1537
+ schema: {
1538
+ type: "object";
1539
+ properties: {
1540
+ user: {
1541
+ $ref: string;
1542
+ };
1543
+ };
1544
+ };
1545
+ };
1546
+ };
1547
+ };
1548
+ };
1549
+ };
1550
+ };
1551
+ }, {
1552
+ user: import("better-auth/plugins").UserWithRole;
1553
+ }>;
1554
+ banUser: import("better-call").StrictEndpoint<"/admin/ban-user", {
1555
+ method: "POST";
1556
+ body: import("zod").ZodObject<{
1557
+ userId: import("zod").ZodCoercedString<unknown>;
1558
+ banReason: import("zod").ZodOptional<import("zod").ZodString>;
1559
+ banExpiresIn: import("zod").ZodOptional<import("zod").ZodNumber>;
1560
+ }, import("zod/v4/core").$strip>;
1561
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1562
+ session: {
1563
+ user: import("better-auth/plugins").UserWithRole;
1564
+ session: {
1565
+ id: string;
1566
+ createdAt: Date;
1567
+ updatedAt: Date;
1568
+ userId: string;
1569
+ expiresAt: Date;
1570
+ token: string;
1571
+ ipAddress?: string | null | undefined;
1572
+ userAgent?: string | null | undefined;
1573
+ };
1574
+ };
1575
+ }>>[];
1576
+ metadata: {
1577
+ openapi: {
1578
+ operationId: string;
1579
+ summary: string;
1580
+ description: string;
1581
+ responses: {
1582
+ 200: {
1583
+ description: string;
1584
+ content: {
1585
+ "application/json": {
1586
+ schema: {
1587
+ type: "object";
1588
+ properties: {
1589
+ user: {
1590
+ $ref: string;
1591
+ };
1592
+ };
1593
+ };
1594
+ };
1595
+ };
1596
+ };
1597
+ };
1598
+ };
1599
+ };
1600
+ }, {
1601
+ user: import("better-auth/plugins").UserWithRole;
1602
+ }>;
1603
+ impersonateUser: import("better-call").StrictEndpoint<"/admin/impersonate-user", {
1604
+ method: "POST";
1605
+ body: import("zod").ZodObject<{
1606
+ userId: import("zod").ZodCoercedString<unknown>;
1607
+ }, import("zod/v4/core").$strip>;
1608
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1609
+ session: {
1610
+ user: import("better-auth/plugins").UserWithRole;
1611
+ session: {
1612
+ id: string;
1613
+ createdAt: Date;
1614
+ updatedAt: Date;
1615
+ userId: string;
1616
+ expiresAt: Date;
1617
+ token: string;
1618
+ ipAddress?: string | null | undefined;
1619
+ userAgent?: string | null | undefined;
1620
+ };
1621
+ };
1622
+ }>>[];
1623
+ metadata: {
1624
+ openapi: {
1625
+ operationId: string;
1626
+ summary: string;
1627
+ description: string;
1628
+ responses: {
1629
+ 200: {
1630
+ description: string;
1631
+ content: {
1632
+ "application/json": {
1633
+ schema: {
1634
+ type: "object";
1635
+ properties: {
1636
+ session: {
1637
+ $ref: string;
1638
+ };
1639
+ user: {
1640
+ $ref: string;
1641
+ };
1642
+ };
1643
+ };
1644
+ };
1645
+ };
1646
+ };
1647
+ };
1648
+ };
1649
+ };
1650
+ }, {
1651
+ session: {
1652
+ id: string;
1653
+ createdAt: Date;
1654
+ updatedAt: Date;
1655
+ userId: string;
1656
+ expiresAt: Date;
1657
+ token: string;
1658
+ ipAddress?: string | null | undefined;
1659
+ userAgent?: string | null | undefined;
1660
+ };
1661
+ user: import("better-auth/plugins").UserWithRole;
1662
+ }>;
1663
+ stopImpersonating: import("better-call").StrictEndpoint<"/admin/stop-impersonating", {
1664
+ method: "POST";
1665
+ requireHeaders: true;
1666
+ }, {
1667
+ session: {
1668
+ id: string;
1669
+ createdAt: Date;
1670
+ updatedAt: Date;
1671
+ userId: string;
1672
+ expiresAt: Date;
1673
+ token: string;
1674
+ ipAddress?: string | null | undefined;
1675
+ userAgent?: string | null | undefined;
1676
+ } & Record<string, any>;
1677
+ user: {
1678
+ id: string;
1679
+ createdAt: Date;
1680
+ updatedAt: Date;
1681
+ email: string;
1682
+ emailVerified: boolean;
1683
+ name: string;
1684
+ image?: string | null | undefined;
1685
+ } & Record<string, any>;
1686
+ }>;
1687
+ revokeUserSession: import("better-call").StrictEndpoint<"/admin/revoke-user-session", {
1688
+ method: "POST";
1689
+ body: import("zod").ZodObject<{
1690
+ sessionToken: import("zod").ZodString;
1691
+ }, import("zod/v4/core").$strip>;
1692
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1693
+ session: {
1694
+ user: import("better-auth/plugins").UserWithRole;
1695
+ session: {
1696
+ id: string;
1697
+ createdAt: Date;
1698
+ updatedAt: Date;
1699
+ userId: string;
1700
+ expiresAt: Date;
1701
+ token: string;
1702
+ ipAddress?: string | null | undefined;
1703
+ userAgent?: string | null | undefined;
1704
+ };
1705
+ };
1706
+ }>>[];
1707
+ metadata: {
1708
+ openapi: {
1709
+ operationId: string;
1710
+ summary: string;
1711
+ description: string;
1712
+ responses: {
1713
+ 200: {
1714
+ description: string;
1715
+ content: {
1716
+ "application/json": {
1717
+ schema: {
1718
+ type: "object";
1719
+ properties: {
1720
+ success: {
1721
+ type: string;
1722
+ };
1723
+ };
1724
+ };
1725
+ };
1726
+ };
1727
+ };
1728
+ };
1729
+ };
1730
+ };
1731
+ }, {
1732
+ success: boolean;
1733
+ }>;
1734
+ revokeUserSessions: import("better-call").StrictEndpoint<"/admin/revoke-user-sessions", {
1735
+ method: "POST";
1736
+ body: import("zod").ZodObject<{
1737
+ userId: import("zod").ZodCoercedString<unknown>;
1738
+ }, import("zod/v4/core").$strip>;
1739
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1740
+ session: {
1741
+ user: import("better-auth/plugins").UserWithRole;
1742
+ session: {
1743
+ id: string;
1744
+ createdAt: Date;
1745
+ updatedAt: Date;
1746
+ userId: string;
1747
+ expiresAt: Date;
1748
+ token: string;
1749
+ ipAddress?: string | null | undefined;
1750
+ userAgent?: string | null | undefined;
1751
+ };
1752
+ };
1753
+ }>>[];
1754
+ metadata: {
1755
+ openapi: {
1756
+ operationId: string;
1757
+ summary: string;
1758
+ description: string;
1759
+ responses: {
1760
+ 200: {
1761
+ description: string;
1762
+ content: {
1763
+ "application/json": {
1764
+ schema: {
1765
+ type: "object";
1766
+ properties: {
1767
+ success: {
1768
+ type: string;
1769
+ };
1770
+ };
1771
+ };
1772
+ };
1773
+ };
1774
+ };
1775
+ };
1776
+ };
1777
+ };
1778
+ }, {
1779
+ success: boolean;
1780
+ }>;
1781
+ removeUser: import("better-call").StrictEndpoint<"/admin/remove-user", {
1782
+ method: "POST";
1783
+ body: import("zod").ZodObject<{
1784
+ userId: import("zod").ZodCoercedString<unknown>;
1785
+ }, import("zod/v4/core").$strip>;
1786
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1787
+ session: {
1788
+ user: import("better-auth/plugins").UserWithRole;
1789
+ session: {
1790
+ id: string;
1791
+ createdAt: Date;
1792
+ updatedAt: Date;
1793
+ userId: string;
1794
+ expiresAt: Date;
1795
+ token: string;
1796
+ ipAddress?: string | null | undefined;
1797
+ userAgent?: string | null | undefined;
1798
+ };
1799
+ };
1800
+ }>>[];
1801
+ metadata: {
1802
+ openapi: {
1803
+ operationId: string;
1804
+ summary: string;
1805
+ description: string;
1806
+ responses: {
1807
+ 200: {
1808
+ description: string;
1809
+ content: {
1810
+ "application/json": {
1811
+ schema: {
1812
+ type: "object";
1813
+ properties: {
1814
+ success: {
1815
+ type: string;
1816
+ };
1817
+ };
1818
+ };
1819
+ };
1820
+ };
1821
+ };
1822
+ };
1823
+ };
1824
+ };
1825
+ }, {
1826
+ success: boolean;
1827
+ }>;
1828
+ setUserPassword: import("better-call").StrictEndpoint<"/admin/set-user-password", {
1829
+ method: "POST";
1830
+ body: import("zod").ZodObject<{
1831
+ newPassword: import("zod").ZodString;
1832
+ userId: import("zod").ZodCoercedString<unknown>;
1833
+ }, import("zod/v4/core").$strip>;
1834
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1835
+ session: {
1836
+ user: import("better-auth/plugins").UserWithRole;
1837
+ session: {
1838
+ id: string;
1839
+ createdAt: Date;
1840
+ updatedAt: Date;
1841
+ userId: string;
1842
+ expiresAt: Date;
1843
+ token: string;
1844
+ ipAddress?: string | null | undefined;
1845
+ userAgent?: string | null | undefined;
1846
+ };
1847
+ };
1848
+ }>>[];
1849
+ metadata: {
1850
+ openapi: {
1851
+ operationId: string;
1852
+ summary: string;
1853
+ description: string;
1854
+ responses: {
1855
+ 200: {
1856
+ description: string;
1857
+ content: {
1858
+ "application/json": {
1859
+ schema: {
1860
+ type: "object";
1861
+ properties: {
1862
+ status: {
1863
+ type: string;
1864
+ };
1865
+ };
1866
+ };
1867
+ };
1868
+ };
1869
+ };
1870
+ };
1871
+ };
1872
+ };
1873
+ }, {
1874
+ status: boolean;
1875
+ }>;
1876
+ userHasPermission: import("better-call").StrictEndpoint<"/admin/has-permission", {
1877
+ method: "POST";
1878
+ body: import("zod").ZodIntersection<import("zod").ZodObject<{
1879
+ userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
1880
+ role: import("zod").ZodOptional<import("zod").ZodString>;
1881
+ }, import("zod/v4/core").$strip>, import("zod").ZodXor<readonly [import("zod").ZodObject<{
1882
+ permission: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
1883
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1884
+ permissions: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
1885
+ }, import("zod/v4/core").$strip>]>>;
1886
+ metadata: {
1887
+ openapi: {
1888
+ description: string;
1889
+ requestBody: {
1890
+ content: {
1891
+ "application/json": {
1892
+ schema: {
1893
+ type: "object";
1894
+ properties: {
1895
+ permissions: {
1896
+ type: string;
1897
+ description: string;
1898
+ };
1899
+ };
1900
+ required: string[];
1901
+ };
1902
+ };
1903
+ };
1904
+ };
1905
+ responses: {
1906
+ "200": {
1907
+ description: string;
1908
+ content: {
1909
+ "application/json": {
1910
+ schema: {
1911
+ type: "object";
1912
+ properties: {
1913
+ error: {
1914
+ type: string;
1915
+ };
1916
+ success: {
1917
+ type: string;
1918
+ };
1919
+ };
1920
+ required: string[];
1921
+ };
1922
+ };
1923
+ };
1924
+ };
1925
+ };
1926
+ };
1927
+ $Infer: {
1928
+ body: {
1929
+ permissions: { [key in keyof ((A & {
1930
+ defaultRole: string;
1931
+ adminRoles: string[];
1932
+ })["ac"] extends import("better-auth/plugins").AccessControl<infer S extends import("better-auth/plugins").Statements> ? S : {
1933
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "set-phone", "get", "update"];
1934
+ readonly session: readonly ["list", "revoke", "delete"];
1935
+ })]?: (((A & {
1936
+ defaultRole: string;
1937
+ adminRoles: string[];
1938
+ })["ac"] extends import("better-auth/plugins").AccessControl<infer S_1 extends import("better-auth/plugins").Statements> ? S_1 : {
1939
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "set-phone", "get", "update"];
1940
+ readonly session: readonly ["list", "revoke", "delete"];
1941
+ })[key] extends readonly unknown[] ? import("better-auth/plugins").ArrayElement<((A & {
1942
+ defaultRole: string;
1943
+ adminRoles: string[];
1944
+ })["ac"] extends import("better-auth/plugins").AccessControl<infer S_2 extends import("better-auth/plugins").Statements> ? S_2 : {
1945
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "set-phone", "get", "update"];
1946
+ readonly session: readonly ["list", "revoke", "delete"];
1947
+ })[key]> : never)[] | undefined; };
1948
+ } & {
1949
+ userId?: string | undefined;
1950
+ role?: import("better-auth/plugins").InferAdminRolesFromOption<A & {
1951
+ defaultRole: string;
1952
+ adminRoles: string[];
1953
+ }> | undefined;
1954
+ };
1955
+ };
1956
+ };
1957
+ }, {
1958
+ error: null;
1959
+ success: boolean;
1960
+ }>;
1961
+ };
1962
+ $ERROR_CODES: {
1963
+ USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: import("better-auth").RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
1964
+ FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;
1965
+ USER_ALREADY_EXISTS: import("better-auth").RawError<"USER_ALREADY_EXISTS">;
1966
+ YOU_CANNOT_BAN_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_BAN_YOURSELF">;
1967
+ YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">;
1968
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">;
1969
+ YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">;
1970
+ YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">;
1971
+ YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">;
1972
+ YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">;
1973
+ YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">;
1974
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">;
1975
+ YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">;
1976
+ BANNED_USER: import("better-auth").RawError<"BANNED_USER">;
1977
+ YOU_ARE_NOT_ALLOWED_TO_GET_USER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">;
1978
+ NO_DATA_TO_UPDATE: import("better-auth").RawError<"NO_DATA_TO_UPDATE">;
1979
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">;
1980
+ YOU_CANNOT_REMOVE_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_REMOVE_YOURSELF">;
1981
+ YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">;
1982
+ YOU_CANNOT_IMPERSONATE_ADMINS: import("better-auth").RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">;
1983
+ INVALID_ROLE_TYPE: import("better-auth").RawError<"INVALID_ROLE_TYPE">;
1984
+ YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">;
1985
+ YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PHONE_NUMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PHONE_NUMBER">;
1986
+ PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: import("better-auth").RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">;
1987
+ USER_ID_CANNOT_BE_UPDATED: import("better-auth").RawError<"USER_ID_CANNOT_BE_UPDATED">;
1988
+ };
1989
+ schema: {
1990
+ user: {
1991
+ fields: {
1992
+ role: {
1993
+ type: "string";
1994
+ required: false;
1995
+ input: false;
1996
+ };
1997
+ banned: {
1998
+ type: "boolean";
1999
+ defaultValue: false;
2000
+ required: false;
2001
+ input: false;
2002
+ };
2003
+ banReason: {
2004
+ type: "string";
2005
+ required: false;
2006
+ input: false;
2007
+ };
2008
+ banExpires: {
2009
+ type: "date";
2010
+ required: false;
2011
+ input: false;
2012
+ };
2013
+ };
2014
+ };
2015
+ session: {
2016
+ fields: {
2017
+ impersonatedBy: {
2018
+ type: "string";
2019
+ required: false;
2020
+ input: false;
2021
+ };
2022
+ };
2023
+ };
2024
+ };
2025
+ options: NoInfer<A & {
2026
+ defaultRole: string;
2027
+ adminRoles: string[];
2028
+ }>;
2029
+ }, {
2030
+ id: "bearer";
2031
+ version: string;
2032
+ hooks: {
2033
+ before: {
2034
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
2035
+ handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2036
+ context: {
2037
+ headers: Headers;
2038
+ };
2039
+ } | undefined>>;
2040
+ }[];
2041
+ after: {
2042
+ matcher(context: import("better-auth").HookEndpointContext): true;
2043
+ handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
2044
+ }[];
2045
+ };
2046
+ options: import("better-auth/plugins").BearerOptions | undefined;
2047
+ }, ...BetterAuthPlugin[]];
2048
+ hooks?: {
2049
+ after: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
2050
+ };
2051
+ rateLimit: {
2052
+ customStorage: BetterAuthRateLimitStorage;
2053
+ enabled: boolean;
2054
+ window: number;
2055
+ max: number;
2056
+ customRules: {
2057
+ '/sign-in/email': {
2058
+ readonly window: 60;
2059
+ readonly max: 10;
2060
+ };
2061
+ '/sign-in/username': {
2062
+ readonly window: 60;
2063
+ readonly max: 10;
2064
+ };
2065
+ '/sign-up/email': {
2066
+ readonly window: number;
2067
+ readonly max: 5;
2068
+ };
2069
+ '/sign-in/social': {
2070
+ readonly window: 60;
2071
+ readonly max: 10;
2072
+ };
2073
+ '/callback/*': {
2074
+ readonly window: 60;
2075
+ readonly max: 10;
2076
+ };
2077
+ '/passkey/*': {
2078
+ readonly window: 60;
2079
+ readonly max: 20;
2080
+ };
2081
+ '/change-password': {
2082
+ readonly window: 60;
2083
+ readonly max: 5;
2084
+ };
2085
+ '/set-password': {
2086
+ readonly window: 60;
2087
+ readonly max: 5;
2088
+ };
2089
+ '/delete-user': {
2090
+ readonly window: 60;
2091
+ readonly max: 5;
2092
+ };
2093
+ };
2094
+ } | {
2095
+ storage: "database";
2096
+ enabled: boolean;
2097
+ window: number;
2098
+ max: number;
2099
+ customRules: {
2100
+ '/sign-in/email': {
2101
+ readonly window: 60;
2102
+ readonly max: 10;
2103
+ };
2104
+ '/sign-in/username': {
2105
+ readonly window: 60;
2106
+ readonly max: 10;
2107
+ };
2108
+ '/sign-up/email': {
2109
+ readonly window: number;
2110
+ readonly max: 5;
2111
+ };
2112
+ '/sign-in/social': {
2113
+ readonly window: 60;
2114
+ readonly max: 10;
2115
+ };
2116
+ '/callback/*': {
2117
+ readonly window: 60;
2118
+ readonly max: 10;
2119
+ };
2120
+ '/passkey/*': {
2121
+ readonly window: 60;
2122
+ readonly max: 20;
2123
+ };
2124
+ '/change-password': {
2125
+ readonly window: 60;
2126
+ readonly max: 5;
2127
+ };
2128
+ '/set-password': {
2129
+ readonly window: 60;
2130
+ readonly max: 5;
2131
+ };
2132
+ '/delete-user': {
2133
+ readonly window: 60;
2134
+ readonly max: 5;
2135
+ };
2136
+ };
2137
+ };
2138
+ databaseHooks: {
2139
+ user: {
2140
+ create: {
2141
+ before: (user: {
2142
+ email: string;
2143
+ name: string;
2144
+ } & Record<string, unknown>) => Promise<{
2145
+ data: Record<string, unknown>;
2146
+ }>;
2147
+ };
2148
+ };
2149
+ account: {
2150
+ create: {
2151
+ after: (account: {
2152
+ providerId: string;
2153
+ userId: string;
2154
+ idToken?: string | null | undefined;
2155
+ }, ctx: AccountHookContext | null) => Promise<void>;
2156
+ };
2157
+ };
2158
+ };
2159
+ user?: {
2160
+ deleteUser: {
2161
+ enabled: true;
2162
+ beforeDelete: (user: {
2163
+ id: string;
2164
+ }) => Promise<void>;
2165
+ };
2166
+ };
2167
+ account: {
2168
+ accountLinking: {
2169
+ enabled: boolean;
2170
+ trustedProviders: string[];
2171
+ requireLocalEmailVerified: boolean;
2172
+ allowDifferentEmails: boolean;
2173
+ updateUserInfoOnLink: boolean;
2174
+ };
2175
+ };
2176
+ session: {
2177
+ expiresIn: number;
2178
+ updateAge: number;
2179
+ cookieCache: {
2180
+ enabled: true;
2181
+ maxAge: number;
2182
+ };
2183
+ };
2184
+ socialProviders?: {
2185
+ google: {
2186
+ clientId: string[];
2187
+ clientSecret: string;
2188
+ disableImplicitSignUp: boolean;
2189
+ prompt: "select_account";
2190
+ };
2191
+ };
2192
+ appName: string;
2193
+ baseURL: {
2194
+ allowedHosts: string[];
2195
+ protocol: "auto";
2196
+ fallback: string;
2197
+ };
2198
+ secret: string;
2199
+ database: any;
2200
+ emailAndPassword: {
2201
+ password?: PasswordHasher;
2202
+ enabled: true;
2203
+ disableSignUp: boolean;
2204
+ requireEmailVerification: false;
2205
+ minPasswordLength: 12;
2206
+ maxPasswordLength: 128;
2207
+ };
2208
+ };
2209
+ export {};