@aphexcms/auth 0.1.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.
@@ -0,0 +1,1965 @@
1
+ import type { AphexAuthConfig } from './types.js';
2
+ /**
3
+ * Builds the better-auth instance from an app's adapters.
4
+ *
5
+ * Everything the studio used to configure by hand lives here — session cookie
6
+ * cache, API-key plugin, rate limits, the CMS user-profile sync, and the
7
+ * password-reset / verification email flows.
8
+ */
9
+ export declare function createAuthInstance(config: AphexAuthConfig): import("better-auth").Auth<{
10
+ plugins: ({
11
+ id: "api-key";
12
+ version: string;
13
+ $ERROR_CODES: {
14
+ INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
15
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
16
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
17
+ USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
18
+ UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
19
+ KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
20
+ KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
21
+ KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
22
+ USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
23
+ KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
24
+ EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
25
+ EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
26
+ INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
27
+ INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
28
+ INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
29
+ METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
30
+ RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
31
+ NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
32
+ KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
33
+ INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
34
+ INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
35
+ INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
36
+ INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
37
+ SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
38
+ FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
39
+ NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
40
+ ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
41
+ USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
42
+ INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
43
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
44
+ ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
45
+ };
46
+ hooks: {
47
+ before: {
48
+ matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
49
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
50
+ user: {
51
+ id: string;
52
+ createdAt: Date;
53
+ updatedAt: Date;
54
+ email: string;
55
+ emailVerified: boolean;
56
+ name: string;
57
+ image?: string | null | undefined;
58
+ };
59
+ session: {
60
+ id: string;
61
+ token: string;
62
+ userId: string;
63
+ userAgent: string | null;
64
+ ipAddress: string | null;
65
+ createdAt: Date;
66
+ updatedAt: Date;
67
+ expiresAt: Date;
68
+ };
69
+ } | {
70
+ context: import("better-auth").MiddlewareContext<import("better-auth").MiddlewareOptions, {
71
+ returned?: unknown | undefined;
72
+ responseHeaders?: Headers | undefined;
73
+ } & import("better-auth").PluginContext<import("better-auth").BetterAuthOptions> & import("better-auth").InfoContext & {
74
+ options: import("better-auth").BetterAuthOptions;
75
+ trustedOrigins: string[];
76
+ trustedProviders: string[];
77
+ isTrustedOrigin: (url: string, settings?: {
78
+ allowRelativePaths: boolean;
79
+ }) => boolean;
80
+ oauthConfig: {
81
+ skipStateCookieCheck?: boolean | undefined;
82
+ storeStateStrategy: "database" | "cookie";
83
+ };
84
+ newSession: {
85
+ session: {
86
+ id: string;
87
+ createdAt: Date;
88
+ updatedAt: Date;
89
+ userId: string;
90
+ expiresAt: Date;
91
+ token: string;
92
+ ipAddress?: string | null | undefined;
93
+ userAgent?: string | null | undefined;
94
+ } & Record<string, any>;
95
+ user: {
96
+ id: string;
97
+ createdAt: Date;
98
+ updatedAt: Date;
99
+ email: string;
100
+ emailVerified: boolean;
101
+ name: string;
102
+ image?: string | null | undefined;
103
+ } & Record<string, any>;
104
+ } | null;
105
+ session: {
106
+ session: {
107
+ id: string;
108
+ createdAt: Date;
109
+ updatedAt: Date;
110
+ userId: string;
111
+ expiresAt: Date;
112
+ token: string;
113
+ ipAddress?: string | null | undefined;
114
+ userAgent?: string | null | undefined;
115
+ } & Record<string, any>;
116
+ user: {
117
+ id: string;
118
+ createdAt: Date;
119
+ updatedAt: Date;
120
+ email: string;
121
+ emailVerified: boolean;
122
+ name: string;
123
+ image?: string | null | undefined;
124
+ } & Record<string, any>;
125
+ } | null;
126
+ setNewSession: (session: {
127
+ session: {
128
+ id: string;
129
+ createdAt: Date;
130
+ updatedAt: Date;
131
+ userId: string;
132
+ expiresAt: Date;
133
+ token: string;
134
+ ipAddress?: string | null | undefined;
135
+ userAgent?: string | null | undefined;
136
+ } & Record<string, any>;
137
+ user: {
138
+ id: string;
139
+ createdAt: Date;
140
+ updatedAt: Date;
141
+ email: string;
142
+ emailVerified: boolean;
143
+ name: string;
144
+ image?: string | null | undefined;
145
+ } & Record<string, any>;
146
+ } | null) => void;
147
+ socialProviders: import("better-auth").OAuthProvider[];
148
+ authCookies: import("better-auth").BetterAuthCookies;
149
+ logger: ReturnType<typeof import("better-auth").createLogger>;
150
+ rateLimit: {
151
+ enabled: boolean;
152
+ window: number;
153
+ max: number;
154
+ storage: "memory" | "database" | "secondary-storage";
155
+ } & Omit<import("better-auth").BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
156
+ adapter: import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
157
+ internalAdapter: import("better-auth").InternalAdapter<import("better-auth").BetterAuthOptions>;
158
+ createAuthCookie: (cookieName: string, overrideAttributes?: Partial<import("better-auth").CookieOptions> | undefined) => import("better-auth").BetterAuthCookie;
159
+ secret: string;
160
+ secretConfig: string | import("better-auth").SecretConfig;
161
+ sessionConfig: {
162
+ updateAge: number;
163
+ expiresIn: number;
164
+ freshAge: number;
165
+ cookieRefreshCache: false | {
166
+ enabled: true;
167
+ updateAge: number;
168
+ };
169
+ };
170
+ generateId: (options: {
171
+ model: import("better-auth").ModelNames;
172
+ size?: number | undefined;
173
+ }) => string | false;
174
+ secondaryStorage: import("better-auth").SecondaryStorage | undefined;
175
+ password: {
176
+ hash: (password: string) => Promise<string>;
177
+ verify: (data: {
178
+ password: string;
179
+ hash: string;
180
+ }) => Promise<boolean>;
181
+ config: {
182
+ minPasswordLength: number;
183
+ maxPasswordLength: number;
184
+ };
185
+ checkPassword: (userId: string, ctx: import("better-auth").GenericEndpointContext<import("better-auth").BetterAuthOptions>) => Promise<boolean>;
186
+ };
187
+ tables: import("better-auth").BetterAuthDBSchema;
188
+ runMigrations: () => Promise<void>;
189
+ publishTelemetry: (event: {
190
+ type: string;
191
+ anonymousId?: string | undefined;
192
+ payload: Record<string, any>;
193
+ }) => Promise<void>;
194
+ skipOriginCheck: boolean | string[];
195
+ skipCSRFCheck: boolean;
196
+ runInBackground: (promise: Promise<unknown>) => void;
197
+ runInBackgroundOrAwait: (promise: Promise<unknown> | void) => import("better-auth").Awaitable<unknown>;
198
+ }>;
199
+ }>;
200
+ }[];
201
+ };
202
+ endpoints: {
203
+ createApiKey: import("better-auth").StrictEndpoint<"/api-key/create", {
204
+ method: "POST";
205
+ body: import("zod").ZodObject<{
206
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
207
+ name: import("zod").ZodOptional<import("zod").ZodString>;
208
+ expiresIn: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
209
+ prefix: import("zod").ZodOptional<import("zod").ZodString>;
210
+ remaining: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
211
+ metadata: import("zod").ZodOptional<import("zod").ZodAny>;
212
+ refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
213
+ refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
214
+ rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
215
+ rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
216
+ rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
217
+ permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
218
+ userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
219
+ organizationId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
220
+ }, import("zod/v4/core").$strip>;
221
+ metadata: {
222
+ openapi: {
223
+ description: string;
224
+ responses: {
225
+ "200": {
226
+ description: string;
227
+ content: {
228
+ "application/json": {
229
+ schema: {
230
+ type: "object";
231
+ properties: {
232
+ id: {
233
+ type: string;
234
+ description: string;
235
+ };
236
+ createdAt: {
237
+ type: string;
238
+ format: string;
239
+ description: string;
240
+ };
241
+ updatedAt: {
242
+ type: string;
243
+ format: string;
244
+ description: string;
245
+ };
246
+ name: {
247
+ type: string;
248
+ nullable: boolean;
249
+ description: string;
250
+ };
251
+ prefix: {
252
+ type: string;
253
+ nullable: boolean;
254
+ description: string;
255
+ };
256
+ start: {
257
+ type: string;
258
+ nullable: boolean;
259
+ description: string;
260
+ };
261
+ key: {
262
+ type: string;
263
+ description: string;
264
+ };
265
+ enabled: {
266
+ type: string;
267
+ description: string;
268
+ };
269
+ expiresAt: {
270
+ type: string;
271
+ format: string;
272
+ nullable: boolean;
273
+ description: string;
274
+ };
275
+ referenceId: {
276
+ type: string;
277
+ description: string;
278
+ };
279
+ lastRefillAt: {
280
+ type: string;
281
+ format: string;
282
+ nullable: boolean;
283
+ description: string;
284
+ };
285
+ lastRequest: {
286
+ type: string;
287
+ format: string;
288
+ nullable: boolean;
289
+ description: string;
290
+ };
291
+ metadata: {
292
+ type: string;
293
+ nullable: boolean;
294
+ additionalProperties: boolean;
295
+ description: string;
296
+ };
297
+ rateLimitMax: {
298
+ type: string;
299
+ nullable: boolean;
300
+ description: string;
301
+ };
302
+ rateLimitTimeWindow: {
303
+ type: string;
304
+ nullable: boolean;
305
+ description: string;
306
+ };
307
+ remaining: {
308
+ type: string;
309
+ nullable: boolean;
310
+ description: string;
311
+ };
312
+ refillAmount: {
313
+ type: string;
314
+ nullable: boolean;
315
+ description: string;
316
+ };
317
+ refillInterval: {
318
+ type: string;
319
+ nullable: boolean;
320
+ description: string;
321
+ };
322
+ rateLimitEnabled: {
323
+ type: string;
324
+ description: string;
325
+ };
326
+ requestCount: {
327
+ type: string;
328
+ description: string;
329
+ };
330
+ permissions: {
331
+ type: string;
332
+ nullable: boolean;
333
+ additionalProperties: {
334
+ type: string;
335
+ items: {
336
+ type: string;
337
+ };
338
+ };
339
+ description: string;
340
+ };
341
+ };
342
+ required: string[];
343
+ };
344
+ };
345
+ };
346
+ };
347
+ };
348
+ };
349
+ };
350
+ }, {
351
+ key: string;
352
+ metadata: any;
353
+ permissions: any;
354
+ id: string;
355
+ configId: string;
356
+ name: string | null;
357
+ start: string | null;
358
+ prefix: string | null;
359
+ referenceId: string;
360
+ refillInterval: number | null;
361
+ refillAmount: number | null;
362
+ lastRefillAt: Date | null;
363
+ enabled: boolean;
364
+ rateLimitEnabled: boolean;
365
+ rateLimitTimeWindow: number | null;
366
+ rateLimitMax: number | null;
367
+ requestCount: number;
368
+ remaining: number | null;
369
+ lastRequest: Date | null;
370
+ expiresAt: Date | null;
371
+ createdAt: Date;
372
+ updatedAt: Date;
373
+ }>;
374
+ verifyApiKey: import("better-auth").StrictEndpoint<string, {
375
+ method: "POST";
376
+ body: import("zod").ZodObject<{
377
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
378
+ key: import("zod").ZodString;
379
+ permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
380
+ }, import("zod/v4/core").$strip>;
381
+ }, {
382
+ valid: boolean;
383
+ error: {
384
+ message: import("better-auth").RawError<"INVALID_API_KEY">;
385
+ code: "KEY_NOT_FOUND";
386
+ };
387
+ key: null;
388
+ } | {
389
+ valid: boolean;
390
+ error: {
391
+ message: string | undefined;
392
+ code: string;
393
+ cause?: unknown;
394
+ };
395
+ key: null;
396
+ } | {
397
+ valid: boolean;
398
+ error: {
399
+ message: import("better-auth").RawError<"INVALID_API_KEY">;
400
+ code: "INVALID_API_KEY";
401
+ };
402
+ key: null;
403
+ } | {
404
+ valid: boolean;
405
+ error: null;
406
+ key: Omit<import("@better-auth/api-key").ApiKey, "key"> | null;
407
+ }>;
408
+ getApiKey: import("better-auth").StrictEndpoint<"/api-key/get", {
409
+ method: "GET";
410
+ query: import("zod").ZodObject<{
411
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
412
+ id: import("zod").ZodString;
413
+ }, import("zod/v4/core").$strip>;
414
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
415
+ session: {
416
+ session: Record<string, any> & {
417
+ id: string;
418
+ createdAt: Date;
419
+ updatedAt: Date;
420
+ userId: string;
421
+ expiresAt: Date;
422
+ token: string;
423
+ ipAddress?: string | null | undefined;
424
+ userAgent?: string | null | undefined;
425
+ };
426
+ user: Record<string, any> & {
427
+ id: string;
428
+ createdAt: Date;
429
+ updatedAt: Date;
430
+ email: string;
431
+ emailVerified: boolean;
432
+ name: string;
433
+ image?: string | null | undefined;
434
+ };
435
+ };
436
+ }>)[];
437
+ metadata: {
438
+ openapi: {
439
+ description: string;
440
+ responses: {
441
+ "200": {
442
+ description: string;
443
+ content: {
444
+ "application/json": {
445
+ schema: {
446
+ type: "object";
447
+ properties: {
448
+ id: {
449
+ type: string;
450
+ description: string;
451
+ };
452
+ name: {
453
+ type: string;
454
+ nullable: boolean;
455
+ description: string;
456
+ };
457
+ start: {
458
+ type: string;
459
+ nullable: boolean;
460
+ description: string;
461
+ };
462
+ prefix: {
463
+ type: string;
464
+ nullable: boolean;
465
+ description: string;
466
+ };
467
+ userId: {
468
+ type: string;
469
+ description: string;
470
+ };
471
+ refillInterval: {
472
+ type: string;
473
+ nullable: boolean;
474
+ description: string;
475
+ };
476
+ refillAmount: {
477
+ type: string;
478
+ nullable: boolean;
479
+ description: string;
480
+ };
481
+ lastRefillAt: {
482
+ type: string;
483
+ format: string;
484
+ nullable: boolean;
485
+ description: string;
486
+ };
487
+ enabled: {
488
+ type: string;
489
+ description: string;
490
+ default: boolean;
491
+ };
492
+ rateLimitEnabled: {
493
+ type: string;
494
+ description: string;
495
+ };
496
+ rateLimitTimeWindow: {
497
+ type: string;
498
+ nullable: boolean;
499
+ description: string;
500
+ };
501
+ rateLimitMax: {
502
+ type: string;
503
+ nullable: boolean;
504
+ description: string;
505
+ };
506
+ requestCount: {
507
+ type: string;
508
+ description: string;
509
+ };
510
+ remaining: {
511
+ type: string;
512
+ nullable: boolean;
513
+ description: string;
514
+ };
515
+ lastRequest: {
516
+ type: string;
517
+ format: string;
518
+ nullable: boolean;
519
+ description: string;
520
+ };
521
+ expiresAt: {
522
+ type: string;
523
+ format: string;
524
+ nullable: boolean;
525
+ description: string;
526
+ };
527
+ createdAt: {
528
+ type: string;
529
+ format: string;
530
+ description: string;
531
+ };
532
+ updatedAt: {
533
+ type: string;
534
+ format: string;
535
+ description: string;
536
+ };
537
+ metadata: {
538
+ type: string;
539
+ nullable: boolean;
540
+ additionalProperties: boolean;
541
+ description: string;
542
+ };
543
+ permissions: {
544
+ type: string;
545
+ nullable: boolean;
546
+ description: string;
547
+ };
548
+ };
549
+ required: string[];
550
+ };
551
+ };
552
+ };
553
+ };
554
+ };
555
+ };
556
+ };
557
+ }, {
558
+ metadata: Record<string, any> | null;
559
+ permissions: {
560
+ [key: string]: string[];
561
+ } | null;
562
+ id: string;
563
+ configId: string;
564
+ name: string | null;
565
+ start: string | null;
566
+ prefix: string | null;
567
+ referenceId: string;
568
+ refillInterval: number | null;
569
+ refillAmount: number | null;
570
+ lastRefillAt: Date | null;
571
+ enabled: boolean;
572
+ rateLimitEnabled: boolean;
573
+ rateLimitTimeWindow: number | null;
574
+ rateLimitMax: number | null;
575
+ requestCount: number;
576
+ remaining: number | null;
577
+ lastRequest: Date | null;
578
+ expiresAt: Date | null;
579
+ createdAt: Date;
580
+ updatedAt: Date;
581
+ }>;
582
+ updateApiKey: import("better-auth").StrictEndpoint<"/api-key/update", {
583
+ method: "POST";
584
+ body: import("zod").ZodObject<{
585
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
586
+ keyId: import("zod").ZodString;
587
+ userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
588
+ name: import("zod").ZodOptional<import("zod").ZodString>;
589
+ enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
590
+ remaining: import("zod").ZodOptional<import("zod").ZodNumber>;
591
+ refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
592
+ refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
593
+ metadata: import("zod").ZodOptional<import("zod").ZodAny>;
594
+ expiresIn: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>;
595
+ rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
596
+ rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
597
+ rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
598
+ permissions: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>>;
599
+ }, import("zod/v4/core").$strip>;
600
+ metadata: {
601
+ openapi: {
602
+ description: string;
603
+ responses: {
604
+ "200": {
605
+ description: string;
606
+ content: {
607
+ "application/json": {
608
+ schema: {
609
+ type: "object";
610
+ properties: {
611
+ id: {
612
+ type: string;
613
+ description: string;
614
+ };
615
+ name: {
616
+ type: string;
617
+ nullable: boolean;
618
+ description: string;
619
+ };
620
+ start: {
621
+ type: string;
622
+ nullable: boolean;
623
+ description: string;
624
+ };
625
+ prefix: {
626
+ type: string;
627
+ nullable: boolean;
628
+ description: string;
629
+ };
630
+ userId: {
631
+ type: string;
632
+ description: string;
633
+ };
634
+ refillInterval: {
635
+ type: string;
636
+ nullable: boolean;
637
+ description: string;
638
+ };
639
+ refillAmount: {
640
+ type: string;
641
+ nullable: boolean;
642
+ description: string;
643
+ };
644
+ lastRefillAt: {
645
+ type: string;
646
+ format: string;
647
+ nullable: boolean;
648
+ description: string;
649
+ };
650
+ enabled: {
651
+ type: string;
652
+ description: string;
653
+ default: boolean;
654
+ };
655
+ rateLimitEnabled: {
656
+ type: string;
657
+ description: string;
658
+ };
659
+ rateLimitTimeWindow: {
660
+ type: string;
661
+ nullable: boolean;
662
+ description: string;
663
+ };
664
+ rateLimitMax: {
665
+ type: string;
666
+ nullable: boolean;
667
+ description: string;
668
+ };
669
+ requestCount: {
670
+ type: string;
671
+ description: string;
672
+ };
673
+ remaining: {
674
+ type: string;
675
+ nullable: boolean;
676
+ description: string;
677
+ };
678
+ lastRequest: {
679
+ type: string;
680
+ format: string;
681
+ nullable: boolean;
682
+ description: string;
683
+ };
684
+ expiresAt: {
685
+ type: string;
686
+ format: string;
687
+ nullable: boolean;
688
+ description: string;
689
+ };
690
+ createdAt: {
691
+ type: string;
692
+ format: string;
693
+ description: string;
694
+ };
695
+ updatedAt: {
696
+ type: string;
697
+ format: string;
698
+ description: string;
699
+ };
700
+ metadata: {
701
+ type: string;
702
+ nullable: boolean;
703
+ additionalProperties: boolean;
704
+ description: string;
705
+ };
706
+ permissions: {
707
+ type: string;
708
+ nullable: boolean;
709
+ description: string;
710
+ };
711
+ };
712
+ required: string[];
713
+ };
714
+ };
715
+ };
716
+ };
717
+ };
718
+ };
719
+ };
720
+ }, {
721
+ metadata: Record<string, any> | null;
722
+ permissions: {
723
+ [key: string]: string[];
724
+ } | null;
725
+ id: string;
726
+ configId: string;
727
+ name: string | null;
728
+ start: string | null;
729
+ prefix: string | null;
730
+ referenceId: string;
731
+ refillInterval: number | null;
732
+ refillAmount: number | null;
733
+ lastRefillAt: Date | null;
734
+ enabled: boolean;
735
+ rateLimitEnabled: boolean;
736
+ rateLimitTimeWindow: number | null;
737
+ rateLimitMax: number | null;
738
+ requestCount: number;
739
+ remaining: number | null;
740
+ lastRequest: Date | null;
741
+ expiresAt: Date | null;
742
+ createdAt: Date;
743
+ updatedAt: Date;
744
+ }>;
745
+ deleteApiKey: import("better-auth").StrictEndpoint<"/api-key/delete", {
746
+ method: "POST";
747
+ body: import("zod").ZodObject<{
748
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
749
+ keyId: import("zod").ZodString;
750
+ }, import("zod/v4/core").$strip>;
751
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
752
+ session: {
753
+ session: Record<string, any> & {
754
+ id: string;
755
+ createdAt: Date;
756
+ updatedAt: Date;
757
+ userId: string;
758
+ expiresAt: Date;
759
+ token: string;
760
+ ipAddress?: string | null | undefined;
761
+ userAgent?: string | null | undefined;
762
+ };
763
+ user: Record<string, any> & {
764
+ id: string;
765
+ createdAt: Date;
766
+ updatedAt: Date;
767
+ email: string;
768
+ emailVerified: boolean;
769
+ name: string;
770
+ image?: string | null | undefined;
771
+ };
772
+ };
773
+ }>)[];
774
+ metadata: {
775
+ openapi: {
776
+ description: string;
777
+ requestBody: {
778
+ content: {
779
+ "application/json": {
780
+ schema: {
781
+ type: "object";
782
+ properties: {
783
+ keyId: {
784
+ type: string;
785
+ description: string;
786
+ };
787
+ };
788
+ required: string[];
789
+ };
790
+ };
791
+ };
792
+ };
793
+ responses: {
794
+ "200": {
795
+ description: string;
796
+ content: {
797
+ "application/json": {
798
+ schema: {
799
+ type: "object";
800
+ properties: {
801
+ success: {
802
+ type: string;
803
+ description: string;
804
+ };
805
+ };
806
+ required: string[];
807
+ };
808
+ };
809
+ };
810
+ };
811
+ };
812
+ };
813
+ };
814
+ }, {
815
+ success: boolean;
816
+ }>;
817
+ listApiKeys: import("better-auth").StrictEndpoint<"/api-key/list", {
818
+ method: "GET";
819
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
820
+ session: {
821
+ session: Record<string, any> & {
822
+ id: string;
823
+ createdAt: Date;
824
+ updatedAt: Date;
825
+ userId: string;
826
+ expiresAt: Date;
827
+ token: string;
828
+ ipAddress?: string | null | undefined;
829
+ userAgent?: string | null | undefined;
830
+ };
831
+ user: Record<string, any> & {
832
+ id: string;
833
+ createdAt: Date;
834
+ updatedAt: Date;
835
+ email: string;
836
+ emailVerified: boolean;
837
+ name: string;
838
+ image?: string | null | undefined;
839
+ };
840
+ };
841
+ }>)[];
842
+ query: import("zod").ZodOptional<import("zod").ZodObject<{
843
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
844
+ organizationId: import("zod").ZodOptional<import("zod").ZodString>;
845
+ limit: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
846
+ offset: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
847
+ sortBy: import("zod").ZodOptional<import("zod").ZodString>;
848
+ sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
849
+ asc: "asc";
850
+ desc: "desc";
851
+ }>>;
852
+ }, import("zod/v4/core").$strip>>;
853
+ metadata: {
854
+ openapi: {
855
+ description: string;
856
+ responses: {
857
+ "200": {
858
+ description: string;
859
+ content: {
860
+ "application/json": {
861
+ schema: {
862
+ type: "object";
863
+ properties: {
864
+ apiKeys: {
865
+ type: string;
866
+ items: {
867
+ type: string;
868
+ properties: {
869
+ id: {
870
+ type: string;
871
+ description: string;
872
+ };
873
+ name: {
874
+ type: string;
875
+ nullable: boolean;
876
+ description: string;
877
+ };
878
+ start: {
879
+ type: string;
880
+ nullable: boolean;
881
+ description: string;
882
+ };
883
+ prefix: {
884
+ type: string;
885
+ nullable: boolean;
886
+ description: string;
887
+ };
888
+ userId: {
889
+ type: string;
890
+ description: string;
891
+ };
892
+ refillInterval: {
893
+ type: string;
894
+ nullable: boolean;
895
+ description: string;
896
+ };
897
+ refillAmount: {
898
+ type: string;
899
+ nullable: boolean;
900
+ description: string;
901
+ };
902
+ lastRefillAt: {
903
+ type: string;
904
+ format: string;
905
+ nullable: boolean;
906
+ description: string;
907
+ };
908
+ enabled: {
909
+ type: string;
910
+ description: string;
911
+ default: boolean;
912
+ };
913
+ rateLimitEnabled: {
914
+ type: string;
915
+ description: string;
916
+ };
917
+ rateLimitTimeWindow: {
918
+ type: string;
919
+ nullable: boolean;
920
+ description: string;
921
+ };
922
+ rateLimitMax: {
923
+ type: string;
924
+ nullable: boolean;
925
+ description: string;
926
+ };
927
+ requestCount: {
928
+ type: string;
929
+ description: string;
930
+ };
931
+ remaining: {
932
+ type: string;
933
+ nullable: boolean;
934
+ description: string;
935
+ };
936
+ lastRequest: {
937
+ type: string;
938
+ format: string;
939
+ nullable: boolean;
940
+ description: string;
941
+ };
942
+ expiresAt: {
943
+ type: string;
944
+ format: string;
945
+ nullable: boolean;
946
+ description: string;
947
+ };
948
+ createdAt: {
949
+ type: string;
950
+ format: string;
951
+ description: string;
952
+ };
953
+ updatedAt: {
954
+ type: string;
955
+ format: string;
956
+ description: string;
957
+ };
958
+ metadata: {
959
+ type: string;
960
+ nullable: boolean;
961
+ additionalProperties: boolean;
962
+ description: string;
963
+ };
964
+ permissions: {
965
+ type: string;
966
+ nullable: boolean;
967
+ description: string;
968
+ };
969
+ };
970
+ required: string[];
971
+ };
972
+ };
973
+ total: {
974
+ type: string;
975
+ description: string;
976
+ };
977
+ limit: {
978
+ type: string;
979
+ nullable: boolean;
980
+ description: string;
981
+ };
982
+ offset: {
983
+ type: string;
984
+ nullable: boolean;
985
+ description: string;
986
+ };
987
+ };
988
+ required: string[];
989
+ };
990
+ };
991
+ };
992
+ };
993
+ };
994
+ };
995
+ };
996
+ }, {
997
+ apiKeys: {
998
+ metadata: Record<string, any> | null;
999
+ permissions: {
1000
+ [key: string]: string[];
1001
+ } | null;
1002
+ id: string;
1003
+ configId: string;
1004
+ name: string | null;
1005
+ start: string | null;
1006
+ prefix: string | null;
1007
+ referenceId: string;
1008
+ refillInterval: number | null;
1009
+ refillAmount: number | null;
1010
+ lastRefillAt: Date | null;
1011
+ enabled: boolean;
1012
+ rateLimitEnabled: boolean;
1013
+ rateLimitTimeWindow: number | null;
1014
+ rateLimitMax: number | null;
1015
+ requestCount: number;
1016
+ remaining: number | null;
1017
+ lastRequest: Date | null;
1018
+ expiresAt: Date | null;
1019
+ createdAt: Date;
1020
+ updatedAt: Date;
1021
+ }[];
1022
+ total: number;
1023
+ limit: number | undefined;
1024
+ offset: number | undefined;
1025
+ }>;
1026
+ deleteAllExpiredApiKeys: import("better-auth").StrictEndpoint<string, {
1027
+ method: "POST";
1028
+ }, {
1029
+ success: boolean;
1030
+ error: unknown;
1031
+ }>;
1032
+ };
1033
+ schema: {
1034
+ apikey: {
1035
+ fields: {
1036
+ configId: {
1037
+ type: "string";
1038
+ required: true;
1039
+ defaultValue: string;
1040
+ input: false;
1041
+ index: true;
1042
+ };
1043
+ name: {
1044
+ type: "string";
1045
+ required: false;
1046
+ input: false;
1047
+ };
1048
+ start: {
1049
+ type: "string";
1050
+ required: false;
1051
+ input: false;
1052
+ };
1053
+ referenceId: {
1054
+ type: "string";
1055
+ required: true;
1056
+ input: false;
1057
+ index: true;
1058
+ };
1059
+ prefix: {
1060
+ type: "string";
1061
+ required: false;
1062
+ input: false;
1063
+ };
1064
+ key: {
1065
+ type: "string";
1066
+ required: true;
1067
+ input: false;
1068
+ index: true;
1069
+ };
1070
+ refillInterval: {
1071
+ type: "number";
1072
+ required: false;
1073
+ input: false;
1074
+ };
1075
+ refillAmount: {
1076
+ type: "number";
1077
+ required: false;
1078
+ input: false;
1079
+ };
1080
+ lastRefillAt: {
1081
+ type: "date";
1082
+ required: false;
1083
+ input: false;
1084
+ };
1085
+ enabled: {
1086
+ type: "boolean";
1087
+ required: false;
1088
+ input: false;
1089
+ defaultValue: true;
1090
+ };
1091
+ rateLimitEnabled: {
1092
+ type: "boolean";
1093
+ required: false;
1094
+ input: false;
1095
+ defaultValue: true;
1096
+ };
1097
+ rateLimitTimeWindow: {
1098
+ type: "number";
1099
+ required: false;
1100
+ input: false;
1101
+ defaultValue: number;
1102
+ };
1103
+ rateLimitMax: {
1104
+ type: "number";
1105
+ required: false;
1106
+ input: false;
1107
+ defaultValue: number;
1108
+ };
1109
+ requestCount: {
1110
+ type: "number";
1111
+ required: false;
1112
+ input: false;
1113
+ defaultValue: number;
1114
+ };
1115
+ remaining: {
1116
+ type: "number";
1117
+ required: false;
1118
+ input: false;
1119
+ };
1120
+ lastRequest: {
1121
+ type: "date";
1122
+ required: false;
1123
+ input: false;
1124
+ };
1125
+ expiresAt: {
1126
+ type: "date";
1127
+ required: false;
1128
+ input: false;
1129
+ };
1130
+ createdAt: {
1131
+ type: "date";
1132
+ required: true;
1133
+ input: false;
1134
+ };
1135
+ updatedAt: {
1136
+ type: "date";
1137
+ required: true;
1138
+ input: false;
1139
+ };
1140
+ permissions: {
1141
+ type: "string";
1142
+ required: false;
1143
+ input: false;
1144
+ };
1145
+ metadata: {
1146
+ type: "string";
1147
+ required: false;
1148
+ input: true;
1149
+ transform: {
1150
+ input(value: import("better-auth").DBPrimitive): string;
1151
+ output(value: import("better-auth").DBPrimitive): any;
1152
+ };
1153
+ };
1154
+ };
1155
+ };
1156
+ };
1157
+ } | {
1158
+ id: "two-factor";
1159
+ version: string;
1160
+ endpoints: {
1161
+ enableTwoFactor: import("better-auth").StrictEndpoint<"/two-factor/enable", {
1162
+ method: "POST";
1163
+ body: import("zod").ZodObject<{
1164
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1165
+ issuer: import("zod").ZodOptional<import("zod").ZodString>;
1166
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
1167
+ password: import("zod").ZodString;
1168
+ issuer: import("zod").ZodOptional<import("zod").ZodString>;
1169
+ }, import("zod/v4/core").$strip>;
1170
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1171
+ session: {
1172
+ session: Record<string, any> & {
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
+ user: Record<string, any> & {
1183
+ id: string;
1184
+ createdAt: Date;
1185
+ updatedAt: Date;
1186
+ email: string;
1187
+ emailVerified: boolean;
1188
+ name: string;
1189
+ image?: string | null | undefined;
1190
+ };
1191
+ };
1192
+ }>)[];
1193
+ metadata: {
1194
+ openapi: {
1195
+ summary: string;
1196
+ description: string;
1197
+ responses: {
1198
+ 200: {
1199
+ description: string;
1200
+ content: {
1201
+ "application/json": {
1202
+ schema: {
1203
+ type: "object";
1204
+ properties: {
1205
+ totpURI: {
1206
+ type: string;
1207
+ description: string;
1208
+ };
1209
+ backupCodes: {
1210
+ type: string;
1211
+ items: {
1212
+ type: string;
1213
+ };
1214
+ description: string;
1215
+ };
1216
+ };
1217
+ };
1218
+ };
1219
+ };
1220
+ };
1221
+ };
1222
+ };
1223
+ };
1224
+ }, {
1225
+ totpURI: string;
1226
+ backupCodes: string[];
1227
+ }>;
1228
+ disableTwoFactor: import("better-auth").StrictEndpoint<"/two-factor/disable", {
1229
+ method: "POST";
1230
+ body: import("zod").ZodObject<{
1231
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1232
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
1233
+ password: import("zod").ZodString;
1234
+ }, import("zod/v4/core").$strip>;
1235
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1236
+ session: {
1237
+ session: Record<string, any> & {
1238
+ id: string;
1239
+ createdAt: Date;
1240
+ updatedAt: Date;
1241
+ userId: string;
1242
+ expiresAt: Date;
1243
+ token: string;
1244
+ ipAddress?: string | null | undefined;
1245
+ userAgent?: string | null | undefined;
1246
+ };
1247
+ user: Record<string, any> & {
1248
+ id: string;
1249
+ createdAt: Date;
1250
+ updatedAt: Date;
1251
+ email: string;
1252
+ emailVerified: boolean;
1253
+ name: string;
1254
+ image?: string | null | undefined;
1255
+ };
1256
+ };
1257
+ }>)[];
1258
+ metadata: {
1259
+ openapi: {
1260
+ summary: string;
1261
+ description: string;
1262
+ responses: {
1263
+ 200: {
1264
+ description: string;
1265
+ content: {
1266
+ "application/json": {
1267
+ schema: {
1268
+ type: "object";
1269
+ properties: {
1270
+ status: {
1271
+ type: string;
1272
+ };
1273
+ };
1274
+ };
1275
+ };
1276
+ };
1277
+ };
1278
+ };
1279
+ };
1280
+ };
1281
+ }, {
1282
+ status: boolean;
1283
+ }>;
1284
+ verifyBackupCode: import("better-auth").StrictEndpoint<"/two-factor/verify-backup-code", {
1285
+ method: "POST";
1286
+ body: import("zod").ZodObject<{
1287
+ code: import("zod").ZodString;
1288
+ disableSession: import("zod").ZodOptional<import("zod").ZodBoolean>;
1289
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
1290
+ }, import("zod/v4/core").$strip>;
1291
+ metadata: {
1292
+ openapi: {
1293
+ description: string;
1294
+ responses: {
1295
+ "200": {
1296
+ description: string;
1297
+ content: {
1298
+ "application/json": {
1299
+ schema: {
1300
+ type: "object";
1301
+ properties: {
1302
+ user: {
1303
+ type: string;
1304
+ properties: {
1305
+ id: {
1306
+ type: string;
1307
+ description: string;
1308
+ };
1309
+ email: {
1310
+ type: string;
1311
+ format: string;
1312
+ nullable: boolean;
1313
+ description: string;
1314
+ };
1315
+ emailVerified: {
1316
+ type: string;
1317
+ nullable: boolean;
1318
+ description: string;
1319
+ };
1320
+ name: {
1321
+ type: string;
1322
+ nullable: boolean;
1323
+ description: string;
1324
+ };
1325
+ image: {
1326
+ type: string;
1327
+ format: string;
1328
+ nullable: boolean;
1329
+ description: string;
1330
+ };
1331
+ twoFactorEnabled: {
1332
+ type: string;
1333
+ description: string;
1334
+ };
1335
+ createdAt: {
1336
+ type: string;
1337
+ format: string;
1338
+ description: string;
1339
+ };
1340
+ updatedAt: {
1341
+ type: string;
1342
+ format: string;
1343
+ description: string;
1344
+ };
1345
+ };
1346
+ required: string[];
1347
+ description: string;
1348
+ };
1349
+ session: {
1350
+ type: string;
1351
+ properties: {
1352
+ token: {
1353
+ type: string;
1354
+ description: string;
1355
+ };
1356
+ userId: {
1357
+ type: string;
1358
+ description: string;
1359
+ };
1360
+ createdAt: {
1361
+ type: string;
1362
+ format: string;
1363
+ description: string;
1364
+ };
1365
+ expiresAt: {
1366
+ type: string;
1367
+ format: string;
1368
+ description: string;
1369
+ };
1370
+ };
1371
+ required: string[];
1372
+ description: string;
1373
+ };
1374
+ };
1375
+ required: string[];
1376
+ };
1377
+ };
1378
+ };
1379
+ };
1380
+ };
1381
+ };
1382
+ };
1383
+ }, {
1384
+ token: string | undefined;
1385
+ user: (Record<string, any> & {
1386
+ id: string;
1387
+ createdAt: Date;
1388
+ updatedAt: Date;
1389
+ email: string;
1390
+ emailVerified: boolean;
1391
+ name: string;
1392
+ image?: string | null | undefined;
1393
+ }) | import("better-auth/plugins").UserWithTwoFactor;
1394
+ }>;
1395
+ generateBackupCodes: import("better-auth").StrictEndpoint<"/two-factor/generate-backup-codes", {
1396
+ method: "POST";
1397
+ body: import("zod").ZodObject<{
1398
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1399
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
1400
+ password: import("zod").ZodString;
1401
+ }, import("zod/v4/core").$strip>;
1402
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1403
+ session: {
1404
+ session: Record<string, any> & {
1405
+ id: string;
1406
+ createdAt: Date;
1407
+ updatedAt: Date;
1408
+ userId: string;
1409
+ expiresAt: Date;
1410
+ token: string;
1411
+ ipAddress?: string | null | undefined;
1412
+ userAgent?: string | null | undefined;
1413
+ };
1414
+ user: Record<string, any> & {
1415
+ id: string;
1416
+ createdAt: Date;
1417
+ updatedAt: Date;
1418
+ email: string;
1419
+ emailVerified: boolean;
1420
+ name: string;
1421
+ image?: string | null | undefined;
1422
+ };
1423
+ };
1424
+ }>)[];
1425
+ metadata: {
1426
+ openapi: {
1427
+ description: string;
1428
+ responses: {
1429
+ "200": {
1430
+ description: string;
1431
+ content: {
1432
+ "application/json": {
1433
+ schema: {
1434
+ type: "object";
1435
+ properties: {
1436
+ status: {
1437
+ type: string;
1438
+ description: string;
1439
+ enum: boolean[];
1440
+ };
1441
+ backupCodes: {
1442
+ type: string;
1443
+ items: {
1444
+ type: string;
1445
+ };
1446
+ description: string;
1447
+ };
1448
+ };
1449
+ required: string[];
1450
+ };
1451
+ };
1452
+ };
1453
+ };
1454
+ };
1455
+ };
1456
+ };
1457
+ }, {
1458
+ status: boolean;
1459
+ backupCodes: string[];
1460
+ }>;
1461
+ viewBackupCodes: import("better-auth").StrictEndpoint<string, {
1462
+ method: "POST";
1463
+ body: import("zod").ZodObject<{
1464
+ userId: import("zod").ZodCoercedString<unknown>;
1465
+ }, import("zod/v4/core").$strip>;
1466
+ }, {
1467
+ status: boolean;
1468
+ backupCodes: string[];
1469
+ }>;
1470
+ sendTwoFactorOTP: import("better-auth").StrictEndpoint<"/two-factor/send-otp", {
1471
+ method: "POST";
1472
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
1473
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
1474
+ }, import("zod/v4/core").$strip>>;
1475
+ metadata: {
1476
+ openapi: {
1477
+ summary: string;
1478
+ description: string;
1479
+ responses: {
1480
+ 200: {
1481
+ description: string;
1482
+ content: {
1483
+ "application/json": {
1484
+ schema: {
1485
+ type: "object";
1486
+ properties: {
1487
+ status: {
1488
+ type: string;
1489
+ };
1490
+ };
1491
+ };
1492
+ };
1493
+ };
1494
+ };
1495
+ };
1496
+ };
1497
+ };
1498
+ }, {
1499
+ status: boolean;
1500
+ }>;
1501
+ verifyTwoFactorOTP: import("better-auth").StrictEndpoint<"/two-factor/verify-otp", {
1502
+ method: "POST";
1503
+ body: import("zod").ZodObject<{
1504
+ code: import("zod").ZodString;
1505
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
1506
+ }, import("zod/v4/core").$strip>;
1507
+ metadata: {
1508
+ openapi: {
1509
+ summary: string;
1510
+ description: string;
1511
+ responses: {
1512
+ "200": {
1513
+ description: string;
1514
+ content: {
1515
+ "application/json": {
1516
+ schema: {
1517
+ type: "object";
1518
+ properties: {
1519
+ token: {
1520
+ type: string;
1521
+ description: string;
1522
+ };
1523
+ user: {
1524
+ type: string;
1525
+ properties: {
1526
+ id: {
1527
+ type: string;
1528
+ description: string;
1529
+ };
1530
+ email: {
1531
+ type: string;
1532
+ format: string;
1533
+ nullable: boolean;
1534
+ description: string;
1535
+ };
1536
+ emailVerified: {
1537
+ type: string;
1538
+ nullable: boolean;
1539
+ description: string;
1540
+ };
1541
+ name: {
1542
+ type: string;
1543
+ nullable: boolean;
1544
+ description: string;
1545
+ };
1546
+ image: {
1547
+ type: string;
1548
+ format: string;
1549
+ nullable: boolean;
1550
+ description: string;
1551
+ };
1552
+ createdAt: {
1553
+ type: string;
1554
+ format: string;
1555
+ description: string;
1556
+ };
1557
+ updatedAt: {
1558
+ type: string;
1559
+ format: string;
1560
+ description: string;
1561
+ };
1562
+ };
1563
+ required: string[];
1564
+ description: string;
1565
+ };
1566
+ };
1567
+ required: string[];
1568
+ };
1569
+ };
1570
+ };
1571
+ };
1572
+ };
1573
+ };
1574
+ };
1575
+ }, {
1576
+ token: string;
1577
+ user: import("better-auth/plugins").UserWithTwoFactor;
1578
+ } | {
1579
+ token: string;
1580
+ user: Record<string, any> & {
1581
+ id: string;
1582
+ createdAt: Date;
1583
+ updatedAt: Date;
1584
+ email: string;
1585
+ emailVerified: boolean;
1586
+ name: string;
1587
+ image?: string | null | undefined;
1588
+ };
1589
+ }>;
1590
+ generateTOTP: import("better-auth").StrictEndpoint<string, {
1591
+ method: "POST";
1592
+ body: import("zod").ZodObject<{
1593
+ secret: import("zod").ZodString;
1594
+ }, import("zod/v4/core").$strip>;
1595
+ metadata: {
1596
+ openapi: {
1597
+ summary: string;
1598
+ description: string;
1599
+ responses: {
1600
+ 200: {
1601
+ description: string;
1602
+ content: {
1603
+ "application/json": {
1604
+ schema: {
1605
+ type: "object";
1606
+ properties: {
1607
+ code: {
1608
+ type: string;
1609
+ };
1610
+ };
1611
+ };
1612
+ };
1613
+ };
1614
+ };
1615
+ };
1616
+ };
1617
+ };
1618
+ }, {
1619
+ code: string;
1620
+ }>;
1621
+ getTOTPURI: import("better-auth").StrictEndpoint<"/two-factor/get-totp-uri", {
1622
+ method: "POST";
1623
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1624
+ session: {
1625
+ session: Record<string, any> & {
1626
+ id: string;
1627
+ createdAt: Date;
1628
+ updatedAt: Date;
1629
+ userId: string;
1630
+ expiresAt: Date;
1631
+ token: string;
1632
+ ipAddress?: string | null | undefined;
1633
+ userAgent?: string | null | undefined;
1634
+ };
1635
+ user: Record<string, any> & {
1636
+ id: string;
1637
+ createdAt: Date;
1638
+ updatedAt: Date;
1639
+ email: string;
1640
+ emailVerified: boolean;
1641
+ name: string;
1642
+ image?: string | null | undefined;
1643
+ };
1644
+ };
1645
+ }>)[];
1646
+ body: import("zod").ZodObject<{
1647
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1648
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
1649
+ password: import("zod").ZodString;
1650
+ }, import("zod/v4/core").$strip>;
1651
+ metadata: {
1652
+ openapi: {
1653
+ summary: string;
1654
+ description: string;
1655
+ responses: {
1656
+ 200: {
1657
+ description: string;
1658
+ content: {
1659
+ "application/json": {
1660
+ schema: {
1661
+ type: "object";
1662
+ properties: {
1663
+ totpURI: {
1664
+ type: string;
1665
+ };
1666
+ };
1667
+ };
1668
+ };
1669
+ };
1670
+ };
1671
+ };
1672
+ };
1673
+ };
1674
+ }, {
1675
+ totpURI: string;
1676
+ }>;
1677
+ verifyTOTP: import("better-auth").StrictEndpoint<"/two-factor/verify-totp", {
1678
+ method: "POST";
1679
+ body: import("zod").ZodObject<{
1680
+ code: import("zod").ZodString;
1681
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
1682
+ }, import("zod/v4/core").$strip>;
1683
+ metadata: {
1684
+ openapi: {
1685
+ summary: string;
1686
+ description: string;
1687
+ responses: {
1688
+ 200: {
1689
+ description: string;
1690
+ content: {
1691
+ "application/json": {
1692
+ schema: {
1693
+ type: "object";
1694
+ properties: {
1695
+ status: {
1696
+ type: string;
1697
+ };
1698
+ };
1699
+ };
1700
+ };
1701
+ };
1702
+ };
1703
+ };
1704
+ };
1705
+ };
1706
+ }, {
1707
+ token: string;
1708
+ user: import("better-auth/plugins").UserWithTwoFactor;
1709
+ } | {
1710
+ token: string;
1711
+ user: Record<string, any> & {
1712
+ id: string;
1713
+ createdAt: Date;
1714
+ updatedAt: Date;
1715
+ email: string;
1716
+ emailVerified: boolean;
1717
+ name: string;
1718
+ image?: string | null | undefined;
1719
+ };
1720
+ }>;
1721
+ };
1722
+ options: NoInfer<{
1723
+ otpOptions?: import("better-auth/plugins").OTPOptions | undefined;
1724
+ skipVerificationOnEnable?: boolean | undefined;
1725
+ issuer?: string | undefined;
1726
+ twoFactorTable?: string | undefined;
1727
+ totpOptions?: Omit<import("better-auth/plugins").TOTPOptions, "issuer"> | undefined;
1728
+ backupCodeOptions?: import("better-auth/plugins").BackupCodeOptions | undefined;
1729
+ allowPasswordless?: boolean | undefined;
1730
+ schema?: import("better-auth").InferOptionSchema<{
1731
+ user: {
1732
+ fields: {
1733
+ twoFactorEnabled: {
1734
+ type: "boolean";
1735
+ required: false;
1736
+ defaultValue: false;
1737
+ input: false;
1738
+ };
1739
+ };
1740
+ };
1741
+ twoFactor: {
1742
+ fields: {
1743
+ secret: {
1744
+ type: "string";
1745
+ required: true;
1746
+ returned: false;
1747
+ index: true;
1748
+ };
1749
+ backupCodes: {
1750
+ type: "string";
1751
+ required: true;
1752
+ returned: false;
1753
+ };
1754
+ userId: {
1755
+ type: "string";
1756
+ required: true;
1757
+ returned: false;
1758
+ references: {
1759
+ model: string;
1760
+ field: string;
1761
+ };
1762
+ index: true;
1763
+ };
1764
+ verified: {
1765
+ type: "boolean";
1766
+ required: false;
1767
+ defaultValue: true;
1768
+ input: false;
1769
+ };
1770
+ failedVerificationCount: {
1771
+ type: "number";
1772
+ required: false;
1773
+ defaultValue: number;
1774
+ input: false;
1775
+ returned: false;
1776
+ };
1777
+ lockedUntil: {
1778
+ type: "date";
1779
+ required: false;
1780
+ input: false;
1781
+ returned: false;
1782
+ };
1783
+ };
1784
+ };
1785
+ }> | undefined;
1786
+ twoFactorCookieMaxAge?: number | undefined;
1787
+ trustDeviceMaxAge?: number | undefined;
1788
+ accountLockout?: {
1789
+ enabled?: boolean | undefined;
1790
+ maxFailedAttempts?: number | undefined;
1791
+ durationSeconds?: number | undefined;
1792
+ } | undefined;
1793
+ }>;
1794
+ hooks: {
1795
+ after: {
1796
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
1797
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1798
+ twoFactorRedirect: boolean;
1799
+ twoFactorMethods: string[];
1800
+ } | undefined>;
1801
+ }[];
1802
+ };
1803
+ schema: {
1804
+ user: {
1805
+ fields: {
1806
+ twoFactorEnabled: {
1807
+ type: "boolean";
1808
+ required: false;
1809
+ defaultValue: false;
1810
+ input: false;
1811
+ };
1812
+ };
1813
+ };
1814
+ twoFactor: {
1815
+ fields: {
1816
+ secret: {
1817
+ type: "string";
1818
+ required: true;
1819
+ returned: false;
1820
+ index: true;
1821
+ };
1822
+ backupCodes: {
1823
+ type: "string";
1824
+ required: true;
1825
+ returned: false;
1826
+ };
1827
+ userId: {
1828
+ type: "string";
1829
+ required: true;
1830
+ returned: false;
1831
+ references: {
1832
+ model: string;
1833
+ field: string;
1834
+ };
1835
+ index: true;
1836
+ };
1837
+ verified: {
1838
+ type: "boolean";
1839
+ required: false;
1840
+ defaultValue: true;
1841
+ input: false;
1842
+ };
1843
+ failedVerificationCount: {
1844
+ type: "number";
1845
+ required: false;
1846
+ defaultValue: number;
1847
+ input: false;
1848
+ returned: false;
1849
+ };
1850
+ lockedUntil: {
1851
+ type: "date";
1852
+ required: false;
1853
+ input: false;
1854
+ returned: false;
1855
+ };
1856
+ };
1857
+ };
1858
+ };
1859
+ rateLimit: {
1860
+ pathMatcher(path: string): boolean;
1861
+ window: number;
1862
+ max: number;
1863
+ }[];
1864
+ $ERROR_CODES: {
1865
+ OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
1866
+ OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
1867
+ TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
1868
+ TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
1869
+ BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
1870
+ INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
1871
+ INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
1872
+ TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
1873
+ ACCOUNT_TEMPORARILY_LOCKED: import("better-auth").RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
1874
+ INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
1875
+ };
1876
+ })[];
1877
+ hooks: {
1878
+ before: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
1879
+ after: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
1880
+ };
1881
+ socialProviders?: import("better-auth").SocialProviders | undefined;
1882
+ advanced: {
1883
+ backgroundTasks: {
1884
+ handler: (task: unknown) => void;
1885
+ };
1886
+ };
1887
+ database: (options: import("better-auth").BetterAuthOptions) => import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
1888
+ databaseHooks: {
1889
+ user: {
1890
+ create: {
1891
+ before: (user: {
1892
+ email?: string;
1893
+ }) => Promise<{
1894
+ data: {
1895
+ email?: string;
1896
+ };
1897
+ }>;
1898
+ };
1899
+ };
1900
+ };
1901
+ emailAndPassword: {
1902
+ enabled: boolean;
1903
+ requireEmailVerification: boolean;
1904
+ revokeSessionsOnPasswordReset: boolean;
1905
+ sendResetPassword: ({ user, token }: {
1906
+ user: {
1907
+ name?: string;
1908
+ email: string;
1909
+ };
1910
+ token: string;
1911
+ }) => Promise<void>;
1912
+ };
1913
+ emailVerification: {
1914
+ enabled: boolean;
1915
+ sendOnSignUp: boolean;
1916
+ autoSignInAfterVerification: boolean;
1917
+ verifyEmailPath: string;
1918
+ sendVerificationEmail: ({ user, url }: {
1919
+ user: {
1920
+ name?: string;
1921
+ email: string;
1922
+ };
1923
+ url: string;
1924
+ }) => Promise<void>;
1925
+ };
1926
+ rateLimit: {
1927
+ enabled: boolean;
1928
+ window: number;
1929
+ max: number;
1930
+ customRules: {
1931
+ '/send-verification-email': {
1932
+ window: number;
1933
+ max: number;
1934
+ };
1935
+ '/request-password-reset': {
1936
+ window: number;
1937
+ max: number;
1938
+ };
1939
+ '/forget-password': {
1940
+ window: number;
1941
+ max: number;
1942
+ };
1943
+ };
1944
+ };
1945
+ user?: {
1946
+ deleteUser: {
1947
+ enabled: boolean;
1948
+ beforeDelete: (user: {
1949
+ id: string;
1950
+ }) => Promise<void>;
1951
+ };
1952
+ } | undefined;
1953
+ session: {
1954
+ cookieCache: {
1955
+ enabled: boolean;
1956
+ maxAge: number;
1957
+ };
1958
+ };
1959
+ appName?: string | undefined;
1960
+ baseURL: string | undefined;
1961
+ secret: string | undefined;
1962
+ trustedOrigins: string[];
1963
+ }>;
1964
+ export type AphexAuthInstance = ReturnType<typeof createAuthInstance>;
1965
+ //# sourceMappingURL=instance.d.ts.map