@bitakit/better-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,2324 @@
1
+ import { type ReactAuthClient } from 'better-auth/react';
2
+ import type { BetterAuthClientOptions, BetterAuthClientPlugin } from 'better-auth/client';
3
+ declare const standardPlugins: () => readonly [{
4
+ id: "organization";
5
+ version: string;
6
+ $InferServerPlugin: import("better-auth/client").OrganizationPlugin<{
7
+ ac: import("better-auth/client").AccessControl<{
8
+ readonly organization: readonly ["update", "delete"];
9
+ readonly member: readonly ["create", "update", "delete"];
10
+ readonly invitation: readonly ["create", "cancel"];
11
+ readonly team: readonly ["create", "update", "delete"];
12
+ readonly ac: readonly ["create", "read", "update", "delete"];
13
+ }>;
14
+ roles: {
15
+ admin: import("better-auth/client").Role;
16
+ member: import("better-auth/client").Role;
17
+ owner: import("better-auth/client").Role;
18
+ };
19
+ teams: {
20
+ enabled: true;
21
+ };
22
+ schema: unknown;
23
+ dynamicAccessControl: {
24
+ enabled: false;
25
+ };
26
+ }>;
27
+ getActions: ($fetch: import("@better-fetch/fetch").BetterFetch, _$store: import("better-auth").ClientStore, co: BetterAuthClientOptions | undefined) => {
28
+ $Infer: {
29
+ ActiveOrganization: {
30
+ members: {
31
+ id: string;
32
+ organizationId: string;
33
+ role: "member" | "admin" | "owner";
34
+ createdAt: Date;
35
+ userId: string;
36
+ teamId?: string | undefined | undefined;
37
+ user: {
38
+ id: string;
39
+ email: string;
40
+ name: string;
41
+ image?: string | undefined;
42
+ };
43
+ }[];
44
+ invitations: {
45
+ id: string;
46
+ organizationId: string;
47
+ email: string;
48
+ role: "member" | "admin" | "owner";
49
+ status: import("better-auth/client").InvitationStatus;
50
+ inviterId: string;
51
+ expiresAt: Date;
52
+ createdAt: Date;
53
+ teamId?: string | undefined | undefined;
54
+ }[];
55
+ teams: {
56
+ id: string;
57
+ name: string;
58
+ organizationId: string;
59
+ createdAt: Date;
60
+ updatedAt?: Date | undefined;
61
+ }[];
62
+ } & {
63
+ id: string;
64
+ name: string;
65
+ slug: string;
66
+ createdAt: Date;
67
+ logo?: string | null | undefined | undefined;
68
+ metadata?: any;
69
+ };
70
+ Organization: {
71
+ id: string;
72
+ name: string;
73
+ slug: string;
74
+ createdAt: Date;
75
+ logo?: string | null | undefined;
76
+ metadata?: any;
77
+ };
78
+ Invitation: {
79
+ id: string;
80
+ organizationId: string;
81
+ email: string;
82
+ role: "member" | "admin" | "owner";
83
+ status: import("better-auth/client").InvitationStatus;
84
+ inviterId: string;
85
+ expiresAt: Date;
86
+ createdAt: Date;
87
+ teamId?: string | undefined | undefined;
88
+ };
89
+ Member: {
90
+ id: string;
91
+ organizationId: string;
92
+ role: "member" | "admin" | "owner";
93
+ createdAt: Date;
94
+ userId: string;
95
+ teamId?: string | undefined | undefined;
96
+ user: {
97
+ id: string;
98
+ email: string;
99
+ name: string;
100
+ image?: string | undefined;
101
+ };
102
+ };
103
+ Team: {
104
+ id: string;
105
+ name: string;
106
+ organizationId: string;
107
+ createdAt: Date;
108
+ updatedAt?: Date | undefined;
109
+ };
110
+ };
111
+ organization: {
112
+ checkRolePermission: <R extends "member" | "admin" | "owner">(data: {
113
+ permissions: {
114
+ readonly organization?: ("update" | "delete")[] | undefined;
115
+ readonly member?: ("create" | "update" | "delete")[] | undefined;
116
+ readonly invitation?: ("create" | "cancel")[] | undefined;
117
+ readonly team?: ("create" | "update" | "delete")[] | undefined;
118
+ readonly ac?: ("create" | "update" | "delete" | "read")[] | undefined;
119
+ };
120
+ } & {
121
+ role: R;
122
+ }) => boolean;
123
+ };
124
+ };
125
+ getAtoms: ($fetch: import("@better-fetch/fetch").BetterFetch) => {
126
+ $listOrg: import("nanostores").PreinitializedWritableAtom<boolean> & object;
127
+ $activeOrgSignal: import("nanostores").PreinitializedWritableAtom<boolean> & object;
128
+ $activeMemberSignal: import("nanostores").PreinitializedWritableAtom<boolean> & object;
129
+ $activeMemberRoleSignal: import("nanostores").PreinitializedWritableAtom<boolean> & object;
130
+ activeOrganization: import("better-auth/client").AuthQueryAtom<import("better-auth").Prettify<{
131
+ id: string;
132
+ name: string;
133
+ slug: string;
134
+ createdAt: Date;
135
+ logo?: string | null | undefined | undefined;
136
+ metadata?: any;
137
+ } & {
138
+ members: {
139
+ id: string;
140
+ organizationId: string;
141
+ role: "member" | "admin" | "owner";
142
+ createdAt: Date;
143
+ userId: string;
144
+ teamId?: string | undefined | undefined;
145
+ user: {
146
+ id: string;
147
+ email: string;
148
+ name: string;
149
+ image?: string | undefined;
150
+ };
151
+ }[];
152
+ invitations: {
153
+ id: string;
154
+ organizationId: string;
155
+ email: string;
156
+ role: "member" | "admin" | "owner";
157
+ status: import("better-auth/client").InvitationStatus;
158
+ inviterId: string;
159
+ expiresAt: Date;
160
+ createdAt: Date;
161
+ teamId?: string | undefined | undefined;
162
+ }[];
163
+ }>>;
164
+ listOrganizations: import("better-auth/client").AuthQueryAtom<{
165
+ id: string;
166
+ name: string;
167
+ slug: string;
168
+ createdAt: Date;
169
+ logo?: string | null | undefined | undefined;
170
+ metadata?: any;
171
+ }[]>;
172
+ activeMember: import("better-auth/client").AuthQueryAtom<{
173
+ id: string;
174
+ organizationId: string;
175
+ userId: string;
176
+ role: string;
177
+ createdAt: Date;
178
+ }>;
179
+ activeMemberRole: import("better-auth/client").AuthQueryAtom<{
180
+ role: string;
181
+ }>;
182
+ };
183
+ pathMethods: {
184
+ "/organization/get-full-organization": "GET";
185
+ "/organization/list-user-teams": "GET";
186
+ };
187
+ atomListeners: ({
188
+ matcher(path: string): path is "/organization/create" | "/organization/update" | "/organization/delete";
189
+ signal: "$listOrg";
190
+ } | {
191
+ matcher(path: string): boolean;
192
+ signal: "$activeOrgSignal";
193
+ } | {
194
+ matcher(path: string): boolean;
195
+ signal: "$sessionSignal";
196
+ } | {
197
+ matcher(path: string): boolean;
198
+ signal: "$activeMemberSignal";
199
+ } | {
200
+ matcher(path: string): boolean;
201
+ signal: "$activeMemberRoleSignal";
202
+ })[];
203
+ $ERROR_CODES: {
204
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION">;
205
+ YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: import("better-auth").RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS">;
206
+ ORGANIZATION_ALREADY_EXISTS: import("better-auth").RawError<"ORGANIZATION_ALREADY_EXISTS">;
207
+ ORGANIZATION_SLUG_ALREADY_TAKEN: import("better-auth").RawError<"ORGANIZATION_SLUG_ALREADY_TAKEN">;
208
+ ORGANIZATION_NOT_FOUND: import("better-auth").RawError<"ORGANIZATION_NOT_FOUND">;
209
+ USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION: import("better-auth").RawError<"USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION">;
210
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION">;
211
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION">;
212
+ NO_ACTIVE_ORGANIZATION: import("better-auth").RawError<"NO_ACTIVE_ORGANIZATION">;
213
+ USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION: import("better-auth").RawError<"USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION">;
214
+ MEMBER_NOT_FOUND: import("better-auth").RawError<"MEMBER_NOT_FOUND">;
215
+ ROLE_NOT_FOUND: import("better-auth").RawError<"ROLE_NOT_FOUND">;
216
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM">;
217
+ TEAM_ALREADY_EXISTS: import("better-auth").RawError<"TEAM_ALREADY_EXISTS">;
218
+ TEAM_NOT_FOUND: import("better-auth").RawError<"TEAM_NOT_FOUND">;
219
+ YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER: import("better-auth").RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER">;
220
+ YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER: import("better-auth").RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER">;
221
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER">;
222
+ YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION">;
223
+ USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION: import("better-auth").RawError<"USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION">;
224
+ INVITATION_NOT_FOUND: import("better-auth").RawError<"INVITATION_NOT_FOUND">;
225
+ YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: import("better-auth").RawError<"YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION">;
226
+ EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: import("better-auth").RawError<"EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION">;
227
+ EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION: import("better-auth").RawError<"EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION">;
228
+ YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION">;
229
+ INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: import("better-auth").RawError<"INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION">;
230
+ YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE">;
231
+ FAILED_TO_RETRIEVE_INVITATION: import("better-auth").RawError<"FAILED_TO_RETRIEVE_INVITATION">;
232
+ YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS: import("better-auth").RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS">;
233
+ UNABLE_TO_REMOVE_LAST_TEAM: import("better-auth").RawError<"UNABLE_TO_REMOVE_LAST_TEAM">;
234
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER">;
235
+ ORGANIZATION_MEMBERSHIP_LIMIT_REACHED: import("better-auth").RawError<"ORGANIZATION_MEMBERSHIP_LIMIT_REACHED">;
236
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION">;
237
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION">;
238
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM">;
239
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM">;
240
+ INVITATION_LIMIT_REACHED: import("better-auth").RawError<"INVITATION_LIMIT_REACHED">;
241
+ TEAM_MEMBER_LIMIT_REACHED: import("better-auth").RawError<"TEAM_MEMBER_LIMIT_REACHED">;
242
+ USER_IS_NOT_A_MEMBER_OF_THE_TEAM: import("better-auth").RawError<"USER_IS_NOT_A_MEMBER_OF_THE_TEAM">;
243
+ YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM: import("better-auth").RawError<"YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM">;
244
+ YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: import("better-auth").RawError<"YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM">;
245
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER">;
246
+ YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER">;
247
+ YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION">;
248
+ YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION">;
249
+ MISSING_AC_INSTANCE: import("better-auth").RawError<"MISSING_AC_INSTANCE">;
250
+ YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE: import("better-auth").RawError<"YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE">;
251
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE">;
252
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE">;
253
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE">;
254
+ YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE">;
255
+ YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE">;
256
+ YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE">;
257
+ TOO_MANY_ROLES: import("better-auth").RawError<"TOO_MANY_ROLES">;
258
+ INVALID_RESOURCE: import("better-auth").RawError<"INVALID_RESOURCE">;
259
+ ROLE_NAME_IS_ALREADY_TAKEN: import("better-auth").RawError<"ROLE_NAME_IS_ALREADY_TAKEN">;
260
+ CANNOT_DELETE_A_PRE_DEFINED_ROLE: import("better-auth").RawError<"CANNOT_DELETE_A_PRE_DEFINED_ROLE">;
261
+ ROLE_IS_ASSIGNED_TO_MEMBERS: import("better-auth").RawError<"ROLE_IS_ASSIGNED_TO_MEMBERS">;
262
+ INVALID_TEAM_ID: import("better-auth").RawError<"INVALID_TEAM_ID">;
263
+ };
264
+ }, {
265
+ id: "multi-session";
266
+ version: string;
267
+ $InferServerPlugin: ReturnType<(options?: import("better-auth/plugins/multi-session").MultiSessionConfig | undefined) => {
268
+ id: "multi-session";
269
+ version: string;
270
+ endpoints: {
271
+ listDeviceSessions: import("better-call").StrictEndpoint<"/multi-session/list-device-sessions", {
272
+ method: "GET";
273
+ requireHeaders: true;
274
+ }, {
275
+ session: {
276
+ id: string;
277
+ createdAt: Date;
278
+ updatedAt: Date;
279
+ userId: string;
280
+ expiresAt: Date;
281
+ token: string;
282
+ ipAddress?: string | null | undefined;
283
+ userAgent?: string | null | undefined;
284
+ };
285
+ user: {
286
+ id: string;
287
+ createdAt: Date;
288
+ updatedAt: Date;
289
+ email: string;
290
+ emailVerified: boolean;
291
+ name: string;
292
+ image?: string | null | undefined;
293
+ };
294
+ }[]>;
295
+ setActiveSession: import("better-call").StrictEndpoint<"/multi-session/set-active", {
296
+ method: "POST";
297
+ body: import("zod").ZodObject<{
298
+ sessionToken: import("zod").ZodString;
299
+ }, import("zod/v4/core").$strip>;
300
+ requireHeaders: true;
301
+ metadata: {
302
+ openapi: {
303
+ description: string;
304
+ responses: {
305
+ 200: {
306
+ description: string;
307
+ content: {
308
+ "application/json": {
309
+ schema: {
310
+ type: "object";
311
+ properties: {
312
+ session: {
313
+ $ref: string;
314
+ };
315
+ };
316
+ };
317
+ };
318
+ };
319
+ };
320
+ };
321
+ };
322
+ };
323
+ }, {
324
+ session: {
325
+ id: string;
326
+ createdAt: Date;
327
+ updatedAt: Date;
328
+ userId: string;
329
+ expiresAt: Date;
330
+ token: string;
331
+ ipAddress?: string | null | undefined;
332
+ userAgent?: string | null | undefined;
333
+ } & Record<string, any>;
334
+ user: {
335
+ id: string;
336
+ createdAt: Date;
337
+ updatedAt: Date;
338
+ email: string;
339
+ emailVerified: boolean;
340
+ name: string;
341
+ image?: string | null | undefined;
342
+ } & Record<string, any>;
343
+ }>;
344
+ revokeDeviceSession: import("better-call").StrictEndpoint<"/multi-session/revoke", {
345
+ method: "POST";
346
+ body: import("zod").ZodObject<{
347
+ sessionToken: import("zod").ZodString;
348
+ }, import("zod/v4/core").$strip>;
349
+ requireHeaders: true;
350
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
351
+ session: {
352
+ session: Record<string, any> & {
353
+ id: string;
354
+ createdAt: Date;
355
+ updatedAt: Date;
356
+ userId: string;
357
+ expiresAt: Date;
358
+ token: string;
359
+ ipAddress?: string | null | undefined;
360
+ userAgent?: string | null | undefined;
361
+ };
362
+ user: Record<string, any> & {
363
+ id: string;
364
+ createdAt: Date;
365
+ updatedAt: Date;
366
+ email: string;
367
+ emailVerified: boolean;
368
+ name: string;
369
+ image?: string | null | undefined;
370
+ };
371
+ };
372
+ }>>[];
373
+ metadata: {
374
+ openapi: {
375
+ description: string;
376
+ responses: {
377
+ 200: {
378
+ description: string;
379
+ content: {
380
+ "application/json": {
381
+ schema: {
382
+ type: "object";
383
+ properties: {
384
+ status: {
385
+ type: string;
386
+ };
387
+ };
388
+ };
389
+ };
390
+ };
391
+ };
392
+ };
393
+ };
394
+ };
395
+ }, {
396
+ status: boolean;
397
+ }>;
398
+ };
399
+ hooks: {
400
+ after: {
401
+ matcher: (context: import("better-auth").HookEndpointContext) => boolean;
402
+ handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
403
+ }[];
404
+ };
405
+ options: import("better-auth/plugins/multi-session").MultiSessionConfig | undefined;
406
+ $ERROR_CODES: {
407
+ INVALID_SESSION_TOKEN: import("better-auth").RawError<"INVALID_SESSION_TOKEN">;
408
+ };
409
+ }>;
410
+ atomListeners: {
411
+ matcher(path: string): path is "/multi-session/set-active";
412
+ signal: "$sessionSignal";
413
+ }[];
414
+ $ERROR_CODES: {
415
+ INVALID_SESSION_TOKEN: import("better-auth").RawError<"INVALID_SESSION_TOKEN">;
416
+ };
417
+ }, {
418
+ id: "api-key";
419
+ version: string;
420
+ $InferServerPlugin: {
421
+ id: "api-key";
422
+ version: string;
423
+ $ERROR_CODES: {
424
+ INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
425
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
426
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
427
+ USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
428
+ UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
429
+ KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
430
+ KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
431
+ KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
432
+ USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
433
+ KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
434
+ EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
435
+ EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
436
+ INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
437
+ INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
438
+ INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
439
+ METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
440
+ RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
441
+ NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
442
+ KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
443
+ INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
444
+ INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
445
+ INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
446
+ INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
447
+ SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
448
+ FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
449
+ NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
450
+ ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
451
+ USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
452
+ INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
453
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
454
+ ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
455
+ };
456
+ hooks: {
457
+ before: {
458
+ matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
459
+ handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
460
+ user: {
461
+ id: string;
462
+ createdAt: Date;
463
+ updatedAt: Date;
464
+ email: string;
465
+ emailVerified: boolean;
466
+ name: string;
467
+ image?: string | null | undefined;
468
+ };
469
+ session: {
470
+ id: string;
471
+ token: string;
472
+ userId: string;
473
+ userAgent: string | null;
474
+ ipAddress: string | null;
475
+ createdAt: Date;
476
+ updatedAt: Date;
477
+ expiresAt: Date;
478
+ };
479
+ } | {
480
+ context: import("better-call").MiddlewareContext<import("better-call").MiddlewareOptions, import("better-auth").PluginContext<import("better-auth").BetterAuthOptions> & import("better-auth").InfoContext & {
481
+ options: import("better-auth").BetterAuthOptions;
482
+ trustedOrigins: string[];
483
+ trustedProviders: string[];
484
+ isTrustedOrigin: (url: string, settings?: {
485
+ allowRelativePaths: boolean;
486
+ }) => boolean;
487
+ oauthConfig: {
488
+ skipStateCookieCheck?: boolean | undefined;
489
+ storeStateStrategy: "database" | "cookie";
490
+ };
491
+ newSession: {
492
+ session: {
493
+ id: string;
494
+ createdAt: Date;
495
+ updatedAt: Date;
496
+ userId: string;
497
+ expiresAt: Date;
498
+ token: string;
499
+ ipAddress?: string | null | undefined;
500
+ userAgent?: string | null | undefined;
501
+ } & Record<string, any>;
502
+ user: {
503
+ id: string;
504
+ createdAt: Date;
505
+ updatedAt: Date;
506
+ email: string;
507
+ emailVerified: boolean;
508
+ name: string;
509
+ image?: string | null | undefined;
510
+ } & Record<string, any>;
511
+ } | null;
512
+ session: {
513
+ session: {
514
+ id: string;
515
+ createdAt: Date;
516
+ updatedAt: Date;
517
+ userId: string;
518
+ expiresAt: Date;
519
+ token: string;
520
+ ipAddress?: string | null | undefined;
521
+ userAgent?: string | null | undefined;
522
+ } & Record<string, any>;
523
+ user: {
524
+ id: string;
525
+ createdAt: Date;
526
+ updatedAt: Date;
527
+ email: string;
528
+ emailVerified: boolean;
529
+ name: string;
530
+ image?: string | null | undefined;
531
+ } & Record<string, any>;
532
+ } | null;
533
+ setNewSession: (session: {
534
+ session: {
535
+ id: string;
536
+ createdAt: Date;
537
+ updatedAt: Date;
538
+ userId: string;
539
+ expiresAt: Date;
540
+ token: string;
541
+ ipAddress?: string | null | undefined;
542
+ userAgent?: string | null | undefined;
543
+ } & Record<string, any>;
544
+ user: {
545
+ id: string;
546
+ createdAt: Date;
547
+ updatedAt: Date;
548
+ email: string;
549
+ emailVerified: boolean;
550
+ name: string;
551
+ image?: string | null | undefined;
552
+ } & Record<string, any>;
553
+ } | null) => void;
554
+ socialProviders: import("better-auth").OAuthProvider[];
555
+ authCookies: import("better-auth").BetterAuthCookies;
556
+ logger: ReturnType<(options?: import("better-auth").Logger | undefined) => import("better-auth").InternalLogger>;
557
+ rateLimit: {
558
+ enabled: boolean;
559
+ window: number;
560
+ max: number;
561
+ storage: "memory" | "database" | "secondary-storage";
562
+ } & Omit<import("better-auth").BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
563
+ adapter: import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
564
+ checkSchema?: import("@better-auth/core/db/internal").SchemaCheck | undefined;
565
+ internalAdapter: import("better-auth").InternalAdapter<import("better-auth").BetterAuthOptions>;
566
+ createAuthCookie: (cookieName: string, overrideAttributes?: Partial<import("better-call").CookieOptions> | undefined) => import("better-auth").BetterAuthCookie;
567
+ secret: string;
568
+ secretConfig: string | import("better-auth").SecretConfig;
569
+ sessionConfig: {
570
+ updateAge: number;
571
+ expiresIn: number;
572
+ freshAge: number;
573
+ cookieCacheSigner?: import("better-auth").CookieCacheSigner | undefined;
574
+ cookieRefreshCache: false | {
575
+ enabled: true;
576
+ updateAge: number;
577
+ };
578
+ };
579
+ generateId: (options: {
580
+ model: import("better-auth").ModelNames;
581
+ size?: number | undefined;
582
+ }) => string | false;
583
+ secondaryStorage: import("better-auth").SecondaryStorage | undefined;
584
+ password: {
585
+ hash: (password: string) => Promise<string>;
586
+ verify: (data: {
587
+ password: string;
588
+ hash: string;
589
+ }) => Promise<boolean>;
590
+ config: {
591
+ minPasswordLength: number;
592
+ maxPasswordLength: number;
593
+ };
594
+ checkPassword: (userId: string, ctx: import("better-auth").GenericEndpointContext<import("better-auth").BetterAuthOptions>) => Promise<boolean>;
595
+ };
596
+ tables: import("better-auth").BetterAuthDBSchema;
597
+ runMigrations: () => Promise<void>;
598
+ publishTelemetry: (event: {
599
+ type: string;
600
+ anonymousId?: string | undefined;
601
+ payload: Record<string, any>;
602
+ }) => Promise<void>;
603
+ skipOriginCheck: boolean | string[];
604
+ skipCSRFCheck: boolean;
605
+ runInBackground: (promise: Promise<unknown>) => void;
606
+ runInBackgroundOrAwait: (promise: Promise<unknown> | void) => import("better-auth").Awaitable<unknown>;
607
+ } & {
608
+ returned?: unknown | undefined;
609
+ responseHeaders?: Headers | undefined;
610
+ }>;
611
+ }>>;
612
+ }[];
613
+ };
614
+ endpoints: {
615
+ createApiKey: import("better-call").StrictEndpoint<"/api-key/create", {
616
+ method: "POST";
617
+ body: import("zod").ZodObject<{
618
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
619
+ name: import("zod").ZodOptional<import("zod").ZodString>;
620
+ expiresIn: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
621
+ prefix: import("zod").ZodOptional<import("zod").ZodString>;
622
+ remaining: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
623
+ metadata: import("zod").ZodOptional<import("zod").ZodAny>;
624
+ refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
625
+ refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
626
+ rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
627
+ rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
628
+ rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
629
+ permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
630
+ userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
631
+ organizationId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
632
+ }, import("zod/v4/core").$strip>;
633
+ metadata: {
634
+ openapi: {
635
+ description: string;
636
+ responses: {
637
+ "200": {
638
+ description: string;
639
+ content: {
640
+ "application/json": {
641
+ schema: {
642
+ type: "object";
643
+ properties: {
644
+ id: {
645
+ type: string;
646
+ description: string;
647
+ };
648
+ createdAt: {
649
+ type: string;
650
+ format: string;
651
+ description: string;
652
+ };
653
+ updatedAt: {
654
+ type: string;
655
+ format: string;
656
+ description: string;
657
+ };
658
+ name: {
659
+ type: string;
660
+ nullable: boolean;
661
+ description: string;
662
+ };
663
+ prefix: {
664
+ type: string;
665
+ nullable: boolean;
666
+ description: string;
667
+ };
668
+ start: {
669
+ type: string;
670
+ nullable: boolean;
671
+ description: string;
672
+ };
673
+ key: {
674
+ type: string;
675
+ description: string;
676
+ };
677
+ enabled: {
678
+ type: string;
679
+ description: string;
680
+ };
681
+ expiresAt: {
682
+ type: string;
683
+ format: string;
684
+ nullable: boolean;
685
+ description: string;
686
+ };
687
+ referenceId: {
688
+ type: string;
689
+ description: string;
690
+ };
691
+ lastRefillAt: {
692
+ type: string;
693
+ format: string;
694
+ nullable: boolean;
695
+ description: string;
696
+ };
697
+ lastRequest: {
698
+ type: string;
699
+ format: string;
700
+ nullable: boolean;
701
+ description: string;
702
+ };
703
+ metadata: {
704
+ type: string;
705
+ nullable: boolean;
706
+ additionalProperties: boolean;
707
+ description: string;
708
+ };
709
+ rateLimitMax: {
710
+ type: string;
711
+ nullable: boolean;
712
+ description: string;
713
+ };
714
+ rateLimitTimeWindow: {
715
+ type: string;
716
+ nullable: boolean;
717
+ description: string;
718
+ };
719
+ remaining: {
720
+ type: string;
721
+ nullable: boolean;
722
+ description: string;
723
+ };
724
+ refillAmount: {
725
+ type: string;
726
+ nullable: boolean;
727
+ description: string;
728
+ };
729
+ refillInterval: {
730
+ type: string;
731
+ nullable: boolean;
732
+ description: string;
733
+ };
734
+ rateLimitEnabled: {
735
+ type: string;
736
+ description: string;
737
+ };
738
+ requestCount: {
739
+ type: string;
740
+ description: string;
741
+ };
742
+ permissions: {
743
+ type: string;
744
+ nullable: boolean;
745
+ additionalProperties: {
746
+ type: string;
747
+ items: {
748
+ type: string;
749
+ };
750
+ };
751
+ description: string;
752
+ };
753
+ };
754
+ required: string[];
755
+ };
756
+ };
757
+ };
758
+ };
759
+ };
760
+ };
761
+ };
762
+ }, {
763
+ key: string;
764
+ metadata: any;
765
+ permissions: any;
766
+ id: string;
767
+ configId: string;
768
+ name: string | null;
769
+ start: string | null;
770
+ prefix: string | null;
771
+ referenceId: string;
772
+ refillInterval: number | null;
773
+ refillAmount: number | null;
774
+ lastRefillAt: Date | null;
775
+ enabled: boolean;
776
+ rateLimitEnabled: boolean;
777
+ rateLimitTimeWindow: number | null;
778
+ rateLimitMax: number | null;
779
+ requestCount: number;
780
+ remaining: number | null;
781
+ lastRequest: Date | null;
782
+ expiresAt: Date | null;
783
+ createdAt: Date;
784
+ updatedAt: Date;
785
+ }>;
786
+ verifyApiKey: import("better-call").StrictEndpoint<string, {
787
+ method: "POST";
788
+ body: import("zod").ZodObject<{
789
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
790
+ key: import("zod").ZodString;
791
+ permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
792
+ }, import("zod/v4/core").$strip>;
793
+ }, {
794
+ valid: boolean;
795
+ error: {
796
+ message: import("better-auth").RawError<"INVALID_API_KEY">;
797
+ code: "KEY_NOT_FOUND";
798
+ };
799
+ key: null;
800
+ } | {
801
+ valid: boolean;
802
+ error: {
803
+ message: string | undefined;
804
+ code: string;
805
+ cause?: unknown;
806
+ };
807
+ key: null;
808
+ } | {
809
+ valid: boolean;
810
+ error: {
811
+ message: import("better-auth").RawError<"INVALID_API_KEY">;
812
+ code: "INVALID_API_KEY";
813
+ };
814
+ key: null;
815
+ } | {
816
+ valid: boolean;
817
+ error: null;
818
+ key: Omit<import("@better-auth/api-key/client").ApiKey, "key"> | null;
819
+ }>;
820
+ getApiKey: import("better-call").StrictEndpoint<"/api-key/get", {
821
+ method: "GET";
822
+ query: import("zod").ZodObject<{
823
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
824
+ id: import("zod").ZodString;
825
+ }, import("zod/v4/core").$strip>;
826
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
827
+ session: {
828
+ session: Record<string, any> & {
829
+ id: string;
830
+ createdAt: Date;
831
+ updatedAt: Date;
832
+ userId: string;
833
+ expiresAt: Date;
834
+ token: string;
835
+ ipAddress?: string | null | undefined;
836
+ userAgent?: string | null | undefined;
837
+ };
838
+ user: Record<string, any> & {
839
+ id: string;
840
+ createdAt: Date;
841
+ updatedAt: Date;
842
+ email: string;
843
+ emailVerified: boolean;
844
+ name: string;
845
+ image?: string | null | undefined;
846
+ };
847
+ };
848
+ }>>[];
849
+ metadata: {
850
+ openapi: {
851
+ description: string;
852
+ responses: {
853
+ "200": {
854
+ description: string;
855
+ content: {
856
+ "application/json": {
857
+ schema: {
858
+ type: "object";
859
+ properties: {
860
+ id: {
861
+ type: string;
862
+ description: string;
863
+ };
864
+ name: {
865
+ type: string;
866
+ nullable: boolean;
867
+ description: string;
868
+ };
869
+ start: {
870
+ type: string;
871
+ nullable: boolean;
872
+ description: string;
873
+ };
874
+ prefix: {
875
+ type: string;
876
+ nullable: boolean;
877
+ description: string;
878
+ };
879
+ userId: {
880
+ type: string;
881
+ description: string;
882
+ };
883
+ refillInterval: {
884
+ type: string;
885
+ nullable: boolean;
886
+ description: string;
887
+ };
888
+ refillAmount: {
889
+ type: string;
890
+ nullable: boolean;
891
+ description: string;
892
+ };
893
+ lastRefillAt: {
894
+ type: string;
895
+ format: string;
896
+ nullable: boolean;
897
+ description: string;
898
+ };
899
+ enabled: {
900
+ type: string;
901
+ description: string;
902
+ default: boolean;
903
+ };
904
+ rateLimitEnabled: {
905
+ type: string;
906
+ description: string;
907
+ };
908
+ rateLimitTimeWindow: {
909
+ type: string;
910
+ nullable: boolean;
911
+ description: string;
912
+ };
913
+ rateLimitMax: {
914
+ type: string;
915
+ nullable: boolean;
916
+ description: string;
917
+ };
918
+ requestCount: {
919
+ type: string;
920
+ description: string;
921
+ };
922
+ remaining: {
923
+ type: string;
924
+ nullable: boolean;
925
+ description: string;
926
+ };
927
+ lastRequest: {
928
+ type: string;
929
+ format: string;
930
+ nullable: boolean;
931
+ description: string;
932
+ };
933
+ expiresAt: {
934
+ type: string;
935
+ format: string;
936
+ nullable: boolean;
937
+ description: string;
938
+ };
939
+ createdAt: {
940
+ type: string;
941
+ format: string;
942
+ description: string;
943
+ };
944
+ updatedAt: {
945
+ type: string;
946
+ format: string;
947
+ description: string;
948
+ };
949
+ metadata: {
950
+ type: string;
951
+ nullable: boolean;
952
+ additionalProperties: boolean;
953
+ description: string;
954
+ };
955
+ permissions: {
956
+ type: string;
957
+ nullable: boolean;
958
+ description: string;
959
+ };
960
+ };
961
+ required: string[];
962
+ };
963
+ };
964
+ };
965
+ };
966
+ };
967
+ };
968
+ };
969
+ }, {
970
+ metadata: Record<string, any> | null;
971
+ permissions: {
972
+ [key: string]: string[];
973
+ } | null;
974
+ id: string;
975
+ configId: string;
976
+ name: string | null;
977
+ start: string | null;
978
+ prefix: string | null;
979
+ referenceId: string;
980
+ refillInterval: number | null;
981
+ refillAmount: number | null;
982
+ lastRefillAt: Date | null;
983
+ enabled: boolean;
984
+ rateLimitEnabled: boolean;
985
+ rateLimitTimeWindow: number | null;
986
+ rateLimitMax: number | null;
987
+ requestCount: number;
988
+ remaining: number | null;
989
+ lastRequest: Date | null;
990
+ expiresAt: Date | null;
991
+ createdAt: Date;
992
+ updatedAt: Date;
993
+ }>;
994
+ updateApiKey: import("better-call").StrictEndpoint<"/api-key/update", {
995
+ method: "POST";
996
+ body: import("zod").ZodObject<{
997
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
998
+ keyId: import("zod").ZodString;
999
+ userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
1000
+ name: import("zod").ZodOptional<import("zod").ZodString>;
1001
+ enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
1002
+ remaining: import("zod").ZodOptional<import("zod").ZodNumber>;
1003
+ refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
1004
+ refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
1005
+ metadata: import("zod").ZodOptional<import("zod").ZodAny>;
1006
+ expiresIn: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>;
1007
+ rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
1008
+ rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
1009
+ rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
1010
+ permissions: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>>;
1011
+ }, import("zod/v4/core").$strip>;
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
+ id: {
1024
+ type: string;
1025
+ description: string;
1026
+ };
1027
+ name: {
1028
+ type: string;
1029
+ nullable: boolean;
1030
+ description: string;
1031
+ };
1032
+ start: {
1033
+ type: string;
1034
+ nullable: boolean;
1035
+ description: string;
1036
+ };
1037
+ prefix: {
1038
+ type: string;
1039
+ nullable: boolean;
1040
+ description: string;
1041
+ };
1042
+ userId: {
1043
+ type: string;
1044
+ description: string;
1045
+ };
1046
+ refillInterval: {
1047
+ type: string;
1048
+ nullable: boolean;
1049
+ description: string;
1050
+ };
1051
+ refillAmount: {
1052
+ type: string;
1053
+ nullable: boolean;
1054
+ description: string;
1055
+ };
1056
+ lastRefillAt: {
1057
+ type: string;
1058
+ format: string;
1059
+ nullable: boolean;
1060
+ description: string;
1061
+ };
1062
+ enabled: {
1063
+ type: string;
1064
+ description: string;
1065
+ default: boolean;
1066
+ };
1067
+ rateLimitEnabled: {
1068
+ type: string;
1069
+ description: string;
1070
+ };
1071
+ rateLimitTimeWindow: {
1072
+ type: string;
1073
+ nullable: boolean;
1074
+ description: string;
1075
+ };
1076
+ rateLimitMax: {
1077
+ type: string;
1078
+ nullable: boolean;
1079
+ description: string;
1080
+ };
1081
+ requestCount: {
1082
+ type: string;
1083
+ description: string;
1084
+ };
1085
+ remaining: {
1086
+ type: string;
1087
+ nullable: boolean;
1088
+ description: string;
1089
+ };
1090
+ lastRequest: {
1091
+ type: string;
1092
+ format: string;
1093
+ nullable: boolean;
1094
+ description: string;
1095
+ };
1096
+ expiresAt: {
1097
+ type: string;
1098
+ format: string;
1099
+ nullable: boolean;
1100
+ description: string;
1101
+ };
1102
+ createdAt: {
1103
+ type: string;
1104
+ format: string;
1105
+ description: string;
1106
+ };
1107
+ updatedAt: {
1108
+ type: string;
1109
+ format: string;
1110
+ description: string;
1111
+ };
1112
+ metadata: {
1113
+ type: string;
1114
+ nullable: boolean;
1115
+ additionalProperties: boolean;
1116
+ description: string;
1117
+ };
1118
+ permissions: {
1119
+ type: string;
1120
+ nullable: boolean;
1121
+ description: string;
1122
+ };
1123
+ };
1124
+ required: string[];
1125
+ };
1126
+ };
1127
+ };
1128
+ };
1129
+ };
1130
+ };
1131
+ };
1132
+ }, {
1133
+ metadata: Record<string, any> | null;
1134
+ permissions: {
1135
+ [key: string]: string[];
1136
+ } | null;
1137
+ id: string;
1138
+ configId: string;
1139
+ name: string | null;
1140
+ start: string | null;
1141
+ prefix: string | null;
1142
+ referenceId: string;
1143
+ refillInterval: number | null;
1144
+ refillAmount: number | null;
1145
+ lastRefillAt: Date | null;
1146
+ enabled: boolean;
1147
+ rateLimitEnabled: boolean;
1148
+ rateLimitTimeWindow: number | null;
1149
+ rateLimitMax: number | null;
1150
+ requestCount: number;
1151
+ remaining: number | null;
1152
+ lastRequest: Date | null;
1153
+ expiresAt: Date | null;
1154
+ createdAt: Date;
1155
+ updatedAt: Date;
1156
+ }>;
1157
+ deleteApiKey: import("better-call").StrictEndpoint<"/api-key/delete", {
1158
+ method: "POST";
1159
+ body: import("zod").ZodObject<{
1160
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
1161
+ keyId: import("zod").ZodString;
1162
+ }, import("zod/v4/core").$strip>;
1163
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1164
+ session: {
1165
+ session: Record<string, any> & {
1166
+ id: string;
1167
+ createdAt: Date;
1168
+ updatedAt: Date;
1169
+ userId: string;
1170
+ expiresAt: Date;
1171
+ token: string;
1172
+ ipAddress?: string | null | undefined;
1173
+ userAgent?: string | null | undefined;
1174
+ };
1175
+ user: Record<string, any> & {
1176
+ id: string;
1177
+ createdAt: Date;
1178
+ updatedAt: Date;
1179
+ email: string;
1180
+ emailVerified: boolean;
1181
+ name: string;
1182
+ image?: string | null | undefined;
1183
+ };
1184
+ };
1185
+ }>>[];
1186
+ metadata: {
1187
+ openapi: {
1188
+ description: string;
1189
+ requestBody: {
1190
+ content: {
1191
+ "application/json": {
1192
+ schema: {
1193
+ type: "object";
1194
+ properties: {
1195
+ keyId: {
1196
+ type: string;
1197
+ description: string;
1198
+ };
1199
+ };
1200
+ required: string[];
1201
+ };
1202
+ };
1203
+ };
1204
+ };
1205
+ responses: {
1206
+ "200": {
1207
+ description: string;
1208
+ content: {
1209
+ "application/json": {
1210
+ schema: {
1211
+ type: "object";
1212
+ properties: {
1213
+ success: {
1214
+ type: string;
1215
+ description: string;
1216
+ };
1217
+ };
1218
+ required: string[];
1219
+ };
1220
+ };
1221
+ };
1222
+ };
1223
+ };
1224
+ };
1225
+ };
1226
+ }, {
1227
+ success: boolean;
1228
+ }>;
1229
+ listApiKeys: import("better-call").StrictEndpoint<"/api-key/list", {
1230
+ method: "GET";
1231
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1232
+ session: {
1233
+ session: Record<string, any> & {
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
+ user: Record<string, any> & {
1244
+ id: string;
1245
+ createdAt: Date;
1246
+ updatedAt: Date;
1247
+ email: string;
1248
+ emailVerified: boolean;
1249
+ name: string;
1250
+ image?: string | null | undefined;
1251
+ };
1252
+ };
1253
+ }>>[];
1254
+ query: import("zod").ZodOptional<import("zod").ZodObject<{
1255
+ configId: import("zod").ZodOptional<import("zod").ZodString>;
1256
+ organizationId: import("zod").ZodOptional<import("zod").ZodString>;
1257
+ limit: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
1258
+ offset: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
1259
+ sortBy: import("zod").ZodOptional<import("zod").ZodString>;
1260
+ sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
1261
+ asc: "asc";
1262
+ desc: "desc";
1263
+ }>>;
1264
+ }, import("zod/v4/core").$strip>>;
1265
+ metadata: {
1266
+ openapi: {
1267
+ description: string;
1268
+ responses: {
1269
+ "200": {
1270
+ description: string;
1271
+ content: {
1272
+ "application/json": {
1273
+ schema: {
1274
+ type: "object";
1275
+ properties: {
1276
+ apiKeys: {
1277
+ type: string;
1278
+ items: {
1279
+ type: string;
1280
+ properties: {
1281
+ id: {
1282
+ type: string;
1283
+ description: string;
1284
+ };
1285
+ name: {
1286
+ type: string;
1287
+ nullable: boolean;
1288
+ description: string;
1289
+ };
1290
+ start: {
1291
+ type: string;
1292
+ nullable: boolean;
1293
+ description: string;
1294
+ };
1295
+ prefix: {
1296
+ type: string;
1297
+ nullable: boolean;
1298
+ description: string;
1299
+ };
1300
+ userId: {
1301
+ type: string;
1302
+ description: string;
1303
+ };
1304
+ refillInterval: {
1305
+ type: string;
1306
+ nullable: boolean;
1307
+ description: string;
1308
+ };
1309
+ refillAmount: {
1310
+ type: string;
1311
+ nullable: boolean;
1312
+ description: string;
1313
+ };
1314
+ lastRefillAt: {
1315
+ type: string;
1316
+ format: string;
1317
+ nullable: boolean;
1318
+ description: string;
1319
+ };
1320
+ enabled: {
1321
+ type: string;
1322
+ description: string;
1323
+ default: boolean;
1324
+ };
1325
+ rateLimitEnabled: {
1326
+ type: string;
1327
+ description: string;
1328
+ };
1329
+ rateLimitTimeWindow: {
1330
+ type: string;
1331
+ nullable: boolean;
1332
+ description: string;
1333
+ };
1334
+ rateLimitMax: {
1335
+ type: string;
1336
+ nullable: boolean;
1337
+ description: string;
1338
+ };
1339
+ requestCount: {
1340
+ type: string;
1341
+ description: string;
1342
+ };
1343
+ remaining: {
1344
+ type: string;
1345
+ nullable: boolean;
1346
+ description: string;
1347
+ };
1348
+ lastRequest: {
1349
+ type: string;
1350
+ format: string;
1351
+ nullable: boolean;
1352
+ description: string;
1353
+ };
1354
+ expiresAt: {
1355
+ type: string;
1356
+ format: string;
1357
+ nullable: boolean;
1358
+ description: string;
1359
+ };
1360
+ createdAt: {
1361
+ type: string;
1362
+ format: string;
1363
+ description: string;
1364
+ };
1365
+ updatedAt: {
1366
+ type: string;
1367
+ format: string;
1368
+ description: string;
1369
+ };
1370
+ metadata: {
1371
+ type: string;
1372
+ nullable: boolean;
1373
+ additionalProperties: boolean;
1374
+ description: string;
1375
+ };
1376
+ permissions: {
1377
+ type: string;
1378
+ nullable: boolean;
1379
+ description: string;
1380
+ };
1381
+ };
1382
+ required: string[];
1383
+ };
1384
+ };
1385
+ total: {
1386
+ type: string;
1387
+ description: string;
1388
+ };
1389
+ limit: {
1390
+ type: string;
1391
+ nullable: boolean;
1392
+ description: string;
1393
+ };
1394
+ offset: {
1395
+ type: string;
1396
+ nullable: boolean;
1397
+ description: string;
1398
+ };
1399
+ };
1400
+ required: string[];
1401
+ };
1402
+ };
1403
+ };
1404
+ };
1405
+ };
1406
+ };
1407
+ };
1408
+ }, {
1409
+ apiKeys: {
1410
+ metadata: Record<string, any> | null;
1411
+ permissions: {
1412
+ [key: string]: string[];
1413
+ } | null;
1414
+ id: string;
1415
+ configId: string;
1416
+ name: string | null;
1417
+ start: string | null;
1418
+ prefix: string | null;
1419
+ referenceId: string;
1420
+ refillInterval: number | null;
1421
+ refillAmount: number | null;
1422
+ lastRefillAt: Date | null;
1423
+ enabled: boolean;
1424
+ rateLimitEnabled: boolean;
1425
+ rateLimitTimeWindow: number | null;
1426
+ rateLimitMax: number | null;
1427
+ requestCount: number;
1428
+ remaining: number | null;
1429
+ lastRequest: Date | null;
1430
+ expiresAt: Date | null;
1431
+ createdAt: Date;
1432
+ updatedAt: Date;
1433
+ }[];
1434
+ total: number;
1435
+ limit: number | undefined;
1436
+ offset: number | undefined;
1437
+ }>;
1438
+ deleteAllExpiredApiKeys: import("better-call").StrictEndpoint<string, {
1439
+ method: "POST";
1440
+ }, {
1441
+ success: boolean;
1442
+ error: unknown;
1443
+ }>;
1444
+ };
1445
+ schema: {
1446
+ apikey: {
1447
+ fields: {
1448
+ configId: {
1449
+ type: "string";
1450
+ required: true;
1451
+ defaultValue: string;
1452
+ input: false;
1453
+ index: true;
1454
+ };
1455
+ name: {
1456
+ type: "string";
1457
+ required: false;
1458
+ input: false;
1459
+ };
1460
+ start: {
1461
+ type: "string";
1462
+ required: false;
1463
+ input: false;
1464
+ };
1465
+ referenceId: {
1466
+ type: "string";
1467
+ required: true;
1468
+ input: false;
1469
+ index: true;
1470
+ };
1471
+ prefix: {
1472
+ type: "string";
1473
+ required: false;
1474
+ input: false;
1475
+ };
1476
+ key: {
1477
+ type: "string";
1478
+ required: true;
1479
+ input: false;
1480
+ index: true;
1481
+ };
1482
+ refillInterval: {
1483
+ type: "number";
1484
+ required: false;
1485
+ input: false;
1486
+ };
1487
+ refillAmount: {
1488
+ type: "number";
1489
+ required: false;
1490
+ input: false;
1491
+ };
1492
+ lastRefillAt: {
1493
+ type: "date";
1494
+ required: false;
1495
+ input: false;
1496
+ };
1497
+ enabled: {
1498
+ type: "boolean";
1499
+ required: false;
1500
+ input: false;
1501
+ defaultValue: true;
1502
+ };
1503
+ rateLimitEnabled: {
1504
+ type: "boolean";
1505
+ required: false;
1506
+ input: false;
1507
+ defaultValue: true;
1508
+ };
1509
+ rateLimitTimeWindow: {
1510
+ type: "number";
1511
+ required: false;
1512
+ input: false;
1513
+ defaultValue: number;
1514
+ };
1515
+ rateLimitMax: {
1516
+ type: "number";
1517
+ required: false;
1518
+ input: false;
1519
+ defaultValue: number;
1520
+ };
1521
+ requestCount: {
1522
+ type: "number";
1523
+ required: false;
1524
+ input: false;
1525
+ defaultValue: number;
1526
+ };
1527
+ remaining: {
1528
+ type: "number";
1529
+ required: false;
1530
+ input: false;
1531
+ };
1532
+ lastRequest: {
1533
+ type: "date";
1534
+ required: false;
1535
+ input: false;
1536
+ };
1537
+ expiresAt: {
1538
+ type: "date";
1539
+ required: false;
1540
+ input: false;
1541
+ };
1542
+ createdAt: {
1543
+ type: "date";
1544
+ required: true;
1545
+ input: false;
1546
+ };
1547
+ updatedAt: {
1548
+ type: "date";
1549
+ required: true;
1550
+ input: false;
1551
+ };
1552
+ permissions: {
1553
+ type: "string";
1554
+ required: false;
1555
+ input: false;
1556
+ };
1557
+ metadata: {
1558
+ type: "string";
1559
+ required: false;
1560
+ input: true;
1561
+ transform: {
1562
+ input(value: import("better-auth").DBPrimitive): string;
1563
+ output(value: import("better-auth").DBPrimitive): any;
1564
+ };
1565
+ };
1566
+ };
1567
+ };
1568
+ };
1569
+ };
1570
+ pathMethods: {
1571
+ "/api-key/create": "POST";
1572
+ "/api-key/delete": "POST";
1573
+ "/api-key/delete-all-expired-api-keys": "POST";
1574
+ };
1575
+ $ERROR_CODES: {
1576
+ INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
1577
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
1578
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
1579
+ USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
1580
+ UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
1581
+ KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
1582
+ KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
1583
+ KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
1584
+ USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
1585
+ KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
1586
+ EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
1587
+ EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
1588
+ INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
1589
+ INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
1590
+ INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
1591
+ METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
1592
+ RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
1593
+ NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
1594
+ KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
1595
+ INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
1596
+ INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
1597
+ INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
1598
+ INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
1599
+ SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
1600
+ FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
1601
+ NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
1602
+ ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
1603
+ USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
1604
+ INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
1605
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
1606
+ ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
1607
+ };
1608
+ }, {
1609
+ id: "two-factor";
1610
+ version: string;
1611
+ $InferServerPlugin: ReturnType<(<O extends import("better-auth/plugins/two-factor").TwoFactorOptions>(options?: O) => {
1612
+ id: "two-factor";
1613
+ version: string;
1614
+ endpoints: {
1615
+ enableTwoFactor: import("better-call").StrictEndpoint<"/two-factor/enable", {
1616
+ method: "POST";
1617
+ body: import("zod").ZodObject<{
1618
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1619
+ method: import("zod").ZodDefault<import("zod").ZodEnum<{
1620
+ otp: "otp";
1621
+ totp: "totp";
1622
+ }>>;
1623
+ issuer: import("zod").ZodOptional<import("zod").ZodString>;
1624
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
1625
+ password: import("zod").ZodString;
1626
+ method: import("zod").ZodDefault<import("zod").ZodEnum<{
1627
+ otp: "otp";
1628
+ totp: "totp";
1629
+ }>>;
1630
+ issuer: import("zod").ZodOptional<import("zod").ZodString>;
1631
+ }, import("zod/v4/core").$strip>;
1632
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1633
+ session: {
1634
+ session: Record<string, any> & {
1635
+ id: string;
1636
+ createdAt: Date;
1637
+ updatedAt: Date;
1638
+ userId: string;
1639
+ expiresAt: Date;
1640
+ token: string;
1641
+ ipAddress?: string | null | undefined;
1642
+ userAgent?: string | null | undefined;
1643
+ };
1644
+ user: Record<string, any> & {
1645
+ id: string;
1646
+ createdAt: Date;
1647
+ updatedAt: Date;
1648
+ email: string;
1649
+ emailVerified: boolean;
1650
+ name: string;
1651
+ image?: string | null | undefined;
1652
+ };
1653
+ };
1654
+ }>>[];
1655
+ metadata: {
1656
+ openapi: {
1657
+ summary: string;
1658
+ description: string;
1659
+ responses: {
1660
+ 200: {
1661
+ description: string;
1662
+ content: {
1663
+ "application/json": {
1664
+ schema: {
1665
+ type: "object";
1666
+ properties: {
1667
+ method: {
1668
+ type: string;
1669
+ enum: string[];
1670
+ description: string;
1671
+ };
1672
+ totpURI: {
1673
+ type: string;
1674
+ description: string;
1675
+ };
1676
+ backupCodes: {
1677
+ type: string;
1678
+ items: {
1679
+ type: string;
1680
+ };
1681
+ description: string;
1682
+ };
1683
+ };
1684
+ required: string[];
1685
+ };
1686
+ };
1687
+ };
1688
+ };
1689
+ };
1690
+ };
1691
+ };
1692
+ }, {
1693
+ method: "otp";
1694
+ } | {
1695
+ method: "totp";
1696
+ totpURI: string;
1697
+ backupCodes: string[];
1698
+ }>;
1699
+ disableTwoFactor: import("better-call").StrictEndpoint<"/two-factor/disable", {
1700
+ method: "POST";
1701
+ body: import("zod").ZodObject<{
1702
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1703
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
1704
+ password: import("zod").ZodString;
1705
+ }, import("zod/v4/core").$strip>;
1706
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1707
+ session: {
1708
+ session: Record<string, any> & {
1709
+ id: string;
1710
+ createdAt: Date;
1711
+ updatedAt: Date;
1712
+ userId: string;
1713
+ expiresAt: Date;
1714
+ token: string;
1715
+ ipAddress?: string | null | undefined;
1716
+ userAgent?: string | null | undefined;
1717
+ };
1718
+ user: Record<string, any> & {
1719
+ id: string;
1720
+ createdAt: Date;
1721
+ updatedAt: Date;
1722
+ email: string;
1723
+ emailVerified: boolean;
1724
+ name: string;
1725
+ image?: string | null | undefined;
1726
+ };
1727
+ };
1728
+ }>>[];
1729
+ metadata: {
1730
+ openapi: {
1731
+ summary: string;
1732
+ description: string;
1733
+ responses: {
1734
+ 200: {
1735
+ description: string;
1736
+ content: {
1737
+ "application/json": {
1738
+ schema: {
1739
+ type: "object";
1740
+ properties: {
1741
+ status: {
1742
+ type: string;
1743
+ };
1744
+ };
1745
+ };
1746
+ };
1747
+ };
1748
+ };
1749
+ };
1750
+ };
1751
+ };
1752
+ }, {
1753
+ status: boolean;
1754
+ }>;
1755
+ verifyBackupCode: import("better-call").StrictEndpoint<"/two-factor/verify-backup-code", {
1756
+ method: "POST";
1757
+ body: import("zod").ZodObject<{
1758
+ code: import("zod").ZodString;
1759
+ disableSession: import("zod").ZodOptional<import("zod").ZodBoolean>;
1760
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
1761
+ }, import("zod/v4/core").$strip>;
1762
+ metadata: {
1763
+ openapi: {
1764
+ description: string;
1765
+ responses: {
1766
+ "200": {
1767
+ description: string;
1768
+ content: {
1769
+ "application/json": {
1770
+ schema: {
1771
+ type: "object";
1772
+ properties: {
1773
+ user: {
1774
+ type: string;
1775
+ properties: {
1776
+ id: {
1777
+ type: string;
1778
+ description: string;
1779
+ };
1780
+ email: {
1781
+ type: string;
1782
+ format: string;
1783
+ nullable: boolean;
1784
+ description: string;
1785
+ };
1786
+ emailVerified: {
1787
+ type: string;
1788
+ nullable: boolean;
1789
+ description: string;
1790
+ };
1791
+ name: {
1792
+ type: string;
1793
+ nullable: boolean;
1794
+ description: string;
1795
+ };
1796
+ image: {
1797
+ type: string;
1798
+ format: string;
1799
+ nullable: boolean;
1800
+ description: string;
1801
+ };
1802
+ twoFactorEnabled: {
1803
+ type: string;
1804
+ description: string;
1805
+ };
1806
+ createdAt: {
1807
+ type: string;
1808
+ format: string;
1809
+ description: string;
1810
+ };
1811
+ updatedAt: {
1812
+ type: string;
1813
+ format: string;
1814
+ description: string;
1815
+ };
1816
+ };
1817
+ required: string[];
1818
+ description: string;
1819
+ };
1820
+ session: {
1821
+ type: string;
1822
+ properties: {
1823
+ token: {
1824
+ type: string;
1825
+ description: string;
1826
+ };
1827
+ userId: {
1828
+ type: string;
1829
+ description: string;
1830
+ };
1831
+ createdAt: {
1832
+ type: string;
1833
+ format: string;
1834
+ description: string;
1835
+ };
1836
+ expiresAt: {
1837
+ type: string;
1838
+ format: string;
1839
+ description: string;
1840
+ };
1841
+ };
1842
+ required: string[];
1843
+ description: string;
1844
+ };
1845
+ };
1846
+ required: string[];
1847
+ };
1848
+ };
1849
+ };
1850
+ };
1851
+ };
1852
+ };
1853
+ };
1854
+ }, {
1855
+ token: string | undefined;
1856
+ user: (Record<string, any> & {
1857
+ id: string;
1858
+ createdAt: Date;
1859
+ updatedAt: Date;
1860
+ email: string;
1861
+ emailVerified: boolean;
1862
+ name: string;
1863
+ image?: string | null | undefined;
1864
+ }) | import("better-auth/plugins/two-factor").UserWithTwoFactor;
1865
+ }>;
1866
+ generateBackupCodes: import("better-call").StrictEndpoint<"/two-factor/generate-backup-codes", {
1867
+ method: "POST";
1868
+ body: import("zod").ZodObject<{
1869
+ password: import("zod").ZodOptional<import("zod").ZodString>;
1870
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
1871
+ password: import("zod").ZodString;
1872
+ }, import("zod/v4/core").$strip>;
1873
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1874
+ session: {
1875
+ session: Record<string, any> & {
1876
+ id: string;
1877
+ createdAt: Date;
1878
+ updatedAt: Date;
1879
+ userId: string;
1880
+ expiresAt: Date;
1881
+ token: string;
1882
+ ipAddress?: string | null | undefined;
1883
+ userAgent?: string | null | undefined;
1884
+ };
1885
+ user: Record<string, any> & {
1886
+ id: string;
1887
+ createdAt: Date;
1888
+ updatedAt: Date;
1889
+ email: string;
1890
+ emailVerified: boolean;
1891
+ name: string;
1892
+ image?: string | null | undefined;
1893
+ };
1894
+ };
1895
+ }>>[];
1896
+ metadata: {
1897
+ openapi: {
1898
+ description: string;
1899
+ responses: {
1900
+ "200": {
1901
+ description: string;
1902
+ content: {
1903
+ "application/json": {
1904
+ schema: {
1905
+ type: "object";
1906
+ properties: {
1907
+ status: {
1908
+ type: string;
1909
+ description: string;
1910
+ enum: boolean[];
1911
+ };
1912
+ backupCodes: {
1913
+ type: string;
1914
+ items: {
1915
+ type: string;
1916
+ };
1917
+ description: string;
1918
+ };
1919
+ };
1920
+ required: string[];
1921
+ };
1922
+ };
1923
+ };
1924
+ };
1925
+ };
1926
+ };
1927
+ };
1928
+ }, {
1929
+ status: boolean;
1930
+ backupCodes: string[];
1931
+ }>;
1932
+ viewBackupCodes: import("better-call").StrictEndpoint<string, {
1933
+ method: "POST";
1934
+ body: import("zod").ZodObject<{
1935
+ userId: import("zod").ZodCoercedString<unknown>;
1936
+ }, import("zod/v4/core").$strip>;
1937
+ }, {
1938
+ status: boolean;
1939
+ backupCodes: string[];
1940
+ }>;
1941
+ sendTwoFactorOTP: import("better-call").StrictEndpoint<"/two-factor/send-otp", {
1942
+ method: "POST";
1943
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
1944
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
1945
+ }, import("zod/v4/core").$strip>>;
1946
+ metadata: {
1947
+ openapi: {
1948
+ summary: string;
1949
+ description: string;
1950
+ responses: {
1951
+ 200: {
1952
+ description: string;
1953
+ content: {
1954
+ "application/json": {
1955
+ schema: {
1956
+ type: "object";
1957
+ properties: {
1958
+ status: {
1959
+ type: string;
1960
+ };
1961
+ };
1962
+ };
1963
+ };
1964
+ };
1965
+ };
1966
+ };
1967
+ };
1968
+ };
1969
+ }, {
1970
+ status: boolean;
1971
+ }>;
1972
+ verifyTwoFactorOTP: import("better-call").StrictEndpoint<"/two-factor/verify-otp", {
1973
+ method: "POST";
1974
+ body: import("zod").ZodObject<{
1975
+ code: import("zod").ZodString;
1976
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
1977
+ }, import("zod/v4/core").$strip>;
1978
+ metadata: {
1979
+ openapi: {
1980
+ summary: string;
1981
+ description: string;
1982
+ responses: {
1983
+ "200": {
1984
+ description: string;
1985
+ content: {
1986
+ "application/json": {
1987
+ schema: {
1988
+ type: "object";
1989
+ properties: {
1990
+ token: {
1991
+ type: string;
1992
+ description: string;
1993
+ };
1994
+ user: {
1995
+ type: string;
1996
+ properties: {
1997
+ id: {
1998
+ type: string;
1999
+ description: string;
2000
+ };
2001
+ email: {
2002
+ type: string;
2003
+ format: string;
2004
+ nullable: boolean;
2005
+ description: string;
2006
+ };
2007
+ emailVerified: {
2008
+ type: string;
2009
+ nullable: boolean;
2010
+ description: string;
2011
+ };
2012
+ name: {
2013
+ type: string;
2014
+ nullable: boolean;
2015
+ description: string;
2016
+ };
2017
+ image: {
2018
+ type: string;
2019
+ format: string;
2020
+ nullable: boolean;
2021
+ description: string;
2022
+ };
2023
+ createdAt: {
2024
+ type: string;
2025
+ format: string;
2026
+ description: string;
2027
+ };
2028
+ updatedAt: {
2029
+ type: string;
2030
+ format: string;
2031
+ description: string;
2032
+ };
2033
+ };
2034
+ required: string[];
2035
+ description: string;
2036
+ };
2037
+ };
2038
+ required: string[];
2039
+ };
2040
+ };
2041
+ };
2042
+ };
2043
+ };
2044
+ };
2045
+ };
2046
+ }, {
2047
+ token: string;
2048
+ user: import("better-auth/plugins/two-factor").UserWithTwoFactor;
2049
+ } | {
2050
+ token: string;
2051
+ user: Record<string, any> & {
2052
+ id: string;
2053
+ createdAt: Date;
2054
+ updatedAt: Date;
2055
+ email: string;
2056
+ emailVerified: boolean;
2057
+ name: string;
2058
+ image?: string | null | undefined;
2059
+ };
2060
+ }>;
2061
+ generateTOTP: import("better-call").StrictEndpoint<string, {
2062
+ method: "POST";
2063
+ body: import("zod").ZodObject<{
2064
+ secret: import("zod").ZodString;
2065
+ }, import("zod/v4/core").$strip>;
2066
+ metadata: {
2067
+ openapi: {
2068
+ summary: string;
2069
+ description: string;
2070
+ responses: {
2071
+ 200: {
2072
+ description: string;
2073
+ content: {
2074
+ "application/json": {
2075
+ schema: {
2076
+ type: "object";
2077
+ properties: {
2078
+ code: {
2079
+ type: string;
2080
+ };
2081
+ };
2082
+ };
2083
+ };
2084
+ };
2085
+ };
2086
+ };
2087
+ };
2088
+ };
2089
+ }, {
2090
+ code: string;
2091
+ }>;
2092
+ getTOTPURI: import("better-call").StrictEndpoint<"/two-factor/get-totp-uri", {
2093
+ method: "POST";
2094
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2095
+ session: {
2096
+ session: Record<string, any> & {
2097
+ id: string;
2098
+ createdAt: Date;
2099
+ updatedAt: Date;
2100
+ userId: string;
2101
+ expiresAt: Date;
2102
+ token: string;
2103
+ ipAddress?: string | null | undefined;
2104
+ userAgent?: string | null | undefined;
2105
+ };
2106
+ user: Record<string, any> & {
2107
+ id: string;
2108
+ createdAt: Date;
2109
+ updatedAt: Date;
2110
+ email: string;
2111
+ emailVerified: boolean;
2112
+ name: string;
2113
+ image?: string | null | undefined;
2114
+ };
2115
+ };
2116
+ }>>[];
2117
+ body: import("zod").ZodObject<{
2118
+ password: import("zod").ZodOptional<import("zod").ZodString>;
2119
+ }, import("zod/v4/core").$strip> | import("zod").ZodObject<{
2120
+ password: import("zod").ZodString;
2121
+ }, import("zod/v4/core").$strip>;
2122
+ metadata: {
2123
+ openapi: {
2124
+ summary: string;
2125
+ description: string;
2126
+ responses: {
2127
+ 200: {
2128
+ description: string;
2129
+ content: {
2130
+ "application/json": {
2131
+ schema: {
2132
+ type: "object";
2133
+ properties: {
2134
+ totpURI: {
2135
+ type: string;
2136
+ };
2137
+ };
2138
+ };
2139
+ };
2140
+ };
2141
+ };
2142
+ };
2143
+ };
2144
+ };
2145
+ }, {
2146
+ totpURI: string;
2147
+ }>;
2148
+ verifyTOTP: import("better-call").StrictEndpoint<"/two-factor/verify-totp", {
2149
+ method: "POST";
2150
+ body: import("zod").ZodObject<{
2151
+ code: import("zod").ZodString;
2152
+ trustDevice: import("zod").ZodOptional<import("zod").ZodBoolean>;
2153
+ }, import("zod/v4/core").$strip>;
2154
+ metadata: {
2155
+ openapi: {
2156
+ summary: string;
2157
+ description: string;
2158
+ responses: {
2159
+ 200: {
2160
+ description: string;
2161
+ content: {
2162
+ "application/json": {
2163
+ schema: {
2164
+ type: "object";
2165
+ properties: {
2166
+ status: {
2167
+ type: string;
2168
+ };
2169
+ };
2170
+ };
2171
+ };
2172
+ };
2173
+ };
2174
+ };
2175
+ };
2176
+ };
2177
+ }, {
2178
+ token: string;
2179
+ user: import("better-auth/plugins/two-factor").UserWithTwoFactor;
2180
+ } | {
2181
+ token: string;
2182
+ user: Record<string, any> & {
2183
+ id: string;
2184
+ createdAt: Date;
2185
+ updatedAt: Date;
2186
+ email: string;
2187
+ emailVerified: boolean;
2188
+ name: string;
2189
+ image?: string | null | undefined;
2190
+ };
2191
+ }>;
2192
+ };
2193
+ options: NoInfer<O>;
2194
+ hooks: {
2195
+ after: {
2196
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
2197
+ handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2198
+ twoFactorRedirect: boolean;
2199
+ twoFactorMethods: string[];
2200
+ } | undefined>>;
2201
+ }[];
2202
+ };
2203
+ schema: {
2204
+ user: {
2205
+ fields: {
2206
+ twoFactorEnabled: {
2207
+ type: "boolean";
2208
+ required: false;
2209
+ defaultValue: false;
2210
+ input: false;
2211
+ };
2212
+ };
2213
+ };
2214
+ twoFactor: {
2215
+ fields: {
2216
+ secret: {
2217
+ type: "string";
2218
+ required: true;
2219
+ returned: false;
2220
+ index: true;
2221
+ };
2222
+ backupCodes: {
2223
+ type: "string";
2224
+ required: true;
2225
+ returned: false;
2226
+ };
2227
+ userId: {
2228
+ type: "string";
2229
+ required: true;
2230
+ returned: false;
2231
+ references: {
2232
+ model: string;
2233
+ field: string;
2234
+ };
2235
+ index: true;
2236
+ };
2237
+ verified: {
2238
+ type: "boolean";
2239
+ required: false;
2240
+ defaultValue: true;
2241
+ input: false;
2242
+ };
2243
+ failedVerificationCount: {
2244
+ type: "number";
2245
+ required: false;
2246
+ defaultValue: number;
2247
+ input: false;
2248
+ returned: false;
2249
+ };
2250
+ lockedUntil: {
2251
+ type: "date";
2252
+ required: false;
2253
+ input: false;
2254
+ returned: false;
2255
+ };
2256
+ };
2257
+ };
2258
+ };
2259
+ rateLimit: {
2260
+ pathMatcher(path: string): boolean;
2261
+ window: number;
2262
+ max: number;
2263
+ }[];
2264
+ $ERROR_CODES: {
2265
+ OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
2266
+ OTP_NOT_CONFIGURED: import("better-auth").RawError<"OTP_NOT_CONFIGURED">;
2267
+ OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
2268
+ TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
2269
+ TOTP_ALREADY_ENABLED: import("better-auth").RawError<"TOTP_ALREADY_ENABLED">;
2270
+ TOTP_NOT_CONFIGURED: import("better-auth").RawError<"TOTP_NOT_CONFIGURED">;
2271
+ TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
2272
+ BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
2273
+ INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
2274
+ INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
2275
+ TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
2276
+ ACCOUNT_TEMPORARILY_LOCKED: import("better-auth").RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
2277
+ INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
2278
+ };
2279
+ })>;
2280
+ atomListeners: {
2281
+ matcher: (path: string) => boolean;
2282
+ signal: "$sessionSignal";
2283
+ }[];
2284
+ pathMethods: {
2285
+ "/two-factor/disable": "POST";
2286
+ "/two-factor/enable": "POST";
2287
+ "/two-factor/send-otp": "POST";
2288
+ "/two-factor/generate-backup-codes": "POST";
2289
+ "/two-factor/get-totp-uri": "POST";
2290
+ "/two-factor/verify-totp": "POST";
2291
+ "/two-factor/verify-otp": "POST";
2292
+ "/two-factor/verify-backup-code": "POST";
2293
+ };
2294
+ fetchPlugins: {
2295
+ id: string;
2296
+ name: string;
2297
+ hooks: {
2298
+ onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): Promise<void>;
2299
+ };
2300
+ }[];
2301
+ $ERROR_CODES: {
2302
+ OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
2303
+ OTP_NOT_CONFIGURED: import("better-auth").RawError<"OTP_NOT_CONFIGURED">;
2304
+ OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
2305
+ TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
2306
+ TOTP_ALREADY_ENABLED: import("better-auth").RawError<"TOTP_ALREADY_ENABLED">;
2307
+ TOTP_NOT_CONFIGURED: import("better-auth").RawError<"TOTP_NOT_CONFIGURED">;
2308
+ TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
2309
+ BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
2310
+ INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
2311
+ INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
2312
+ TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
2313
+ ACCOUNT_TEMPORARILY_LOCKED: import("better-auth").RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
2314
+ INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
2315
+ };
2316
+ }];
2317
+ type ClientOptions<Extensions extends BetterAuthClientPlugin[]> = Omit<BetterAuthClientOptions, 'plugins'> & {
2318
+ plugins: [...ReturnType<typeof standardPlugins>, ...Extensions];
2319
+ };
2320
+ /** Standard client preset. The server must enable the corresponding native extensions. */
2321
+ export declare function createBetterAuthClient<const Extensions extends BetterAuthClientPlugin[] = []>(options?: Omit<BetterAuthClientOptions, 'plugins'> & {
2322
+ plugins?: Extensions;
2323
+ }): ReactAuthClient<ClientOptions<Extensions>>;
2324
+ export {};