@jgb-solutions/kit 0.1.1 → 0.2.0

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