@talajs/auth 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2721 @@
1
+ import type { TalaDb } from '@talajs/db';
2
+ /** Scopes Tala's OAuth provider grants. `tala:write` implies read. */
3
+ export declare const OAUTH_SCOPES: readonly ['tala:read', 'tala:write'];
4
+ export declare const ACCESS_TOKEN_PREFIX = "tala_at_";
5
+ export interface OAuthProviderOptions {
6
+ /**
7
+ * The protected resource tokens are issued for: your MCP server's public URL, exactly, e.g.
8
+ * `https://cafe.example/tala/mcp`. Tokens for any other resource are refused.
9
+ */
10
+ resource: string;
11
+ /** Where the admin is served, e.g. `/admin`. Sign-in, business choice and consent live there. */
12
+ adminPath?: string;
13
+ /** Seconds. Default 900 (15 minutes). */
14
+ accessTokenTtl?: number;
15
+ /** Seconds. Default 30 days. Rotated on every refresh. */
16
+ refreshTokenTtl?: number;
17
+ }
18
+ export declare function sha256Hex(value: string): Promise<string>;
19
+ /** Active memberships of a Better Auth user, in businesses that aren't disabled. */
20
+ export declare function businessesOf(db: TalaDb, userId: string): Promise<{
21
+ tenantId: string;
22
+ tenantName: string;
23
+ role: import("@talajs/db").MemberRole;
24
+ }[]>;
25
+ /**
26
+ * The business a connection is for: the only one, or the one chosen on the business screen
27
+ * (stored on the sign-in session). Null when there's no valid choice yet.
28
+ */
29
+ export declare function chosenBusiness(db: TalaDb, userId: string, activeTenantId: unknown): Promise<{
30
+ tenantId: string;
31
+ tenantName: string;
32
+ role: import("@talajs/db").MemberRole;
33
+ } | null>;
34
+ /** The Better Auth plugin, configured for MCP clients such as Claude's custom connectors. */
35
+ export declare function talaOAuthProvider(db: TalaDb, options: OAuthProviderOptions): {
36
+ id: "oauth-provider";
37
+ version: string;
38
+ options: NoInfer<{
39
+ loginPage: string;
40
+ consentPage: string;
41
+ disableJwtPlugin: true;
42
+ scopes: string[];
43
+ allowDynamicClientRegistration: true;
44
+ allowUnauthenticatedClientRegistration: true;
45
+ clientRegistrationDefaultScopes: string[];
46
+ clientRegistrationAllowedScopes: string[];
47
+ resources: {
48
+ identifier: string;
49
+ name: string;
50
+ allowedScopes: string[];
51
+ }[];
52
+ clientRegistrationDefaultResources: string[];
53
+ resourceSeedScope: "process";
54
+ accessTokenExpiresIn: number;
55
+ refreshTokenExpiresIn: number;
56
+ storeTokens: {
57
+ hash: (token: string) => Promise<string>;
58
+ };
59
+ prefix: {
60
+ opaqueAccessToken: string;
61
+ refreshToken: string;
62
+ };
63
+ postLogin: {
64
+ page: string;
65
+ shouldRedirect: ({ user, session, isContinuation }: {
66
+ headers: Headers;
67
+ user: {
68
+ id: string;
69
+ createdAt: Date;
70
+ updatedAt: Date;
71
+ email: string;
72
+ emailVerified: boolean;
73
+ name: string;
74
+ image?: string | null | undefined;
75
+ } & Record<string, unknown>;
76
+ session: {
77
+ id: string;
78
+ createdAt: Date;
79
+ updatedAt: Date;
80
+ userId: string;
81
+ expiresAt: Date;
82
+ token: string;
83
+ ipAddress?: string | null | undefined;
84
+ userAgent?: string | null | undefined;
85
+ } & Record<string, unknown>;
86
+ scopes: import("@better-auth/oauth-provider").Scope[];
87
+ isContinuation: boolean;
88
+ }) => Promise<boolean>;
89
+ consentReferenceId: ({ user, session }: {
90
+ user: {
91
+ id: string;
92
+ createdAt: Date;
93
+ updatedAt: Date;
94
+ email: string;
95
+ emailVerified: boolean;
96
+ name: string;
97
+ image?: string | null | undefined;
98
+ } & Record<string, unknown>;
99
+ session: {
100
+ id: string;
101
+ createdAt: Date;
102
+ updatedAt: Date;
103
+ userId: string;
104
+ expiresAt: Date;
105
+ token: string;
106
+ ipAddress?: string | null | undefined;
107
+ userAgent?: string | null | undefined;
108
+ } & Record<string, unknown>;
109
+ scopes: import("@better-auth/oauth-provider").Scope[];
110
+ }) => Promise<string>;
111
+ };
112
+ schema: never;
113
+ rateLimit: {
114
+ token: {
115
+ window: number;
116
+ max: number;
117
+ };
118
+ register: {
119
+ window: number;
120
+ max: number;
121
+ };
122
+ };
123
+ silenceWarnings: {
124
+ oauthAuthServerConfig: boolean;
125
+ openidConfig: boolean;
126
+ };
127
+ }>;
128
+ onRequest: (request: Request, ctx: import("better-auth").AuthContext) => Promise<{
129
+ response: Response;
130
+ } | {
131
+ request: Request;
132
+ } | void>;
133
+ init: (ctx: import("better-auth").AuthContext) => Promise<{
134
+ options: {
135
+ databaseHooks: {
136
+ session: {
137
+ delete: {
138
+ before(session: {
139
+ id: string;
140
+ createdAt: Date;
141
+ updatedAt: Date;
142
+ userId: string;
143
+ expiresAt: Date;
144
+ token: string;
145
+ ipAddress?: string | null | undefined;
146
+ userAgent?: string | null | undefined;
147
+ } & Record<string, unknown>, hookCtx: import("better-auth").GenericEndpointContext | null): Promise<void>;
148
+ after(session: {
149
+ id: string;
150
+ createdAt: Date;
151
+ updatedAt: Date;
152
+ userId: string;
153
+ expiresAt: Date;
154
+ token: string;
155
+ ipAddress?: string | null | undefined;
156
+ userAgent?: string | null | undefined;
157
+ } & Record<string, unknown>, hookCtx: import("better-auth").GenericEndpointContext | null): Promise<void>;
158
+ };
159
+ };
160
+ };
161
+ };
162
+ }>;
163
+ hooks: {
164
+ before: {
165
+ matcher(ctx: import("better-auth").HookEndpointContext): any;
166
+ handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
167
+ }[];
168
+ after: {
169
+ matcher(ctx: import("better-auth").HookEndpointContext): boolean;
170
+ handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
171
+ redirect: true;
172
+ url: string;
173
+ } | undefined>>;
174
+ }[];
175
+ };
176
+ endpoints: {
177
+ getOAuthServerConfig: import("better-auth").StrictEndpoint<"/.well-known/oauth-authorization-server", {
178
+ method: "GET";
179
+ metadata: {
180
+ SERVER_ONLY: true;
181
+ };
182
+ }, import("@better-auth/oauth-provider").AuthServerMetadata>;
183
+ getOpenIdConfig: import("better-auth").StrictEndpoint<"/.well-known/openid-configuration", {
184
+ method: "GET";
185
+ metadata: {
186
+ SERVER_ONLY: true;
187
+ };
188
+ }, {
189
+ jwks_uri?: string | undefined;
190
+ userinfo_endpoint: string;
191
+ acr_values_supported?: string[] | undefined;
192
+ subject_types_supported: ("public" | "pairwise")[];
193
+ claims_supported: string[];
194
+ claims_parameter_supported?: boolean | undefined;
195
+ end_session_endpoint: string;
196
+ request_parameter_supported?: boolean | undefined;
197
+ request_uri_parameter_supported?: boolean | undefined;
198
+ prompt_values_supported: import("@better-auth/oauth-provider").Prompt[];
199
+ issuer: string;
200
+ authorization_endpoint: string;
201
+ token_endpoint: string;
202
+ registration_endpoint?: string | undefined;
203
+ scopes_supported?: string[] | undefined;
204
+ response_types_supported: "code"[];
205
+ response_modes_supported: "query"[];
206
+ grant_types_supported: import("@better-auth/oauth-provider").GrantType[];
207
+ token_endpoint_auth_methods_supported?: import("@better-auth/oauth-provider").TokenEndpointAuthMethod[] | undefined;
208
+ token_endpoint_auth_signing_alg_values_supported?: import("better-auth").PrivateKeyJwtSigningAlgorithm[] | undefined;
209
+ service_documentation?: string | undefined;
210
+ ui_locales_supported?: string[] | undefined;
211
+ op_policy_uri?: string | undefined;
212
+ op_tos_uri?: string | undefined;
213
+ revocation_endpoint?: string | undefined;
214
+ revocation_endpoint_auth_methods_supported?: import("@better-auth/oauth-provider").TokenEndpointAuthMethod[] | undefined;
215
+ revocation_endpoint_auth_signing_alg_values_supported?: import("better-auth").PrivateKeyJwtSigningAlgorithm[] | undefined;
216
+ introspection_endpoint?: string | undefined;
217
+ introspection_endpoint_auth_methods_supported?: import("@better-auth/oauth-provider").TokenEndpointAuthMethod[] | undefined;
218
+ introspection_endpoint_auth_signing_alg_values_supported?: import("better-auth").PrivateKeyJwtSigningAlgorithm[] | undefined;
219
+ code_challenge_methods_supported: "S256"[];
220
+ authorization_response_iss_parameter_supported?: boolean | undefined;
221
+ client_id_metadata_document_supported?: boolean | undefined;
222
+ backchannel_logout_supported?: boolean | undefined;
223
+ backchannel_logout_session_supported?: boolean | undefined;
224
+ dpop_signing_alg_values_supported?: import("better-auth/plugins").JWSAlgorithms[] | undefined;
225
+ id_token_signing_alg_values_supported: import("better-auth/plugins").JWSAlgorithms[] | ["HS256"];
226
+ }>;
227
+ oauth2Authorize: import("better-auth").StrictEndpoint<"/oauth2/authorize", {
228
+ method: ("GET" | "POST")[];
229
+ body: import("zod").ZodObject<{}, import("zod/v4/core").$loose>;
230
+ redirectOnError: import("@better-auth/oauth-provider").OAuthRedirectOnError<import("better-auth").GenericEndpointContext, {
231
+ redirect: true;
232
+ url: string;
233
+ }>;
234
+ metadata: {
235
+ allowedMediaTypes: string[];
236
+ openapi: {
237
+ description: string;
238
+ parameters: ({
239
+ name: string;
240
+ in: "query";
241
+ required: false;
242
+ schema: {
243
+ type: "string";
244
+ format?: undefined;
245
+ minimum?: undefined;
246
+ items?: undefined;
247
+ };
248
+ description: string;
249
+ } | {
250
+ name: string;
251
+ in: "query";
252
+ required: true;
253
+ schema: {
254
+ type: "string";
255
+ format?: undefined;
256
+ minimum?: undefined;
257
+ items?: undefined;
258
+ };
259
+ description: string;
260
+ } | {
261
+ name: string;
262
+ in: "query";
263
+ required: false;
264
+ schema: {
265
+ type: "string";
266
+ format: string;
267
+ minimum?: undefined;
268
+ items?: undefined;
269
+ };
270
+ description: string;
271
+ } | {
272
+ name: string;
273
+ in: "query";
274
+ required: false;
275
+ schema: {
276
+ type: "integer";
277
+ minimum: number;
278
+ format?: undefined;
279
+ items?: undefined;
280
+ };
281
+ description: string;
282
+ } | {
283
+ name: string;
284
+ in: "query";
285
+ required: false;
286
+ schema: {
287
+ type: "array";
288
+ items: {
289
+ type: "string";
290
+ };
291
+ format?: undefined;
292
+ minimum?: undefined;
293
+ };
294
+ description: string;
295
+ })[];
296
+ responses: {
297
+ "302": {
298
+ description: string;
299
+ headers: {
300
+ Location: {
301
+ description: string;
302
+ schema: {
303
+ type: string;
304
+ format: string;
305
+ };
306
+ };
307
+ };
308
+ };
309
+ "400": {
310
+ description: string;
311
+ content: {
312
+ "application/json": {
313
+ schema: {
314
+ type: "object";
315
+ properties: {
316
+ error: {
317
+ type: string;
318
+ };
319
+ error_description: {
320
+ type: string;
321
+ };
322
+ state: {
323
+ type: string;
324
+ };
325
+ };
326
+ required: string[];
327
+ };
328
+ };
329
+ };
330
+ };
331
+ };
332
+ };
333
+ };
334
+ }, {
335
+ redirect: true;
336
+ url: string;
337
+ }>;
338
+ oauth2Consent: import("better-auth").StrictEndpoint<"/oauth2/consent", {
339
+ method: "POST";
340
+ body: import("zod").ZodObject<{
341
+ accept: import("zod").ZodBoolean;
342
+ scope: import("zod").ZodOptional<import("zod").ZodString>;
343
+ claims: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>]>>;
344
+ oauth_query: import("zod").ZodOptional<import("zod").ZodString>;
345
+ }, import("zod/v4/core").$strip>;
346
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
347
+ session: {
348
+ session: Record<string, any> & {
349
+ id: string;
350
+ createdAt: Date;
351
+ updatedAt: Date;
352
+ userId: string;
353
+ expiresAt: Date;
354
+ token: string;
355
+ ipAddress?: string | null | undefined;
356
+ userAgent?: string | null | undefined;
357
+ };
358
+ user: Record<string, any> & {
359
+ id: string;
360
+ createdAt: Date;
361
+ updatedAt: Date;
362
+ email: string;
363
+ emailVerified: boolean;
364
+ name: string;
365
+ image?: string | null | undefined;
366
+ };
367
+ };
368
+ }>>[];
369
+ metadata: {
370
+ openapi: {
371
+ description: string;
372
+ responses: {
373
+ "200": {
374
+ description: string;
375
+ content: {
376
+ "application/json": {
377
+ schema: {
378
+ type: "object";
379
+ properties: {
380
+ redirect: {
381
+ type: string;
382
+ description: string;
383
+ enum: boolean[];
384
+ };
385
+ url: {
386
+ type: string;
387
+ format: string;
388
+ description: string;
389
+ };
390
+ };
391
+ required: string[];
392
+ };
393
+ };
394
+ };
395
+ };
396
+ };
397
+ };
398
+ };
399
+ }, {
400
+ redirect: true;
401
+ url: string;
402
+ } | {
403
+ redirect: boolean;
404
+ url: string;
405
+ }>;
406
+ oauth2Continue: import("better-auth").StrictEndpoint<"/oauth2/continue", {
407
+ method: "POST";
408
+ body: import("zod").ZodObject<{
409
+ selected: import("zod").ZodOptional<import("zod").ZodBoolean>;
410
+ created: import("zod").ZodOptional<import("zod").ZodBoolean>;
411
+ postLogin: import("zod").ZodOptional<import("zod").ZodBoolean>;
412
+ oauth_query: import("zod").ZodOptional<import("zod").ZodString>;
413
+ }, import("zod/v4/core").$strip>;
414
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (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
+ redirect: {
449
+ type: string;
450
+ description: string;
451
+ enum: boolean[];
452
+ };
453
+ url: {
454
+ type: string;
455
+ format: string;
456
+ description: string;
457
+ };
458
+ };
459
+ required: string[];
460
+ };
461
+ };
462
+ };
463
+ };
464
+ };
465
+ };
466
+ };
467
+ }, {
468
+ redirect: true;
469
+ url: string;
470
+ }>;
471
+ oauth2Token: import("better-auth").StrictEndpoint<"/oauth2/token", {
472
+ method: "POST";
473
+ cloneRequest: true;
474
+ body: import("zod").ZodObject<{
475
+ grant_type: import("zod").ZodString;
476
+ client_id: import("zod").ZodOptional<import("zod").ZodString>;
477
+ client_secret: import("zod").ZodOptional<import("zod").ZodString>;
478
+ client_assertion: import("zod").ZodOptional<import("zod").ZodString>;
479
+ client_assertion_type: import("zod").ZodOptional<import("zod").ZodString>;
480
+ code: import("zod").ZodOptional<import("zod").ZodString>;
481
+ code_verifier: import("zod").ZodOptional<import("zod").ZodString>;
482
+ redirect_uri: import("zod").ZodOptional<import("zod").ZodURL>;
483
+ refresh_token: import("zod").ZodOptional<import("zod").ZodString>;
484
+ resource: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
485
+ scope: import("zod").ZodOptional<import("zod").ZodString>;
486
+ }, import("zod/v4/core").$loose>;
487
+ errorCodesByField: {
488
+ grant_type: {
489
+ missing: "invalid_request";
490
+ invalid: "unsupported_grant_type";
491
+ };
492
+ resource: {
493
+ invalid: "invalid_target";
494
+ };
495
+ };
496
+ metadata: {
497
+ noStore: boolean;
498
+ allowedMediaTypes: string[];
499
+ openapi: {
500
+ description: string;
501
+ parameters: {
502
+ name: string;
503
+ in: "header";
504
+ required: false;
505
+ schema: {
506
+ type: "string";
507
+ };
508
+ description: string;
509
+ }[];
510
+ requestBody: {
511
+ required: boolean;
512
+ content: {
513
+ "application/json": {
514
+ schema: {
515
+ type: "object";
516
+ properties: {
517
+ grant_type: {
518
+ type: string;
519
+ description: string;
520
+ };
521
+ client_id: {
522
+ type: string;
523
+ description: string;
524
+ };
525
+ client_secret: {
526
+ type: string;
527
+ description: string;
528
+ };
529
+ code: {
530
+ type: string;
531
+ description: string;
532
+ };
533
+ code_verifier: {
534
+ type: string;
535
+ description: string;
536
+ };
537
+ redirect_uri: {
538
+ type: string;
539
+ format: string;
540
+ description: string;
541
+ };
542
+ refresh_token: {
543
+ type: string;
544
+ description: string;
545
+ };
546
+ resource: {
547
+ oneOf: ({
548
+ type: string;
549
+ description: string;
550
+ items?: undefined;
551
+ } | {
552
+ type: string;
553
+ items: {
554
+ type: string;
555
+ };
556
+ description: string;
557
+ })[];
558
+ description: string;
559
+ };
560
+ scope: {
561
+ type: string;
562
+ description: string;
563
+ };
564
+ };
565
+ required: string[];
566
+ };
567
+ };
568
+ };
569
+ };
570
+ responses: {
571
+ "200": {
572
+ description: string;
573
+ content: {
574
+ "application/json": {
575
+ schema: {
576
+ type: "object";
577
+ properties: {
578
+ access_token: {
579
+ type: string;
580
+ description: string;
581
+ };
582
+ token_type: {
583
+ type: string;
584
+ description: string;
585
+ enum: string[];
586
+ };
587
+ expires_in: {
588
+ type: string;
589
+ description: string;
590
+ };
591
+ refresh_token: {
592
+ type: string;
593
+ description: string;
594
+ };
595
+ scope: {
596
+ type: string;
597
+ description: string;
598
+ };
599
+ id_token: {
600
+ type: string;
601
+ description: string;
602
+ };
603
+ };
604
+ required: string[];
605
+ };
606
+ };
607
+ };
608
+ };
609
+ "400": {
610
+ description: string;
611
+ content: {
612
+ "application/json": {
613
+ schema: {
614
+ type: "object";
615
+ properties: {
616
+ error: {
617
+ type: string;
618
+ };
619
+ error_description: {
620
+ type: string;
621
+ };
622
+ error_uri: {
623
+ type: string;
624
+ };
625
+ };
626
+ required: string[];
627
+ };
628
+ };
629
+ };
630
+ };
631
+ };
632
+ };
633
+ };
634
+ }, {
635
+ expires_in: number;
636
+ access_token: string;
637
+ expires_at: number;
638
+ token_type: import("@better-auth/oauth-provider").TokenType;
639
+ refresh_token: string | undefined;
640
+ scope: string;
641
+ id_token: string | undefined;
642
+ }>;
643
+ oauth2Introspect: import("better-auth").StrictEndpoint<"/oauth2/introspect", {
644
+ method: "POST";
645
+ cloneRequest: true;
646
+ body: import("zod").ZodObject<{
647
+ client_id: import("zod").ZodOptional<import("zod").ZodString>;
648
+ client_secret: import("zod").ZodOptional<import("zod").ZodString>;
649
+ client_assertion: import("zod").ZodOptional<import("zod").ZodString>;
650
+ client_assertion_type: import("zod").ZodOptional<import("zod").ZodString>;
651
+ token: import("zod").ZodString;
652
+ token_type_hint: import("zod").ZodOptional<import("zod").ZodString>;
653
+ }, import("zod/v4/core").$strip>;
654
+ metadata: {
655
+ noStore: boolean;
656
+ allowedMediaTypes: string[];
657
+ openapi: {
658
+ description: string;
659
+ requestBody: {
660
+ required: boolean;
661
+ content: {
662
+ "application/json": {
663
+ schema: {
664
+ type: "object";
665
+ properties: {
666
+ client_id: {
667
+ type: string;
668
+ description: string;
669
+ };
670
+ client_secret: {
671
+ type: string;
672
+ description: string;
673
+ };
674
+ token: {
675
+ type: string;
676
+ description: string;
677
+ };
678
+ token_type_hint: {
679
+ type: string;
680
+ description: string;
681
+ };
682
+ };
683
+ required: string[];
684
+ };
685
+ };
686
+ };
687
+ };
688
+ responses: {
689
+ "200": {
690
+ description: string;
691
+ content: {
692
+ "application/json": {
693
+ schema: {
694
+ type: "object";
695
+ properties: {
696
+ active: {
697
+ type: string;
698
+ description: string;
699
+ };
700
+ scope: {
701
+ type: string;
702
+ description: string;
703
+ };
704
+ client_id: {
705
+ type: string;
706
+ description: string;
707
+ };
708
+ username: {
709
+ type: string;
710
+ description: string;
711
+ };
712
+ token_type: {
713
+ type: string;
714
+ description: string;
715
+ };
716
+ exp: {
717
+ type: string;
718
+ description: string;
719
+ };
720
+ iat: {
721
+ type: string;
722
+ description: string;
723
+ };
724
+ nbf: {
725
+ type: string;
726
+ description: string;
727
+ };
728
+ sub: {
729
+ type: string;
730
+ description: string;
731
+ };
732
+ aud: {
733
+ type: string;
734
+ description: string;
735
+ };
736
+ iss: {
737
+ type: string;
738
+ description: string;
739
+ };
740
+ jti: {
741
+ type: string;
742
+ description: string;
743
+ };
744
+ };
745
+ required: string[];
746
+ };
747
+ };
748
+ };
749
+ };
750
+ "400": {
751
+ description: string;
752
+ content: {
753
+ "application/json": {
754
+ schema: {
755
+ type: "object";
756
+ properties: {
757
+ error: {
758
+ type: string;
759
+ };
760
+ error_description: {
761
+ type: string;
762
+ };
763
+ error_uri: {
764
+ type: string;
765
+ };
766
+ };
767
+ required: string[];
768
+ };
769
+ };
770
+ };
771
+ };
772
+ };
773
+ };
774
+ };
775
+ }, import("better-auth").JWTPayload>;
776
+ oauth2Revoke: import("better-auth").StrictEndpoint<"/oauth2/revoke", {
777
+ method: "POST";
778
+ cloneRequest: true;
779
+ body: import("zod").ZodObject<{
780
+ client_id: import("zod").ZodOptional<import("zod").ZodString>;
781
+ client_secret: import("zod").ZodOptional<import("zod").ZodString>;
782
+ client_assertion: import("zod").ZodOptional<import("zod").ZodString>;
783
+ client_assertion_type: import("zod").ZodOptional<import("zod").ZodString>;
784
+ token: import("zod").ZodString;
785
+ token_type_hint: import("zod").ZodOptional<import("zod").ZodString>;
786
+ }, import("zod/v4/core").$strip>;
787
+ metadata: {
788
+ allowedMediaTypes: string[];
789
+ openapi: {
790
+ description: string;
791
+ requestBody: {
792
+ required: boolean;
793
+ content: {
794
+ "application/json": {
795
+ schema: {
796
+ type: "object";
797
+ properties: {
798
+ client_id: {
799
+ type: string;
800
+ description: string;
801
+ };
802
+ client_secret: {
803
+ type: string;
804
+ description: string;
805
+ };
806
+ token: {
807
+ type: string;
808
+ description: string;
809
+ };
810
+ token_type_hint: {
811
+ type: string;
812
+ description: string;
813
+ };
814
+ };
815
+ required: string[];
816
+ };
817
+ };
818
+ };
819
+ };
820
+ responses: {
821
+ "200": {
822
+ description: string;
823
+ content: {
824
+ "application/json": {
825
+ schema: {
826
+ type: "object";
827
+ description: string;
828
+ };
829
+ };
830
+ };
831
+ };
832
+ "400": {
833
+ description: string;
834
+ content: {
835
+ "application/json": {
836
+ schema: {
837
+ type: "object";
838
+ properties: {
839
+ error: {
840
+ type: string;
841
+ };
842
+ error_description: {
843
+ type: string;
844
+ };
845
+ error_uri: {
846
+ type: string;
847
+ };
848
+ };
849
+ required: string[];
850
+ };
851
+ };
852
+ };
853
+ };
854
+ };
855
+ };
856
+ };
857
+ }, null | undefined>;
858
+ oauth2UserInfo: import("better-auth").StrictEndpoint<"/oauth2/userinfo", {
859
+ method: ("GET" | "POST")[];
860
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
861
+ access_token: import("zod").ZodOptional<import("zod").ZodString>;
862
+ }, import("zod/v4/core").$loose>>;
863
+ metadata: {
864
+ noStore: boolean;
865
+ allowedMediaTypes: string[];
866
+ openapi: {
867
+ description: string;
868
+ security: ({
869
+ bearerAuth: never[];
870
+ OAuth2?: undefined;
871
+ } | {
872
+ OAuth2: string[];
873
+ bearerAuth?: undefined;
874
+ })[];
875
+ parameters: {
876
+ name: string;
877
+ in: "header";
878
+ required: false;
879
+ schema: {
880
+ type: "string";
881
+ };
882
+ description: string;
883
+ }[];
884
+ responses: {
885
+ "200": {
886
+ description: string;
887
+ content: {
888
+ "application/json": {
889
+ schema: {
890
+ type: "object";
891
+ properties: {
892
+ sub: {
893
+ type: string;
894
+ description: string;
895
+ };
896
+ email: {
897
+ type: string;
898
+ format: string;
899
+ nullable: boolean;
900
+ description: string;
901
+ };
902
+ name: {
903
+ type: string;
904
+ nullable: boolean;
905
+ description: string;
906
+ };
907
+ picture: {
908
+ type: string;
909
+ format: string;
910
+ nullable: boolean;
911
+ description: string;
912
+ };
913
+ given_name: {
914
+ type: string;
915
+ nullable: boolean;
916
+ description: string;
917
+ };
918
+ family_name: {
919
+ type: string;
920
+ nullable: boolean;
921
+ description: string;
922
+ };
923
+ email_verified: {
924
+ type: string;
925
+ nullable: boolean;
926
+ description: string;
927
+ };
928
+ };
929
+ required: string[];
930
+ };
931
+ };
932
+ };
933
+ };
934
+ "401": {
935
+ description: string;
936
+ content: {
937
+ "application/json": {
938
+ schema: {
939
+ type: "object";
940
+ properties: {
941
+ error: {
942
+ type: string;
943
+ };
944
+ error_description: {
945
+ type: string;
946
+ };
947
+ };
948
+ required: string[];
949
+ };
950
+ };
951
+ };
952
+ };
953
+ "403": {
954
+ description: string;
955
+ content: {
956
+ "application/json": {
957
+ schema: {
958
+ type: "object";
959
+ properties: {
960
+ error: {
961
+ type: string;
962
+ };
963
+ error_description: {
964
+ type: string;
965
+ };
966
+ };
967
+ required: string[];
968
+ };
969
+ };
970
+ };
971
+ };
972
+ };
973
+ };
974
+ };
975
+ }, {
976
+ sub: unknown;
977
+ }>;
978
+ oauth2EndSession: import("better-auth").StrictEndpoint<"/oauth2/end-session", {
979
+ method: ("GET" | "POST")[];
980
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
981
+ id_token_hint: import("zod").ZodOptional<import("zod").ZodString>;
982
+ client_id: import("zod").ZodOptional<import("zod").ZodString>;
983
+ post_logout_redirect_uri: import("zod").ZodOptional<import("zod").ZodURL>;
984
+ state: import("zod").ZodOptional<import("zod").ZodString>;
985
+ }, import("zod/v4/core").$strip>>;
986
+ query: import("zod").ZodOptional<import("zod").ZodObject<{
987
+ id_token_hint: import("zod").ZodOptional<import("zod").ZodString>;
988
+ client_id: import("zod").ZodOptional<import("zod").ZodString>;
989
+ post_logout_redirect_uri: import("zod").ZodOptional<import("zod").ZodURL>;
990
+ state: import("zod").ZodOptional<import("zod").ZodString>;
991
+ }, import("zod/v4/core").$strip>>;
992
+ metadata: {
993
+ noStore: boolean;
994
+ allowedMediaTypes: string[];
995
+ $Infer: {
996
+ body: {
997
+ id_token_hint?: string;
998
+ client_id?: string;
999
+ post_logout_redirect_uri?: string;
1000
+ state?: string;
1001
+ } | {
1002
+ query: {
1003
+ id_token_hint?: string;
1004
+ client_id?: string;
1005
+ post_logout_redirect_uri?: string;
1006
+ state?: string;
1007
+ };
1008
+ };
1009
+ query: {
1010
+ id_token_hint?: string;
1011
+ client_id?: string;
1012
+ post_logout_redirect_uri?: string;
1013
+ state?: string;
1014
+ };
1015
+ };
1016
+ openapi: {
1017
+ description: string;
1018
+ responses: {
1019
+ "200": {
1020
+ description: string;
1021
+ content: {
1022
+ "application/json": {
1023
+ schema: {
1024
+ type: "object";
1025
+ properties: {
1026
+ redirect_uri: {
1027
+ type: string;
1028
+ format: string;
1029
+ description: string;
1030
+ };
1031
+ message: {
1032
+ type: string;
1033
+ description: string;
1034
+ };
1035
+ };
1036
+ };
1037
+ };
1038
+ "text/html": {
1039
+ schema: {
1040
+ type: "string";
1041
+ };
1042
+ };
1043
+ };
1044
+ };
1045
+ };
1046
+ };
1047
+ };
1048
+ }, Response | {
1049
+ redirect: true;
1050
+ url: string;
1051
+ } | null>;
1052
+ oauth2EndSessionConfirmation: import("better-auth").StrictEndpoint<"/oauth2/end-session/confirm", {
1053
+ method: "POST";
1054
+ body: import("zod").ZodObject<{
1055
+ action: import("zod").ZodLiteral<"confirm">;
1056
+ }, import("zod/v4/core").$strip>;
1057
+ metadata: {
1058
+ noStore: boolean;
1059
+ allowedMediaTypes: string[];
1060
+ scope: "http";
1061
+ };
1062
+ }, Response | {
1063
+ redirect: true;
1064
+ url: string;
1065
+ } | null>;
1066
+ registerOAuthClient: import("better-auth").StrictEndpoint<"/oauth2/register", {
1067
+ method: "POST";
1068
+ body: import("zod").ZodObject<{
1069
+ redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1070
+ scope: import("zod").ZodOptional<import("zod").ZodString>;
1071
+ client_name: import("zod").ZodOptional<import("zod").ZodString>;
1072
+ client_uri: import("zod").ZodOptional<import("zod").ZodString>;
1073
+ logo_uri: import("zod").ZodOptional<import("zod").ZodString>;
1074
+ contacts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1075
+ tos_uri: import("zod").ZodOptional<import("zod").ZodString>;
1076
+ policy_uri: import("zod").ZodOptional<import("zod").ZodString>;
1077
+ software_id: import("zod").ZodOptional<import("zod").ZodString>;
1078
+ software_version: import("zod").ZodOptional<import("zod").ZodString>;
1079
+ software_statement: import("zod").ZodOptional<import("zod").ZodString>;
1080
+ post_logout_redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1081
+ backchannel_logout_uri: import("zod").ZodOptional<import("zod").ZodURL>;
1082
+ backchannel_logout_session_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
1083
+ token_endpoint_auth_method: import("zod").ZodOptional<import("zod").ZodString>;
1084
+ jwks: import("zod").ZodOptional<import("zod").ZodObject<{
1085
+ keys: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
1086
+ }, import("zod/v4/core").$strip>>;
1087
+ jwks_uri: import("zod").ZodOptional<import("zod").ZodString>;
1088
+ grant_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1089
+ response_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
1090
+ code: "code";
1091
+ }>>>;
1092
+ application_type: import("zod").ZodOptional<import("zod").ZodEnum<{
1093
+ web: "web";
1094
+ native: "native";
1095
+ }>>;
1096
+ subject_type: import("zod").ZodOptional<import("zod").ZodEnum<{
1097
+ public: "public";
1098
+ pairwise: "pairwise";
1099
+ }>>;
1100
+ dpop_bound_access_tokens: import("zod").ZodOptional<import("zod").ZodBoolean>;
1101
+ resources: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1102
+ skip_consent: import("zod").ZodOptional<import("zod").ZodNever>;
1103
+ }, import("zod/v4/core").$strip>;
1104
+ errorCodesByField: {
1105
+ redirect_uris: "invalid_redirect_uri";
1106
+ post_logout_redirect_uris: "invalid_redirect_uri";
1107
+ software_statement: "invalid_software_statement";
1108
+ resources: "invalid_target";
1109
+ };
1110
+ defaultError: "invalid_client_metadata";
1111
+ metadata: {
1112
+ noStore: boolean;
1113
+ openapi: {
1114
+ description: string;
1115
+ responses: {
1116
+ "201": {
1117
+ description: string;
1118
+ content: {
1119
+ "application/json": {
1120
+ schema: {
1121
+ type: "object";
1122
+ properties: {
1123
+ client_id: {
1124
+ type: string;
1125
+ description: string;
1126
+ };
1127
+ client_secret: {
1128
+ type: string;
1129
+ description: string;
1130
+ };
1131
+ client_secret_expires_at: {
1132
+ type: string;
1133
+ description: string;
1134
+ };
1135
+ scope: {
1136
+ type: string;
1137
+ description: string;
1138
+ };
1139
+ user_id: {
1140
+ type: string;
1141
+ description: string;
1142
+ };
1143
+ client_id_issued_at: {
1144
+ type: string;
1145
+ description: string;
1146
+ };
1147
+ client_name: {
1148
+ type: string;
1149
+ description: string;
1150
+ };
1151
+ client_uri: {
1152
+ type: string;
1153
+ description: string;
1154
+ };
1155
+ logo_uri: {
1156
+ type: string;
1157
+ description: string;
1158
+ };
1159
+ contacts: {
1160
+ type: string;
1161
+ items: {
1162
+ type: string;
1163
+ };
1164
+ description: string;
1165
+ };
1166
+ tos_uri: {
1167
+ type: string;
1168
+ description: string;
1169
+ };
1170
+ policy_uri: {
1171
+ type: string;
1172
+ description: string;
1173
+ };
1174
+ software_id: {
1175
+ type: string;
1176
+ description: string;
1177
+ };
1178
+ software_version: {
1179
+ type: string;
1180
+ description: string;
1181
+ };
1182
+ software_statement: {
1183
+ type: string;
1184
+ description: string;
1185
+ };
1186
+ redirect_uris: {
1187
+ type: string;
1188
+ items: {
1189
+ type: string;
1190
+ format: string;
1191
+ };
1192
+ description: string;
1193
+ };
1194
+ post_logout_redirect_uris: {
1195
+ type: string;
1196
+ items: {
1197
+ type: string;
1198
+ format: string;
1199
+ };
1200
+ description: string;
1201
+ };
1202
+ backchannel_logout_uri: {
1203
+ type: string;
1204
+ format: string;
1205
+ description: string;
1206
+ };
1207
+ backchannel_logout_session_required: {
1208
+ type: string;
1209
+ description: string;
1210
+ };
1211
+ token_endpoint_auth_method: {
1212
+ type: string;
1213
+ description: string;
1214
+ };
1215
+ grant_types: {
1216
+ type: string;
1217
+ items: {
1218
+ type: string;
1219
+ };
1220
+ description: string;
1221
+ };
1222
+ response_types: {
1223
+ type: string;
1224
+ items: {
1225
+ type: string;
1226
+ enum: string[];
1227
+ };
1228
+ description: string;
1229
+ };
1230
+ application_type: {
1231
+ type: string;
1232
+ description: string;
1233
+ enum: string[];
1234
+ };
1235
+ resources: {
1236
+ type: string;
1237
+ items: {
1238
+ type: string;
1239
+ format: string;
1240
+ };
1241
+ description: string;
1242
+ };
1243
+ disabled: {
1244
+ type: string;
1245
+ description: string;
1246
+ };
1247
+ };
1248
+ required: string[];
1249
+ };
1250
+ };
1251
+ };
1252
+ };
1253
+ };
1254
+ };
1255
+ };
1256
+ }, import("@better-auth/oauth-provider").OAuthClientRegistrationResponse>;
1257
+ adminCreateOAuthClient: import("better-auth").StrictEndpoint<"/admin/oauth2/create-client", {
1258
+ method: "POST";
1259
+ body: import("zod").ZodObject<{
1260
+ redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1261
+ scope: import("zod").ZodOptional<import("zod").ZodString>;
1262
+ client_name: import("zod").ZodOptional<import("zod").ZodString>;
1263
+ client_uri: import("zod").ZodOptional<import("zod").ZodString>;
1264
+ logo_uri: import("zod").ZodOptional<import("zod").ZodString>;
1265
+ contacts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1266
+ tos_uri: import("zod").ZodOptional<import("zod").ZodString>;
1267
+ policy_uri: import("zod").ZodOptional<import("zod").ZodString>;
1268
+ software_id: import("zod").ZodOptional<import("zod").ZodString>;
1269
+ software_version: import("zod").ZodOptional<import("zod").ZodString>;
1270
+ software_statement: import("zod").ZodOptional<import("zod").ZodString>;
1271
+ post_logout_redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1272
+ backchannel_logout_uri: import("zod").ZodOptional<import("zod").ZodURL>;
1273
+ backchannel_logout_session_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
1274
+ token_endpoint_auth_method: import("zod").ZodOptional<import("zod").ZodString>;
1275
+ application_type: import("zod").ZodOptional<import("zod").ZodEnum<{
1276
+ web: "web";
1277
+ native: "native";
1278
+ }>>;
1279
+ jwks: import("zod").ZodOptional<import("zod").ZodObject<{
1280
+ keys: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
1281
+ }, import("zod/v4/core").$strip>>;
1282
+ jwks_uri: import("zod").ZodOptional<import("zod").ZodString>;
1283
+ grant_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1284
+ client_credentials_scopes: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1285
+ resources: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1286
+ response_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
1287
+ code: "code";
1288
+ }>>>;
1289
+ client_secret_expires_at: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>>;
1290
+ skip_consent: import("zod").ZodOptional<import("zod").ZodBoolean>;
1291
+ enable_end_session: import("zod").ZodOptional<import("zod").ZodBoolean>;
1292
+ require_pkce: import("zod").ZodOptional<import("zod").ZodBoolean>;
1293
+ dpop_bound_access_tokens: import("zod").ZodOptional<import("zod").ZodBoolean>;
1294
+ subject_type: import("zod").ZodOptional<import("zod").ZodEnum<{
1295
+ public: "public";
1296
+ pairwise: "pairwise";
1297
+ }>>;
1298
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
1299
+ }, import("zod/v4/core").$strip>;
1300
+ metadata: {
1301
+ noStore: boolean;
1302
+ SERVER_ONLY: true;
1303
+ openapi: {
1304
+ description: string;
1305
+ responses: {
1306
+ "201": {
1307
+ description: string;
1308
+ content: {
1309
+ "application/json": {
1310
+ schema: {
1311
+ type: "object";
1312
+ properties: {
1313
+ client_id: {
1314
+ type: string;
1315
+ description: string;
1316
+ };
1317
+ client_secret: {
1318
+ type: string;
1319
+ description: string;
1320
+ };
1321
+ client_secret_expires_at: {
1322
+ type: string;
1323
+ description: string;
1324
+ };
1325
+ scope: {
1326
+ type: string;
1327
+ description: string;
1328
+ };
1329
+ client_credentials_scopes: {
1330
+ type: string;
1331
+ items: {
1332
+ type: string;
1333
+ };
1334
+ description: string;
1335
+ };
1336
+ user_id: {
1337
+ type: string;
1338
+ description: string;
1339
+ };
1340
+ client_id_issued_at: {
1341
+ type: string;
1342
+ description: string;
1343
+ };
1344
+ client_name: {
1345
+ type: string;
1346
+ description: string;
1347
+ };
1348
+ client_uri: {
1349
+ type: string;
1350
+ description: string;
1351
+ };
1352
+ logo_uri: {
1353
+ type: string;
1354
+ description: string;
1355
+ };
1356
+ contacts: {
1357
+ type: string;
1358
+ items: {
1359
+ type: string;
1360
+ };
1361
+ description: string;
1362
+ };
1363
+ tos_uri: {
1364
+ type: string;
1365
+ description: string;
1366
+ };
1367
+ policy_uri: {
1368
+ type: string;
1369
+ description: string;
1370
+ };
1371
+ software_id: {
1372
+ type: string;
1373
+ description: string;
1374
+ };
1375
+ software_version: {
1376
+ type: string;
1377
+ description: string;
1378
+ };
1379
+ software_statement: {
1380
+ type: string;
1381
+ description: string;
1382
+ };
1383
+ redirect_uris: {
1384
+ type: string;
1385
+ items: {
1386
+ type: string;
1387
+ format: string;
1388
+ };
1389
+ description: string;
1390
+ };
1391
+ token_endpoint_auth_method: {
1392
+ type: string;
1393
+ description: string;
1394
+ };
1395
+ grant_types: {
1396
+ type: string;
1397
+ items: {
1398
+ type: string;
1399
+ };
1400
+ description: string;
1401
+ };
1402
+ response_types: {
1403
+ type: string;
1404
+ items: {
1405
+ type: string;
1406
+ enum: string[];
1407
+ };
1408
+ description: string;
1409
+ };
1410
+ application_type: {
1411
+ type: string;
1412
+ description: string;
1413
+ enum: string[];
1414
+ };
1415
+ resources: {
1416
+ type: string;
1417
+ items: {
1418
+ type: string;
1419
+ format: string;
1420
+ };
1421
+ description: string;
1422
+ };
1423
+ disabled: {
1424
+ type: string;
1425
+ description: string;
1426
+ };
1427
+ require_pkce: {
1428
+ type: string;
1429
+ description: string;
1430
+ default: boolean;
1431
+ };
1432
+ metadata: {
1433
+ type: string;
1434
+ additionalProperties: boolean;
1435
+ nullable: boolean;
1436
+ description: string;
1437
+ };
1438
+ };
1439
+ required: string[];
1440
+ };
1441
+ };
1442
+ };
1443
+ };
1444
+ };
1445
+ };
1446
+ };
1447
+ }, import("@better-auth/oauth-provider").OAuthClientAdministrativeResponse>;
1448
+ createOAuthClient: import("better-auth").StrictEndpoint<"/oauth2/create-client", {
1449
+ method: "POST";
1450
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1451
+ session: {
1452
+ session: Record<string, any> & {
1453
+ id: string;
1454
+ createdAt: Date;
1455
+ updatedAt: Date;
1456
+ userId: string;
1457
+ expiresAt: Date;
1458
+ token: string;
1459
+ ipAddress?: string | null | undefined;
1460
+ userAgent?: string | null | undefined;
1461
+ };
1462
+ user: Record<string, any> & {
1463
+ id: string;
1464
+ createdAt: Date;
1465
+ updatedAt: Date;
1466
+ email: string;
1467
+ emailVerified: boolean;
1468
+ name: string;
1469
+ image?: string | null | undefined;
1470
+ };
1471
+ };
1472
+ }>>[];
1473
+ body: import("zod").ZodObject<{
1474
+ redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1475
+ scope: import("zod").ZodOptional<import("zod").ZodString>;
1476
+ client_name: import("zod").ZodOptional<import("zod").ZodString>;
1477
+ client_uri: import("zod").ZodOptional<import("zod").ZodString>;
1478
+ logo_uri: import("zod").ZodOptional<import("zod").ZodString>;
1479
+ contacts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1480
+ tos_uri: import("zod").ZodOptional<import("zod").ZodString>;
1481
+ policy_uri: import("zod").ZodOptional<import("zod").ZodString>;
1482
+ software_id: import("zod").ZodOptional<import("zod").ZodString>;
1483
+ software_version: import("zod").ZodOptional<import("zod").ZodString>;
1484
+ software_statement: import("zod").ZodOptional<import("zod").ZodString>;
1485
+ post_logout_redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1486
+ backchannel_logout_uri: import("zod").ZodOptional<import("zod").ZodURL>;
1487
+ backchannel_logout_session_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
1488
+ token_endpoint_auth_method: import("zod").ZodOptional<import("zod").ZodString>;
1489
+ application_type: import("zod").ZodOptional<import("zod").ZodEnum<{
1490
+ web: "web";
1491
+ native: "native";
1492
+ }>>;
1493
+ jwks: import("zod").ZodOptional<import("zod").ZodObject<{
1494
+ keys: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
1495
+ }, import("zod/v4/core").$strip>>;
1496
+ jwks_uri: import("zod").ZodOptional<import("zod").ZodString>;
1497
+ grant_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1498
+ response_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
1499
+ code: "code";
1500
+ }>>>;
1501
+ dpop_bound_access_tokens: import("zod").ZodOptional<import("zod").ZodBoolean>;
1502
+ }, import("zod/v4/core").$strip>;
1503
+ metadata: {
1504
+ noStore: boolean;
1505
+ openapi: {
1506
+ description: string;
1507
+ responses: {
1508
+ "201": {
1509
+ description: string;
1510
+ content: {
1511
+ "application/json": {
1512
+ schema: {
1513
+ type: "object";
1514
+ properties: {
1515
+ client_id: {
1516
+ type: string;
1517
+ description: string;
1518
+ };
1519
+ client_secret: {
1520
+ type: string;
1521
+ description: string;
1522
+ };
1523
+ client_secret_expires_at: {
1524
+ type: string;
1525
+ description: string;
1526
+ };
1527
+ scope: {
1528
+ type: string;
1529
+ description: string;
1530
+ };
1531
+ user_id: {
1532
+ type: string;
1533
+ description: string;
1534
+ };
1535
+ client_id_issued_at: {
1536
+ type: string;
1537
+ description: string;
1538
+ };
1539
+ client_name: {
1540
+ type: string;
1541
+ description: string;
1542
+ };
1543
+ client_uri: {
1544
+ type: string;
1545
+ description: string;
1546
+ };
1547
+ logo_uri: {
1548
+ type: string;
1549
+ description: string;
1550
+ };
1551
+ contacts: {
1552
+ type: string;
1553
+ items: {
1554
+ type: string;
1555
+ };
1556
+ description: string;
1557
+ };
1558
+ tos_uri: {
1559
+ type: string;
1560
+ description: string;
1561
+ };
1562
+ policy_uri: {
1563
+ type: string;
1564
+ description: string;
1565
+ };
1566
+ software_id: {
1567
+ type: string;
1568
+ description: string;
1569
+ };
1570
+ software_version: {
1571
+ type: string;
1572
+ description: string;
1573
+ };
1574
+ software_statement: {
1575
+ type: string;
1576
+ description: string;
1577
+ };
1578
+ redirect_uris: {
1579
+ type: string;
1580
+ items: {
1581
+ type: string;
1582
+ format: string;
1583
+ };
1584
+ description: string;
1585
+ };
1586
+ token_endpoint_auth_method: {
1587
+ type: string;
1588
+ description: string;
1589
+ };
1590
+ grant_types: {
1591
+ type: string;
1592
+ items: {
1593
+ type: string;
1594
+ };
1595
+ description: string;
1596
+ };
1597
+ response_types: {
1598
+ type: string;
1599
+ items: {
1600
+ type: string;
1601
+ enum: string[];
1602
+ };
1603
+ description: string;
1604
+ };
1605
+ application_type: {
1606
+ type: string;
1607
+ description: string;
1608
+ enum: string[];
1609
+ };
1610
+ resources: {
1611
+ type: string;
1612
+ items: {
1613
+ type: string;
1614
+ format: string;
1615
+ };
1616
+ description: string;
1617
+ };
1618
+ disabled: {
1619
+ type: string;
1620
+ description: string;
1621
+ };
1622
+ metadata: {
1623
+ type: string;
1624
+ additionalProperties: boolean;
1625
+ nullable: boolean;
1626
+ description: string;
1627
+ };
1628
+ };
1629
+ required: string[];
1630
+ };
1631
+ };
1632
+ };
1633
+ };
1634
+ };
1635
+ };
1636
+ };
1637
+ }, import("@better-auth/oauth-provider").OAuthClientRegistrationResponse>;
1638
+ getOAuthClient: import("better-auth").StrictEndpoint<"/oauth2/get-client", {
1639
+ method: "GET";
1640
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1641
+ session: {
1642
+ session: Record<string, any> & {
1643
+ id: string;
1644
+ createdAt: Date;
1645
+ updatedAt: Date;
1646
+ userId: string;
1647
+ expiresAt: Date;
1648
+ token: string;
1649
+ ipAddress?: string | null | undefined;
1650
+ userAgent?: string | null | undefined;
1651
+ };
1652
+ user: Record<string, any> & {
1653
+ id: string;
1654
+ createdAt: Date;
1655
+ updatedAt: Date;
1656
+ email: string;
1657
+ emailVerified: boolean;
1658
+ name: string;
1659
+ image?: string | null | undefined;
1660
+ };
1661
+ };
1662
+ }>>[];
1663
+ query: import("zod").ZodObject<{
1664
+ client_id: import("zod").ZodString;
1665
+ }, import("zod/v4/core").$strip>;
1666
+ metadata: {
1667
+ openapi: {
1668
+ description: string;
1669
+ };
1670
+ };
1671
+ }, import("@better-auth/oauth-provider").OAuthClient>;
1672
+ getOAuthClientPublic: import("better-auth").StrictEndpoint<"/oauth2/public-client", {
1673
+ method: "GET";
1674
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1675
+ session: {
1676
+ session: Record<string, any> & {
1677
+ id: string;
1678
+ createdAt: Date;
1679
+ updatedAt: Date;
1680
+ userId: string;
1681
+ expiresAt: Date;
1682
+ token: string;
1683
+ ipAddress?: string | null | undefined;
1684
+ userAgent?: string | null | undefined;
1685
+ };
1686
+ user: Record<string, any> & {
1687
+ id: string;
1688
+ createdAt: Date;
1689
+ updatedAt: Date;
1690
+ email: string;
1691
+ emailVerified: boolean;
1692
+ name: string;
1693
+ image?: string | null | undefined;
1694
+ };
1695
+ };
1696
+ }>>[];
1697
+ query: import("zod").ZodObject<{
1698
+ client_id: import("zod").ZodString;
1699
+ }, import("zod/v4/core").$strip>;
1700
+ metadata: {
1701
+ openapi: {
1702
+ description: string;
1703
+ };
1704
+ };
1705
+ }, import("@better-auth/oauth-provider").OAuthClient>;
1706
+ getOAuthClientPublicPrelogin: import("better-auth").StrictEndpoint<"/oauth2/public-client-prelogin", {
1707
+ method: "POST";
1708
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>[];
1709
+ body: import("zod").ZodObject<{
1710
+ client_id: import("zod").ZodString;
1711
+ oauth_query: import("zod").ZodOptional<import("zod").ZodString>;
1712
+ }, import("zod/v4/core").$strip>;
1713
+ metadata: {
1714
+ openapi: {
1715
+ description: string;
1716
+ };
1717
+ };
1718
+ }, import("@better-auth/oauth-provider").OAuthClient>;
1719
+ getOAuthClients: import("better-auth").StrictEndpoint<"/oauth2/get-clients", {
1720
+ method: "GET";
1721
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1722
+ session: {
1723
+ session: Record<string, any> & {
1724
+ id: string;
1725
+ createdAt: Date;
1726
+ updatedAt: Date;
1727
+ userId: string;
1728
+ expiresAt: Date;
1729
+ token: string;
1730
+ ipAddress?: string | null | undefined;
1731
+ userAgent?: string | null | undefined;
1732
+ };
1733
+ user: Record<string, any> & {
1734
+ id: string;
1735
+ createdAt: Date;
1736
+ updatedAt: Date;
1737
+ email: string;
1738
+ emailVerified: boolean;
1739
+ name: string;
1740
+ image?: string | null | undefined;
1741
+ };
1742
+ };
1743
+ }>>[];
1744
+ metadata: {
1745
+ openapi: {
1746
+ description: string;
1747
+ };
1748
+ };
1749
+ }, import("@better-auth/oauth-provider").OAuthClient[] | null>;
1750
+ adminUpdateOAuthClient: import("better-auth").StrictEndpoint<"/admin/oauth2/update-client", {
1751
+ method: "PATCH";
1752
+ body: import("zod").ZodObject<{
1753
+ client_id: import("zod").ZodString;
1754
+ update: import("zod").ZodObject<{
1755
+ redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1756
+ scope: import("zod").ZodOptional<import("zod").ZodString>;
1757
+ client_name: import("zod").ZodOptional<import("zod").ZodString>;
1758
+ client_uri: import("zod").ZodOptional<import("zod").ZodString>;
1759
+ logo_uri: import("zod").ZodOptional<import("zod").ZodString>;
1760
+ contacts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1761
+ tos_uri: import("zod").ZodOptional<import("zod").ZodString>;
1762
+ policy_uri: import("zod").ZodOptional<import("zod").ZodString>;
1763
+ software_id: import("zod").ZodOptional<import("zod").ZodString>;
1764
+ software_version: import("zod").ZodOptional<import("zod").ZodString>;
1765
+ software_statement: import("zod").ZodOptional<import("zod").ZodString>;
1766
+ post_logout_redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1767
+ backchannel_logout_uri: import("zod").ZodOptional<import("zod").ZodURL>;
1768
+ backchannel_logout_session_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
1769
+ application_type: import("zod").ZodOptional<import("zod").ZodEnum<{
1770
+ web: "web";
1771
+ native: "native";
1772
+ }>>;
1773
+ grant_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1774
+ client_credentials_scopes: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1775
+ response_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
1776
+ code: "code";
1777
+ }>>>;
1778
+ client_secret_expires_at: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1779
+ skip_consent: import("zod").ZodOptional<import("zod").ZodBoolean>;
1780
+ enable_end_session: import("zod").ZodOptional<import("zod").ZodBoolean>;
1781
+ disabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
1782
+ dpop_bound_access_tokens: import("zod").ZodOptional<import("zod").ZodBoolean>;
1783
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
1784
+ }, import("zod/v4/core").$strip>;
1785
+ }, import("zod/v4/core").$strip>;
1786
+ metadata: {
1787
+ SERVER_ONLY: true;
1788
+ openapi: {
1789
+ description: string;
1790
+ };
1791
+ };
1792
+ }, import("@better-auth/oauth-provider").OAuthClientAdministrativeResponse>;
1793
+ updateOAuthClient: import("better-auth").StrictEndpoint<"/oauth2/update-client", {
1794
+ method: "POST";
1795
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1796
+ session: {
1797
+ session: Record<string, any> & {
1798
+ id: string;
1799
+ createdAt: Date;
1800
+ updatedAt: Date;
1801
+ userId: string;
1802
+ expiresAt: Date;
1803
+ token: string;
1804
+ ipAddress?: string | null | undefined;
1805
+ userAgent?: string | null | undefined;
1806
+ };
1807
+ user: Record<string, any> & {
1808
+ id: string;
1809
+ createdAt: Date;
1810
+ updatedAt: Date;
1811
+ email: string;
1812
+ emailVerified: boolean;
1813
+ name: string;
1814
+ image?: string | null | undefined;
1815
+ };
1816
+ };
1817
+ }>>[];
1818
+ body: import("zod").ZodObject<{
1819
+ client_id: import("zod").ZodString;
1820
+ update: import("zod").ZodObject<{
1821
+ redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1822
+ scope: import("zod").ZodOptional<import("zod").ZodString>;
1823
+ client_name: import("zod").ZodOptional<import("zod").ZodString>;
1824
+ client_uri: import("zod").ZodOptional<import("zod").ZodString>;
1825
+ logo_uri: import("zod").ZodOptional<import("zod").ZodString>;
1826
+ contacts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1827
+ tos_uri: import("zod").ZodOptional<import("zod").ZodString>;
1828
+ policy_uri: import("zod").ZodOptional<import("zod").ZodString>;
1829
+ software_id: import("zod").ZodOptional<import("zod").ZodString>;
1830
+ software_version: import("zod").ZodOptional<import("zod").ZodString>;
1831
+ software_statement: import("zod").ZodOptional<import("zod").ZodString>;
1832
+ post_logout_redirect_uris: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodURL>>;
1833
+ backchannel_logout_uri: import("zod").ZodOptional<import("zod").ZodURL>;
1834
+ backchannel_logout_session_required: import("zod").ZodOptional<import("zod").ZodBoolean>;
1835
+ application_type: import("zod").ZodOptional<import("zod").ZodEnum<{
1836
+ web: "web";
1837
+ native: "native";
1838
+ }>>;
1839
+ grant_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1840
+ response_types: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
1841
+ code: "code";
1842
+ }>>>;
1843
+ }, import("zod/v4/core").$strip>;
1844
+ }, import("zod/v4/core").$strip>;
1845
+ metadata: {
1846
+ openapi: {
1847
+ description: string;
1848
+ };
1849
+ };
1850
+ }, import("@better-auth/oauth-provider").OAuthClientRegistrationResponse>;
1851
+ rotateClientSecret: import("better-auth").StrictEndpoint<"/oauth2/client/rotate-secret", {
1852
+ method: "POST";
1853
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1854
+ session: {
1855
+ session: Record<string, any> & {
1856
+ id: string;
1857
+ createdAt: Date;
1858
+ updatedAt: Date;
1859
+ userId: string;
1860
+ expiresAt: Date;
1861
+ token: string;
1862
+ ipAddress?: string | null | undefined;
1863
+ userAgent?: string | null | undefined;
1864
+ };
1865
+ user: Record<string, any> & {
1866
+ id: string;
1867
+ createdAt: Date;
1868
+ updatedAt: Date;
1869
+ email: string;
1870
+ emailVerified: boolean;
1871
+ name: string;
1872
+ image?: string | null | undefined;
1873
+ };
1874
+ };
1875
+ }>>[];
1876
+ body: import("zod").ZodObject<{
1877
+ client_id: import("zod").ZodString;
1878
+ }, import("zod/v4/core").$strip>;
1879
+ metadata: {
1880
+ noStore: boolean;
1881
+ openapi: {
1882
+ description: string;
1883
+ };
1884
+ };
1885
+ }, import("@better-auth/oauth-provider").OAuthClient>;
1886
+ rotateClientKeys: import("better-auth").StrictEndpoint<"/oauth2/client/rotate-keys", {
1887
+ method: "POST";
1888
+ body: import("zod").ZodObject<{
1889
+ client_assertion: import("zod").ZodString;
1890
+ client_assertion_type: import("zod").ZodString;
1891
+ jwks: import("zod").ZodObject<{
1892
+ keys: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
1893
+ }, import("zod/v4/core").$strip>;
1894
+ }, import("zod/v4/core").$strip>;
1895
+ errorCodesByField: {
1896
+ client_assertion: "invalid_client";
1897
+ client_assertion_type: "invalid_client";
1898
+ jwks: "invalid_client_metadata";
1899
+ };
1900
+ metadata: {
1901
+ noStore: boolean;
1902
+ openapi: {
1903
+ description: string;
1904
+ };
1905
+ };
1906
+ }, {
1907
+ client_id: string;
1908
+ jwks: {
1909
+ keys: Record<string, unknown>[];
1910
+ };
1911
+ }>;
1912
+ deleteOAuthClient: import("better-auth").StrictEndpoint<"/oauth2/delete-client", {
1913
+ method: "POST";
1914
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1915
+ session: {
1916
+ session: Record<string, any> & {
1917
+ id: string;
1918
+ createdAt: Date;
1919
+ updatedAt: Date;
1920
+ userId: string;
1921
+ expiresAt: Date;
1922
+ token: string;
1923
+ ipAddress?: string | null | undefined;
1924
+ userAgent?: string | null | undefined;
1925
+ };
1926
+ user: Record<string, any> & {
1927
+ id: string;
1928
+ createdAt: Date;
1929
+ updatedAt: Date;
1930
+ email: string;
1931
+ emailVerified: boolean;
1932
+ name: string;
1933
+ image?: string | null | undefined;
1934
+ };
1935
+ };
1936
+ }>>[];
1937
+ body: import("zod").ZodObject<{
1938
+ client_id: import("zod").ZodString;
1939
+ }, import("zod/v4/core").$strip>;
1940
+ metadata: {
1941
+ openapi: {
1942
+ description: string;
1943
+ };
1944
+ };
1945
+ }, void>;
1946
+ getOAuthConsent: import("better-auth").StrictEndpoint<"/oauth2/get-consent", {
1947
+ method: "GET";
1948
+ query: import("zod").ZodObject<{
1949
+ id: import("zod").ZodString;
1950
+ }, import("zod/v4/core").$strip>;
1951
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1952
+ session: {
1953
+ session: Record<string, any> & {
1954
+ id: string;
1955
+ createdAt: Date;
1956
+ updatedAt: Date;
1957
+ userId: string;
1958
+ expiresAt: Date;
1959
+ token: string;
1960
+ ipAddress?: string | null | undefined;
1961
+ userAgent?: string | null | undefined;
1962
+ };
1963
+ user: Record<string, any> & {
1964
+ id: string;
1965
+ createdAt: Date;
1966
+ updatedAt: Date;
1967
+ email: string;
1968
+ emailVerified: boolean;
1969
+ name: string;
1970
+ image?: string | null | undefined;
1971
+ };
1972
+ };
1973
+ }>>[];
1974
+ metadata: {
1975
+ openapi: {
1976
+ description: string;
1977
+ };
1978
+ };
1979
+ }, import("@better-auth/oauth-provider").OAuthConsent<import("@better-auth/oauth-provider").Scope[]>>;
1980
+ getOAuthConsents: import("better-auth").StrictEndpoint<"/oauth2/get-consents", {
1981
+ method: "GET";
1982
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1983
+ session: {
1984
+ session: Record<string, any> & {
1985
+ id: string;
1986
+ createdAt: Date;
1987
+ updatedAt: Date;
1988
+ userId: string;
1989
+ expiresAt: Date;
1990
+ token: string;
1991
+ ipAddress?: string | null | undefined;
1992
+ userAgent?: string | null | undefined;
1993
+ };
1994
+ user: Record<string, any> & {
1995
+ id: string;
1996
+ createdAt: Date;
1997
+ updatedAt: Date;
1998
+ email: string;
1999
+ emailVerified: boolean;
2000
+ name: string;
2001
+ image?: string | null | undefined;
2002
+ };
2003
+ };
2004
+ }>>[];
2005
+ metadata: {
2006
+ openapi: {
2007
+ description: string;
2008
+ };
2009
+ };
2010
+ }, import("@better-auth/oauth-provider").OAuthConsent<import("@better-auth/oauth-provider").Scope[]>[]>;
2011
+ updateOAuthConsent: import("better-auth").StrictEndpoint<"/oauth2/update-consent", {
2012
+ method: "POST";
2013
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
2014
+ session: {
2015
+ session: Record<string, any> & {
2016
+ id: string;
2017
+ createdAt: Date;
2018
+ updatedAt: Date;
2019
+ userId: string;
2020
+ expiresAt: Date;
2021
+ token: string;
2022
+ ipAddress?: string | null | undefined;
2023
+ userAgent?: string | null | undefined;
2024
+ };
2025
+ user: Record<string, any> & {
2026
+ id: string;
2027
+ createdAt: Date;
2028
+ updatedAt: Date;
2029
+ email: string;
2030
+ emailVerified: boolean;
2031
+ name: string;
2032
+ image?: string | null | undefined;
2033
+ };
2034
+ };
2035
+ }>>[];
2036
+ body: import("zod").ZodObject<{
2037
+ id: import("zod").ZodString;
2038
+ update: import("zod").ZodObject<{
2039
+ scopes: import("zod").ZodArray<import("zod").ZodString>;
2040
+ }, import("zod/v4/core").$strip>;
2041
+ }, import("zod/v4/core").$strip>;
2042
+ metadata: {
2043
+ openapi: {
2044
+ description: string;
2045
+ };
2046
+ };
2047
+ }, import("@better-auth/oauth-provider").OAuthConsent<import("@better-auth/oauth-provider").Scope[]> | null>;
2048
+ deleteOAuthConsent: import("better-auth").StrictEndpoint<"/oauth2/delete-consent", {
2049
+ method: "POST";
2050
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
2051
+ session: {
2052
+ session: Record<string, any> & {
2053
+ id: string;
2054
+ createdAt: Date;
2055
+ updatedAt: Date;
2056
+ userId: string;
2057
+ expiresAt: Date;
2058
+ token: string;
2059
+ ipAddress?: string | null | undefined;
2060
+ userAgent?: string | null | undefined;
2061
+ };
2062
+ user: Record<string, any> & {
2063
+ id: string;
2064
+ createdAt: Date;
2065
+ updatedAt: Date;
2066
+ email: string;
2067
+ emailVerified: boolean;
2068
+ name: string;
2069
+ image?: string | null | undefined;
2070
+ };
2071
+ };
2072
+ }>>[];
2073
+ body: import("zod").ZodObject<{
2074
+ id: import("zod").ZodString;
2075
+ }, import("zod/v4/core").$strip>;
2076
+ metadata: {
2077
+ openapi: {
2078
+ description: string;
2079
+ };
2080
+ };
2081
+ }, void>;
2082
+ adminCreateOAuthResource: import("better-auth").StrictEndpoint<"/admin/oauth2/resources", {
2083
+ method: "POST";
2084
+ body: import("zod").ZodObject<{
2085
+ identifier: import("zod").ZodNonOptional<import("zod").ZodOptional<import("zod").ZodString>>;
2086
+ name: import("zod").ZodOptional<import("zod").ZodString>;
2087
+ accessTokenTtl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
2088
+ refreshTokenTtl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
2089
+ signingAlgorithm: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<{
2090
+ RS256: "RS256";
2091
+ PS256: "PS256";
2092
+ ES256: "ES256";
2093
+ ES512: "ES512";
2094
+ EdDSA: "EdDSA";
2095
+ }>>>;
2096
+ signingKeyId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
2097
+ allowedScopes: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
2098
+ customClaims: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>>;
2099
+ dpopBoundAccessTokensRequired: import("zod").ZodOptional<import("zod").ZodBoolean>;
2100
+ disabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
2101
+ metadata: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>>;
2102
+ }, import("zod/v4/core").$strip>;
2103
+ metadata: {
2104
+ SERVER_ONLY: true;
2105
+ };
2106
+ }, import("@better-auth/oauth-provider").OAuthResource>;
2107
+ adminListOAuthResources: import("better-auth").StrictEndpoint<"/admin/oauth2/resources", {
2108
+ method: "GET";
2109
+ metadata: {
2110
+ SERVER_ONLY: true;
2111
+ };
2112
+ }, import("@better-auth/oauth-provider").OAuthResource[]>;
2113
+ adminGetOAuthResource: import("better-auth").StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2114
+ method: "GET";
2115
+ metadata: {
2116
+ SERVER_ONLY: true;
2117
+ };
2118
+ }, import("@better-auth/oauth-provider").OAuthResource>;
2119
+ adminUpdateOAuthResource: import("better-auth").StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2120
+ method: "PATCH";
2121
+ body: import("zod").ZodObject<{
2122
+ identifier: import("zod").ZodOptional<import("zod").ZodString>;
2123
+ name: import("zod").ZodOptional<import("zod").ZodString>;
2124
+ accessTokenTtl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
2125
+ refreshTokenTtl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
2126
+ signingAlgorithm: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<{
2127
+ RS256: "RS256";
2128
+ PS256: "PS256";
2129
+ ES256: "ES256";
2130
+ ES512: "ES512";
2131
+ EdDSA: "EdDSA";
2132
+ }>>>;
2133
+ signingKeyId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
2134
+ allowedScopes: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
2135
+ customClaims: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>>;
2136
+ dpopBoundAccessTokensRequired: import("zod").ZodOptional<import("zod").ZodBoolean>;
2137
+ disabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
2138
+ metadata: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>>;
2139
+ }, import("zod/v4/core").$strip>;
2140
+ metadata: {
2141
+ SERVER_ONLY: true;
2142
+ };
2143
+ }, import("@better-auth/oauth-provider").OAuthResource>;
2144
+ adminDeleteOAuthResource: import("better-auth").StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2145
+ method: "DELETE";
2146
+ metadata: {
2147
+ SERVER_ONLY: true;
2148
+ };
2149
+ }, {
2150
+ deleted: boolean;
2151
+ }>;
2152
+ adminLinkClientResource: import("better-auth").StrictEndpoint<"/admin/oauth2/resources/:identifier/clients/:client_id", {
2153
+ method: "POST";
2154
+ metadata: {
2155
+ SERVER_ONLY: true;
2156
+ };
2157
+ }, {
2158
+ linked: boolean;
2159
+ }>;
2160
+ adminUnlinkClientResource: import("better-auth").StrictEndpoint<"/admin/oauth2/resources/:identifier/clients/:client_id", {
2161
+ method: "DELETE";
2162
+ metadata: {
2163
+ SERVER_ONLY: true;
2164
+ };
2165
+ }, {
2166
+ unlinked: boolean;
2167
+ }>;
2168
+ };
2169
+ schema: {
2170
+ oauthClient: {
2171
+ modelName: string;
2172
+ fields: {
2173
+ clientId: {
2174
+ type: "string";
2175
+ unique: true;
2176
+ required: true;
2177
+ };
2178
+ clientSecret: {
2179
+ type: "string";
2180
+ required: false;
2181
+ };
2182
+ clientDiscoveryId: {
2183
+ type: "string";
2184
+ required: false;
2185
+ };
2186
+ disabled: {
2187
+ type: "boolean";
2188
+ defaultValue: false;
2189
+ required: false;
2190
+ };
2191
+ skipConsent: {
2192
+ type: "boolean";
2193
+ required: false;
2194
+ };
2195
+ enableEndSession: {
2196
+ type: "boolean";
2197
+ required: false;
2198
+ };
2199
+ subjectType: {
2200
+ type: "string";
2201
+ required: false;
2202
+ };
2203
+ scopes: {
2204
+ type: "string[]";
2205
+ required: false;
2206
+ };
2207
+ clientCredentialsScopes: {
2208
+ type: "string[]";
2209
+ required: false;
2210
+ defaultValue: never[];
2211
+ };
2212
+ userId: {
2213
+ type: "string";
2214
+ required: false;
2215
+ references: {
2216
+ model: string;
2217
+ field: string;
2218
+ };
2219
+ index: true;
2220
+ };
2221
+ createdAt: {
2222
+ type: "date";
2223
+ required: false;
2224
+ };
2225
+ updatedAt: {
2226
+ type: "date";
2227
+ required: false;
2228
+ };
2229
+ name: {
2230
+ type: "string";
2231
+ required: false;
2232
+ };
2233
+ uri: {
2234
+ type: "string";
2235
+ required: false;
2236
+ };
2237
+ icon: {
2238
+ type: "string";
2239
+ required: false;
2240
+ };
2241
+ contacts: {
2242
+ type: "string[]";
2243
+ required: false;
2244
+ };
2245
+ tos: {
2246
+ type: "string";
2247
+ required: false;
2248
+ };
2249
+ policy: {
2250
+ type: "string";
2251
+ required: false;
2252
+ };
2253
+ softwareId: {
2254
+ type: "string";
2255
+ required: false;
2256
+ };
2257
+ softwareVersion: {
2258
+ type: "string";
2259
+ required: false;
2260
+ };
2261
+ softwareStatement: {
2262
+ type: "string";
2263
+ required: false;
2264
+ };
2265
+ redirectUris: {
2266
+ type: "string[]";
2267
+ required: true;
2268
+ };
2269
+ postLogoutRedirectUris: {
2270
+ type: "string[]";
2271
+ required: false;
2272
+ };
2273
+ backchannelLogoutUri: {
2274
+ type: "string";
2275
+ required: false;
2276
+ };
2277
+ backchannelLogoutSessionRequired: {
2278
+ type: "boolean";
2279
+ required: false;
2280
+ };
2281
+ tokenEndpointAuthMethod: {
2282
+ type: "string";
2283
+ required: false;
2284
+ };
2285
+ applicationType: {
2286
+ type: "string";
2287
+ required: false;
2288
+ };
2289
+ jwks: {
2290
+ type: "string";
2291
+ required: false;
2292
+ };
2293
+ jwksUri: {
2294
+ type: "string";
2295
+ required: false;
2296
+ };
2297
+ grantTypes: {
2298
+ type: "string[]";
2299
+ required: false;
2300
+ };
2301
+ responseTypes: {
2302
+ type: "string[]";
2303
+ required: false;
2304
+ };
2305
+ requirePKCE: {
2306
+ type: "boolean";
2307
+ required: false;
2308
+ };
2309
+ dpopBoundAccessTokens: {
2310
+ type: "boolean";
2311
+ required: false;
2312
+ defaultValue: false;
2313
+ };
2314
+ referenceId: {
2315
+ type: "string";
2316
+ required: false;
2317
+ };
2318
+ metadata: {
2319
+ type: "json";
2320
+ required: false;
2321
+ };
2322
+ };
2323
+ };
2324
+ oauthResource: {
2325
+ modelName: string;
2326
+ fields: {
2327
+ identifier: {
2328
+ type: "string";
2329
+ required: true;
2330
+ unique: true;
2331
+ };
2332
+ name: {
2333
+ type: "string";
2334
+ required: true;
2335
+ };
2336
+ accessTokenTtl: {
2337
+ type: "number";
2338
+ required: false;
2339
+ };
2340
+ refreshTokenTtl: {
2341
+ type: "number";
2342
+ required: false;
2343
+ };
2344
+ signingAlgorithm: {
2345
+ type: "string";
2346
+ required: false;
2347
+ };
2348
+ signingKeyId: {
2349
+ type: "string";
2350
+ required: false;
2351
+ };
2352
+ allowedScopes: {
2353
+ type: "string[]";
2354
+ required: false;
2355
+ };
2356
+ customClaims: {
2357
+ type: "json";
2358
+ required: false;
2359
+ };
2360
+ dpopBoundAccessTokensRequired: {
2361
+ type: "boolean";
2362
+ required: false;
2363
+ defaultValue: false;
2364
+ };
2365
+ disabled: {
2366
+ type: "boolean";
2367
+ required: false;
2368
+ defaultValue: false;
2369
+ };
2370
+ createdAt: {
2371
+ type: "date";
2372
+ required: false;
2373
+ };
2374
+ updatedAt: {
2375
+ type: "date";
2376
+ required: false;
2377
+ };
2378
+ policyVersion: {
2379
+ type: "number";
2380
+ required: false;
2381
+ defaultValue: number;
2382
+ };
2383
+ metadata: {
2384
+ type: "json";
2385
+ required: false;
2386
+ };
2387
+ };
2388
+ };
2389
+ oauthClientResource: {
2390
+ modelName: string;
2391
+ fields: {
2392
+ clientId: {
2393
+ type: "string";
2394
+ required: true;
2395
+ references: {
2396
+ model: string;
2397
+ field: string;
2398
+ onDelete: "cascade";
2399
+ };
2400
+ index: true;
2401
+ };
2402
+ resourceId: {
2403
+ type: "string";
2404
+ required: true;
2405
+ references: {
2406
+ model: string;
2407
+ field: string;
2408
+ onDelete: "cascade";
2409
+ };
2410
+ index: true;
2411
+ };
2412
+ metadata: {
2413
+ type: "json";
2414
+ required: false;
2415
+ };
2416
+ createdAt: {
2417
+ type: "date";
2418
+ required: false;
2419
+ };
2420
+ };
2421
+ indexes: {
2422
+ fields: [string, string];
2423
+ unique: true;
2424
+ }[];
2425
+ };
2426
+ oauthRefreshToken: {
2427
+ fields: {
2428
+ token: {
2429
+ type: "string";
2430
+ required: true;
2431
+ unique: true;
2432
+ };
2433
+ clientId: {
2434
+ type: "string";
2435
+ required: true;
2436
+ references: {
2437
+ model: string;
2438
+ field: string;
2439
+ };
2440
+ index: true;
2441
+ };
2442
+ sessionId: {
2443
+ type: "string";
2444
+ required: false;
2445
+ references: {
2446
+ model: string;
2447
+ field: string;
2448
+ onDelete: "set null";
2449
+ };
2450
+ index: true;
2451
+ };
2452
+ userId: {
2453
+ type: "string";
2454
+ required: true;
2455
+ references: {
2456
+ model: string;
2457
+ field: string;
2458
+ };
2459
+ index: true;
2460
+ };
2461
+ referenceId: {
2462
+ type: "string";
2463
+ required: false;
2464
+ };
2465
+ authorizationCodeId: {
2466
+ type: "string";
2467
+ required: false;
2468
+ index: true;
2469
+ };
2470
+ resources: {
2471
+ type: "string[]";
2472
+ required: false;
2473
+ };
2474
+ requestedUserInfoClaims: {
2475
+ type: "string[]";
2476
+ required: false;
2477
+ };
2478
+ expiresAt: {
2479
+ type: "date";
2480
+ };
2481
+ createdAt: {
2482
+ type: "date";
2483
+ };
2484
+ revoked: {
2485
+ type: "date";
2486
+ required: false;
2487
+ };
2488
+ rotatedAt: {
2489
+ type: "date";
2490
+ required: false;
2491
+ };
2492
+ rotationReplayResponse: {
2493
+ type: "string";
2494
+ required: false;
2495
+ };
2496
+ rotationReplayExpiresAt: {
2497
+ type: "date";
2498
+ required: false;
2499
+ };
2500
+ authTime: {
2501
+ type: "date";
2502
+ required: false;
2503
+ };
2504
+ confirmation: {
2505
+ type: "json";
2506
+ required: false;
2507
+ };
2508
+ scopes: {
2509
+ type: "string[]";
2510
+ required: true;
2511
+ };
2512
+ };
2513
+ };
2514
+ oauthAccessToken: {
2515
+ modelName: string;
2516
+ fields: {
2517
+ token: {
2518
+ type: "string";
2519
+ unique: true;
2520
+ };
2521
+ clientId: {
2522
+ type: "string";
2523
+ required: true;
2524
+ references: {
2525
+ model: string;
2526
+ field: string;
2527
+ };
2528
+ index: true;
2529
+ };
2530
+ sessionId: {
2531
+ type: "string";
2532
+ required: false;
2533
+ references: {
2534
+ model: string;
2535
+ field: string;
2536
+ onDelete: "set null";
2537
+ };
2538
+ index: true;
2539
+ };
2540
+ userId: {
2541
+ type: "string";
2542
+ required: false;
2543
+ references: {
2544
+ model: string;
2545
+ field: string;
2546
+ };
2547
+ index: true;
2548
+ };
2549
+ referenceId: {
2550
+ type: "string";
2551
+ required: false;
2552
+ };
2553
+ authorizationCodeId: {
2554
+ type: "string";
2555
+ required: false;
2556
+ index: true;
2557
+ };
2558
+ resources: {
2559
+ type: "string[]";
2560
+ required: false;
2561
+ };
2562
+ requestedUserInfoClaims: {
2563
+ type: "string[]";
2564
+ required: false;
2565
+ };
2566
+ refreshId: {
2567
+ type: "string";
2568
+ required: false;
2569
+ references: {
2570
+ model: string;
2571
+ field: string;
2572
+ };
2573
+ index: true;
2574
+ };
2575
+ expiresAt: {
2576
+ type: "date";
2577
+ };
2578
+ createdAt: {
2579
+ type: "date";
2580
+ };
2581
+ revoked: {
2582
+ type: "date";
2583
+ required: false;
2584
+ };
2585
+ confirmation: {
2586
+ type: "json";
2587
+ required: false;
2588
+ };
2589
+ scopes: {
2590
+ type: "string[]";
2591
+ required: true;
2592
+ };
2593
+ };
2594
+ };
2595
+ oauthConsent: {
2596
+ modelName: string;
2597
+ fields: {
2598
+ clientId: {
2599
+ type: "string";
2600
+ required: true;
2601
+ references: {
2602
+ model: string;
2603
+ field: string;
2604
+ };
2605
+ index: true;
2606
+ };
2607
+ userId: {
2608
+ type: "string";
2609
+ required: false;
2610
+ references: {
2611
+ model: string;
2612
+ field: string;
2613
+ };
2614
+ index: true;
2615
+ };
2616
+ referenceId: {
2617
+ type: "string";
2618
+ required: false;
2619
+ };
2620
+ resources: {
2621
+ type: "string[]";
2622
+ required: false;
2623
+ };
2624
+ requestedUserInfoClaims: {
2625
+ type: "string[]";
2626
+ required: false;
2627
+ };
2628
+ scopes: {
2629
+ type: "string[]";
2630
+ required: true;
2631
+ };
2632
+ createdAt: {
2633
+ type: "date";
2634
+ };
2635
+ updatedAt: {
2636
+ type: "date";
2637
+ };
2638
+ };
2639
+ };
2640
+ oauthClientAssertion: {
2641
+ modelName: string;
2642
+ fields: {
2643
+ expiresAt: {
2644
+ type: "date";
2645
+ required: true;
2646
+ };
2647
+ };
2648
+ };
2649
+ };
2650
+ rateLimit: ({
2651
+ pathMatcher: (path: string) => path is "/oauth2/token";
2652
+ window: number;
2653
+ max: number;
2654
+ } | {
2655
+ pathMatcher: (path: string) => path is "/oauth2/authorize";
2656
+ window: number;
2657
+ max: number;
2658
+ } | {
2659
+ pathMatcher: (path: string) => path is "/oauth2/introspect";
2660
+ window: number;
2661
+ max: number;
2662
+ } | {
2663
+ pathMatcher: (path: string) => path is "/oauth2/revoke";
2664
+ window: number;
2665
+ max: number;
2666
+ } | {
2667
+ pathMatcher: (path: string) => path is "/oauth2/register";
2668
+ window: number;
2669
+ max: number;
2670
+ } | {
2671
+ pathMatcher: (path: string) => path is "/oauth2/client/rotate-keys";
2672
+ window: number;
2673
+ max: number;
2674
+ } | {
2675
+ pathMatcher: (path: string) => path is "/oauth2/userinfo";
2676
+ window: number;
2677
+ max: number;
2678
+ })[];
2679
+ };
2680
+ export interface OAuthAccess {
2681
+ /** `ba:<user id>`, the same subject as a cookie session. */
2682
+ subject: string;
2683
+ userId: string;
2684
+ email: string;
2685
+ emailVerified: boolean;
2686
+ name: string | null;
2687
+ /** The business the grant is for. */
2688
+ tenantId: string;
2689
+ scopes: string[];
2690
+ clientId: string;
2691
+ clientName: string | null;
2692
+ }
2693
+ /**
2694
+ * Resolve an access token for `resource`: unexpired, not revoked, issued for this resource, from
2695
+ * an enabled client, and bound to a business. Null otherwise. One indexed lookup.
2696
+ */
2697
+ export declare function resolveAccessToken(db: TalaDb, token: string, resource: string): Promise<OAuthAccess | null>;
2698
+ /**
2699
+ * Remove clients that registered themselves but were never used: no consent and no tokens after
2700
+ * `olderThanHours` (default 24). Call it from a Cron Trigger.
2701
+ */
2702
+ export declare function cleanupOAuthClients(db: TalaDb, { olderThanHours }?: {
2703
+ olderThanHours?: number | undefined;
2704
+ }): Promise<number>;
2705
+ /** A person's connected apps: one per client and business they consented to. */
2706
+ export declare function listGrants(db: TalaDb, userId: string): Promise<{
2707
+ id: string;
2708
+ clientName: string | null;
2709
+ clientUri: string | null;
2710
+ tenantId: string | null;
2711
+ tenantName: string | null;
2712
+ scopes: string[];
2713
+ connectedAt: Date | null;
2714
+ lastUsedAt: Date | null;
2715
+ }[]>;
2716
+ /**
2717
+ * Disconnect: remove the consent and every token for that person, client and business, so the
2718
+ * app stops working on its next call and has to ask again.
2719
+ */
2720
+ export declare function revokeGrant(db: TalaDb, userId: string, consentId: string): Promise<boolean>;
2721
+ //# sourceMappingURL=oauth.d.ts.map