@better-auth/oauth-provider 1.7.0-rc.5 → 1.7.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.
@@ -1,8 +1,12 @@
1
- import { B as Prompt, E as OAuthConsent, F as OAuthResource, H as Scope, O as OAuthExtensionGrantHandlerInput, R as OAuthTokenResponse, a as GrantType, j as OAuthOptions, k as OAuthMetadataExtensionInput, l as TokenEndpointAuthMethod, n as AuthServerMetadata, o as OAuthClient, u as TokenType, w as OAuthClientRegistrationResponse, y as OAuthClientAdministrativeResponse } from "./oauth-CjcHkAmR.mjs";
2
- import "better-call";
1
+ import { B as Prompt, E as OAuthConsent, F as OAuthResource, H as Scope, O as OAuthExtensionGrantHandlerInput, R as OAuthTokenResponse, a as GrantType, j as OAuthOptions, k as OAuthMetadataExtensionInput, l as TokenEndpointAuthMethod, n as AuthServerMetadata, o as OAuthClient, u as TokenType, w as OAuthClientRegistrationResponse, y as OAuthClientAdministrativeResponse } from "./oauth-1Ud-hvZY.mjs";
2
+ import * as _$better_call0 from "better-call";
3
3
  import * as z from "zod";
4
+ import * as _$jose from "jose";
5
+ import * as _$better_auth_plugins0 from "better-auth/plugins";
4
6
  import { DeviceAuthorizationGrant, DeviceAuthorizationPluginOptions } from "better-auth/plugins/device-authorization";
5
7
  import { AuthContext, GenericEndpointContext } from "@better-auth/core";
8
+ import * as _$better_auth0 from "better-auth";
9
+
6
10
  //#region src/device-code.d.ts
7
11
  /**
8
12
  * RFC 8628 device authorization grant type. A registered OAuth client polls the
@@ -58,7 +62,7 @@ declare function buildOAuthDeviceGrant(): {
58
62
  };
59
63
  };
60
64
  };
61
- onRequestValidationError: (issues: readonly import("better-auth").StandardSchemaV1.Issue[]) => void;
65
+ onRequestValidationError: (issues: readonly _$better_auth0.StandardSchemaV1.Issue[]) => void;
62
66
  deviceCodeSchemaFields: {
63
67
  resources: {
64
68
  type: "string[]";
@@ -75,9 +79,12 @@ declare function buildOAuthDeviceGrant(): {
75
79
  metadata: (metadataInput: OAuthMetadataExtensionInput) => {
76
80
  device_authorization_endpoint: string;
77
81
  };
78
- authorizeRequest: ({ ctx, request }: {
79
- ctx: import("better-auth").GenericEndpointContext;
80
- request: import("better-auth/plugins").DeviceAuthorizationRequest & {
82
+ authorizeRequest: ({
83
+ ctx,
84
+ request
85
+ }: {
86
+ ctx: _$better_auth0.GenericEndpointContext;
87
+ request: _$better_auth_plugins0.DeviceAuthorizationRequest & {
81
88
  client_secret?: string | undefined;
82
89
  client_assertion?: string | undefined;
83
90
  client_assertion_type?: string | undefined;
@@ -90,8 +97,10 @@ declare function buildOAuthDeviceGrant(): {
90
97
  resources: string[] | null;
91
98
  };
92
99
  } | undefined>;
93
- assertSessionRedemption: ({ deviceCode }: {
94
- ctx: import("better-auth").GenericEndpointContext;
100
+ assertSessionRedemption: ({
101
+ deviceCode
102
+ }: {
103
+ ctx: _$better_auth0.GenericEndpointContext;
95
104
  deviceCode: Record<string, unknown>;
96
105
  }) => void;
97
106
  getVerificationContext: (deviceCode: Record<string, unknown>) => {
@@ -185,7 +194,7 @@ declare function oauthDeviceAuthorization(options?: OAuthDeviceAuthorizationOpti
185
194
  };
186
195
  };
187
196
  endpoints: {
188
- deviceCode: import("better-call").StrictEndpoint<"/device/code", {
197
+ deviceCode: _$better_call0.StrictEndpoint<"/device/code", {
189
198
  method: "POST";
190
199
  cloneRequest: true;
191
200
  body: z.ZodObject<{
@@ -216,9 +225,12 @@ declare function oauthDeviceAuthorization(options?: OAuthDeviceAuthorizationOpti
216
225
  }>;
217
226
  error_description: z.ZodString;
218
227
  }, z.core.$strip>;
219
- onValidationError: ({ issues, message }: {
228
+ onValidationError: ({
229
+ issues,
230
+ message
231
+ }: {
220
232
  message: string;
221
- issues: readonly import("better-call").StandardSchemaV1.Issue[];
233
+ issues: readonly _$better_call0.StandardSchemaV1.Issue[];
222
234
  }) => never;
223
235
  metadata: {
224
236
  noStore: boolean;
@@ -313,7 +325,7 @@ declare function oauthDeviceAuthorization(options?: OAuthDeviceAuthorizationOpti
313
325
  expires_in: number;
314
326
  interval: number;
315
327
  }>;
316
- deviceToken: import("better-call").StrictEndpoint<"/device/token", {
328
+ deviceToken: _$better_call0.StrictEndpoint<"/device/token", {
317
329
  method: "POST";
318
330
  body: z.ZodObject<{
319
331
  grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:device_code">;
@@ -382,7 +394,7 @@ declare function oauthDeviceAuthorization(options?: OAuthDeviceAuthorizationOpti
382
394
  expires_in: number;
383
395
  scope: string;
384
396
  }>;
385
- deviceVerify: import("better-call").StrictEndpoint<"/device", {
397
+ deviceVerify: _$better_call0.StrictEndpoint<"/device", {
386
398
  method: "GET";
387
399
  query: z.ZodObject<{
388
400
  user_code: z.ZodString;
@@ -437,7 +449,7 @@ declare function oauthDeviceAuthorization(options?: OAuthDeviceAuthorizationOpti
437
449
  } & Partial<{
438
450
  resource: string | string[] | undefined;
439
451
  }>>;
440
- deviceApprove: import("better-call").StrictEndpoint<"/device/approve", {
452
+ deviceApprove: _$better_call0.StrictEndpoint<"/device/approve", {
441
453
  method: "POST";
442
454
  body: z.ZodObject<{
443
455
  userCode: z.ZodString;
@@ -478,7 +490,7 @@ declare function oauthDeviceAuthorization(options?: OAuthDeviceAuthorizationOpti
478
490
  }, {
479
491
  success: boolean;
480
492
  }>;
481
- deviceDeny: import("better-call").StrictEndpoint<"/device/deny", {
493
+ deviceDeny: _$better_call0.StrictEndpoint<"/device/deny", {
482
494
  method: "POST";
483
495
  body: z.ZodObject<{
484
496
  userCode: z.ZodString;
@@ -525,26 +537,26 @@ declare function oauthDeviceAuthorization(options?: OAuthDeviceAuthorizationOpti
525
537
  max: number;
526
538
  }[];
527
539
  $ERROR_CODES: {
528
- USER_NOT_FOUND: import("better-auth").RawError<"USER_NOT_FOUND">;
529
- FAILED_TO_CREATE_SESSION: import("better-auth").RawError<"FAILED_TO_CREATE_SESSION">;
530
- INVALID_DEVICE_CODE: import("better-auth").RawError<"INVALID_DEVICE_CODE">;
531
- EXPIRED_DEVICE_CODE: import("better-auth").RawError<"EXPIRED_DEVICE_CODE">;
532
- EXPIRED_USER_CODE: import("better-auth").RawError<"EXPIRED_USER_CODE">;
533
- AUTHORIZATION_PENDING: import("better-auth").RawError<"AUTHORIZATION_PENDING">;
534
- ACCESS_DENIED: import("better-auth").RawError<"ACCESS_DENIED">;
535
- INVALID_USER_CODE: import("better-auth").RawError<"INVALID_USER_CODE">;
536
- DEVICE_CODE_ALREADY_PROCESSED: import("better-auth").RawError<"DEVICE_CODE_ALREADY_PROCESSED">;
537
- DEVICE_CODE_NOT_CLAIMED: import("better-auth").RawError<"DEVICE_CODE_NOT_CLAIMED">;
538
- POLLING_TOO_FREQUENTLY: import("better-auth").RawError<"POLLING_TOO_FREQUENTLY">;
539
- INVALID_DEVICE_CODE_STATUS: import("better-auth").RawError<"INVALID_DEVICE_CODE_STATUS">;
540
- AUTHENTICATION_REQUIRED: import("better-auth").RawError<"AUTHENTICATION_REQUIRED">;
540
+ USER_NOT_FOUND: _$better_auth0.RawError<"USER_NOT_FOUND">;
541
+ FAILED_TO_CREATE_SESSION: _$better_auth0.RawError<"FAILED_TO_CREATE_SESSION">;
542
+ INVALID_DEVICE_CODE: _$better_auth0.RawError<"INVALID_DEVICE_CODE">;
543
+ EXPIRED_DEVICE_CODE: _$better_auth0.RawError<"EXPIRED_DEVICE_CODE">;
544
+ EXPIRED_USER_CODE: _$better_auth0.RawError<"EXPIRED_USER_CODE">;
545
+ AUTHORIZATION_PENDING: _$better_auth0.RawError<"AUTHORIZATION_PENDING">;
546
+ ACCESS_DENIED: _$better_auth0.RawError<"ACCESS_DENIED">;
547
+ INVALID_USER_CODE: _$better_auth0.RawError<"INVALID_USER_CODE">;
548
+ DEVICE_CODE_ALREADY_PROCESSED: _$better_auth0.RawError<"DEVICE_CODE_ALREADY_PROCESSED">;
549
+ DEVICE_CODE_NOT_CLAIMED: _$better_auth0.RawError<"DEVICE_CODE_NOT_CLAIMED">;
550
+ POLLING_TOO_FREQUENTLY: _$better_auth0.RawError<"POLLING_TOO_FREQUENTLY">;
551
+ INVALID_DEVICE_CODE_STATUS: _$better_auth0.RawError<"INVALID_DEVICE_CODE_STATUS">;
552
+ AUTHENTICATION_REQUIRED: _$better_auth0.RawError<"AUTHENTICATION_REQUIRED">;
541
553
  };
542
554
  options: {
543
555
  grant: DeviceAuthorizationGrant<Readonly<{
544
556
  [k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
545
557
  }>, Record<string, unknown>> | undefined;
546
- expiresIn: import("better-auth/plugins").TimeString;
547
- interval: import("better-auth/plugins").TimeString;
558
+ expiresIn: _$better_auth_plugins0.TimeString;
559
+ interval: _$better_auth_plugins0.TimeString;
548
560
  deviceCodeLength: number;
549
561
  userCodeLength: number;
550
562
  generateDeviceCode?: (() => string | Promise<string>) | undefined;
@@ -618,6 +630,15 @@ declare function getIssuer(ctx: GenericEndpointContext, opts: OAuthOptions<Scope
618
630
  * authorization-server metadata advertises.
619
631
  */
620
632
  declare const DEFAULT_OAUTH_SCOPES: readonly ["openid", "profile", "email", "offline_access"];
633
+ type RPInitiatedLogoutFields = {
634
+ id_token_hint?: string;
635
+ client_id?: string;
636
+ post_logout_redirect_uri?: string;
637
+ state?: string;
638
+ };
639
+ type RPInitiatedLogoutClientInput = RPInitiatedLogoutFields | {
640
+ query: RPInitiatedLogoutFields;
641
+ };
621
642
  declare module "@better-auth/core" {
622
643
  interface BetterAuthPluginRegistry<AuthOptions, Options> {
623
644
  "oauth-provider": {
@@ -641,12 +662,12 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
641
662
  id: "oauth-provider";
642
663
  version: string;
643
664
  options: NoInfer<O>;
644
- onRequest: (request: Request, ctx: import("better-auth").AuthContext) => Promise<{
665
+ onRequest: (request: Request, ctx: _$better_auth0.AuthContext) => Promise<{
645
666
  response: Response;
646
667
  } | {
647
668
  request: Request;
648
669
  } | void>;
649
- init: (ctx: import("better-auth").AuthContext) => Promise<{
670
+ init: (ctx: _$better_auth0.AuthContext) => Promise<{
650
671
  options: {
651
672
  databaseHooks: {
652
673
  session: {
@@ -678,12 +699,12 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
678
699
  }>;
679
700
  hooks: {
680
701
  before: {
681
- matcher(ctx: import("better-auth").HookEndpointContext): any;
682
- handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
702
+ matcher(ctx: _$better_auth0.HookEndpointContext): any;
703
+ handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
683
704
  }[];
684
705
  after: {
685
- matcher(ctx: import("better-auth").HookEndpointContext): boolean;
686
- handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<OAuthRedirectResult | undefined>>;
706
+ matcher(ctx: _$better_auth0.HookEndpointContext): boolean;
707
+ handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<OAuthRedirectResult | undefined>>;
687
708
  }[];
688
709
  };
689
710
  endpoints: {
@@ -694,7 +715,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
694
715
  * Provided at /.well-known/oauth-authorization-server/[issuer-path]
695
716
  * (root if no issuer-path).
696
717
  */
697
- getOAuthServerConfig: import("better-call").StrictEndpoint<"/.well-known/oauth-authorization-server", {
718
+ getOAuthServerConfig: _$better_call0.StrictEndpoint<"/.well-known/oauth-authorization-server", {
698
719
  method: "GET";
699
720
  metadata: {
700
721
  SERVER_ONLY: true;
@@ -707,7 +728,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
707
728
  * Provided at [issuer-path]/.well-known/openid-configuration
708
729
  * (root if no issuer-path).
709
730
  */
710
- getOpenIdConfig: import("better-call").StrictEndpoint<"/.well-known/openid-configuration", {
731
+ getOpenIdConfig: _$better_call0.StrictEndpoint<"/.well-known/openid-configuration", {
711
732
  method: "GET";
712
733
  metadata: {
713
734
  SERVER_ONLY: true;
@@ -732,26 +753,26 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
732
753
  response_modes_supported: "query"[];
733
754
  grant_types_supported: GrantType[];
734
755
  token_endpoint_auth_methods_supported?: TokenEndpointAuthMethod[] | undefined;
735
- token_endpoint_auth_signing_alg_values_supported?: import("better-auth").PrivateKeyJwtSigningAlgorithm[] | undefined;
756
+ token_endpoint_auth_signing_alg_values_supported?: _$better_auth0.PrivateKeyJwtSigningAlgorithm[] | undefined;
736
757
  service_documentation?: string | undefined;
737
758
  ui_locales_supported?: string[] | undefined;
738
759
  op_policy_uri?: string | undefined;
739
760
  op_tos_uri?: string | undefined;
740
761
  revocation_endpoint?: string | undefined;
741
762
  revocation_endpoint_auth_methods_supported?: TokenEndpointAuthMethod[] | undefined;
742
- revocation_endpoint_auth_signing_alg_values_supported?: import("better-auth").PrivateKeyJwtSigningAlgorithm[] | undefined;
763
+ revocation_endpoint_auth_signing_alg_values_supported?: _$better_auth0.PrivateKeyJwtSigningAlgorithm[] | undefined;
743
764
  introspection_endpoint?: string | undefined;
744
765
  introspection_endpoint_auth_methods_supported?: TokenEndpointAuthMethod[] | undefined;
745
- introspection_endpoint_auth_signing_alg_values_supported?: import("better-auth").PrivateKeyJwtSigningAlgorithm[] | undefined;
766
+ introspection_endpoint_auth_signing_alg_values_supported?: _$better_auth0.PrivateKeyJwtSigningAlgorithm[] | undefined;
746
767
  code_challenge_methods_supported: "S256"[];
747
768
  authorization_response_iss_parameter_supported?: boolean | undefined;
748
769
  client_id_metadata_document_supported?: boolean | undefined;
749
770
  backchannel_logout_supported?: boolean | undefined;
750
771
  backchannel_logout_session_supported?: boolean | undefined;
751
- dpop_signing_alg_values_supported?: import("better-auth/plugins").JWSAlgorithms[] | undefined;
752
- id_token_signing_alg_values_supported: import("better-auth/plugins").JWSAlgorithms[] | ["HS256"];
772
+ dpop_signing_alg_values_supported?: _$better_auth_plugins0.JWSAlgorithms[] | undefined;
773
+ id_token_signing_alg_values_supported: _$better_auth_plugins0.JWSAlgorithms[] | ["HS256"];
753
774
  }>;
754
- oauth2Authorize: import("better-call").StrictEndpoint<"/oauth2/authorize", {
775
+ oauth2Authorize: _$better_call0.StrictEndpoint<"/oauth2/authorize", {
755
776
  method: ("GET" | "POST")[];
756
777
  body: z.ZodObject<{}, z.core.$loose>;
757
778
  redirectOnError: OAuthRedirectOnError<GenericEndpointContext, OAuthRedirectResult>;
@@ -856,7 +877,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
856
877
  };
857
878
  };
858
879
  }, OAuthRedirectResult>;
859
- oauth2Consent: import("better-call").StrictEndpoint<"/oauth2/consent", {
880
+ oauth2Consent: _$better_call0.StrictEndpoint<"/oauth2/consent", {
860
881
  method: "POST";
861
882
  body: z.ZodObject<{
862
883
  accept: z.ZodBoolean;
@@ -864,7 +885,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
864
885
  claims: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
865
886
  oauth_query: z.ZodOptional<z.ZodString>;
866
887
  }, z.core.$strip>;
867
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
888
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
868
889
  session: {
869
890
  session: Record<string, any> & {
870
891
  id: string;
@@ -916,7 +937,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
916
937
  redirect: boolean;
917
938
  url: string;
918
939
  }>;
919
- oauth2Continue: import("better-call").StrictEndpoint<"/oauth2/continue", {
940
+ oauth2Continue: _$better_call0.StrictEndpoint<"/oauth2/continue", {
920
941
  method: "POST";
921
942
  body: z.ZodObject<{
922
943
  selected: z.ZodOptional<z.ZodBoolean>;
@@ -924,7 +945,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
924
945
  postLogin: z.ZodOptional<z.ZodBoolean>;
925
946
  oauth_query: z.ZodOptional<z.ZodString>;
926
947
  }, z.core.$strip>;
927
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
948
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
928
949
  session: {
929
950
  session: Record<string, any> & {
930
951
  id: string;
@@ -973,7 +994,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
973
994
  };
974
995
  };
975
996
  }, OAuthRedirectResult>;
976
- oauth2Token: import("better-call").StrictEndpoint<"/oauth2/token", {
997
+ oauth2Token: _$better_call0.StrictEndpoint<"/oauth2/token", {
977
998
  method: "POST";
978
999
  cloneRequest: true;
979
1000
  body: z.ZodObject<{
@@ -1145,7 +1166,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1145
1166
  scope: string;
1146
1167
  id_token: string | undefined;
1147
1168
  }>;
1148
- oauth2Introspect: import("better-call").StrictEndpoint<"/oauth2/introspect", {
1169
+ oauth2Introspect: _$better_call0.StrictEndpoint<"/oauth2/introspect", {
1149
1170
  method: "POST";
1150
1171
  cloneRequest: true;
1151
1172
  body: z.ZodObject<{
@@ -1277,8 +1298,8 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1277
1298
  };
1278
1299
  };
1279
1300
  };
1280
- }, import("jose").JWTPayload>;
1281
- oauth2Revoke: import("better-call").StrictEndpoint<"/oauth2/revoke", {
1301
+ }, _$jose.JWTPayload>;
1302
+ oauth2Revoke: _$better_call0.StrictEndpoint<"/oauth2/revoke", {
1282
1303
  method: "POST";
1283
1304
  cloneRequest: true;
1284
1305
  body: z.ZodObject<{
@@ -1360,7 +1381,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1360
1381
  };
1361
1382
  };
1362
1383
  }, null | undefined>;
1363
- oauth2UserInfo: import("better-call").StrictEndpoint<"/oauth2/userinfo", {
1384
+ oauth2UserInfo: _$better_call0.StrictEndpoint<"/oauth2/userinfo", {
1364
1385
  method: ("GET" | "POST")[];
1365
1386
  body: z.ZodOptional<z.ZodObject<{
1366
1387
  access_token: z.ZodOptional<z.ZodString>;
@@ -1480,15 +1501,27 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1480
1501
  }, {
1481
1502
  sub: unknown;
1482
1503
  }>;
1483
- oauth2EndSession: import("better-call").StrictEndpoint<"/oauth2/end-session", {
1484
- method: "GET";
1485
- query: z.ZodObject<{
1486
- id_token_hint: z.ZodString;
1504
+ oauth2EndSession: _$better_call0.StrictEndpoint<"/oauth2/end-session", {
1505
+ method: ("GET" | "POST")[];
1506
+ body: z.ZodOptional<z.ZodObject<{
1507
+ id_token_hint: z.ZodOptional<z.ZodString>;
1487
1508
  client_id: z.ZodOptional<z.ZodString>;
1488
1509
  post_logout_redirect_uri: z.ZodOptional<z.ZodURL>;
1489
1510
  state: z.ZodOptional<z.ZodString>;
1490
- }, z.core.$strip>;
1511
+ }, z.core.$strip>>;
1512
+ query: z.ZodOptional<z.ZodObject<{
1513
+ id_token_hint: z.ZodOptional<z.ZodString>;
1514
+ client_id: z.ZodOptional<z.ZodString>;
1515
+ post_logout_redirect_uri: z.ZodOptional<z.ZodURL>;
1516
+ state: z.ZodOptional<z.ZodString>;
1517
+ }, z.core.$strip>>;
1491
1518
  metadata: {
1519
+ noStore: boolean;
1520
+ allowedMediaTypes: string[];
1521
+ $Infer: {
1522
+ body: RPInitiatedLogoutClientInput;
1523
+ query: RPInitiatedLogoutFields;
1524
+ };
1492
1525
  openapi: {
1493
1526
  description: string;
1494
1527
  responses: {
@@ -1511,13 +1544,29 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1511
1544
  };
1512
1545
  };
1513
1546
  };
1547
+ "text/html": {
1548
+ schema: {
1549
+ type: "string";
1550
+ };
1551
+ };
1514
1552
  };
1515
1553
  };
1516
1554
  };
1517
1555
  };
1518
1556
  };
1519
- }, OAuthRedirectResult | undefined>;
1520
- registerOAuthClient: import("better-call").StrictEndpoint<"/oauth2/register", {
1557
+ }, Response | OAuthRedirectResult | null>;
1558
+ oauth2EndSessionConfirmation: _$better_call0.StrictEndpoint<"/oauth2/end-session/confirm", {
1559
+ method: "POST";
1560
+ body: z.ZodObject<{
1561
+ action: z.ZodLiteral<"confirm">;
1562
+ }, z.core.$strip>;
1563
+ metadata: {
1564
+ noStore: boolean;
1565
+ allowedMediaTypes: string[];
1566
+ scope: "http";
1567
+ };
1568
+ }, Response | OAuthRedirectResult | null>;
1569
+ registerOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/register", {
1521
1570
  method: "POST";
1522
1571
  body: z.ZodObject<{
1523
1572
  redirect_uris: z.ZodOptional<z.ZodArray<z.ZodURL>>;
@@ -1572,8 +1621,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1572
1621
  content: {
1573
1622
  "application/json": {
1574
1623
  schema: {
1575
- /** @returns {OauthClient} */
1576
- type: "object";
1624
+ /** @returns {OauthClient} */type: "object";
1577
1625
  properties: {
1578
1626
  client_id: {
1579
1627
  type: string;
@@ -1709,7 +1757,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1709
1757
  };
1710
1758
  };
1711
1759
  }, OAuthClientRegistrationResponse>;
1712
- adminCreateOAuthClient: import("better-call").StrictEndpoint<"/admin/oauth2/create-client", {
1760
+ adminCreateOAuthClient: _$better_call0.StrictEndpoint<"/admin/oauth2/create-client", {
1713
1761
  method: "POST";
1714
1762
  body: z.ZodObject<{
1715
1763
  redirect_uris: z.ZodOptional<z.ZodArray<z.ZodURL>>;
@@ -1899,9 +1947,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
1899
1947
  };
1900
1948
  };
1901
1949
  }, OAuthClientAdministrativeResponse>;
1902
- createOAuthClient: import("better-call").StrictEndpoint<"/oauth2/create-client", {
1950
+ createOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/create-client", {
1903
1951
  method: "POST";
1904
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1952
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
1905
1953
  session: {
1906
1954
  session: Record<string, any> & {
1907
1955
  id: string;
@@ -2089,9 +2137,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2089
2137
  };
2090
2138
  };
2091
2139
  }, OAuthClientRegistrationResponse>;
2092
- getOAuthClient: import("better-call").StrictEndpoint<"/oauth2/get-client", {
2140
+ getOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/get-client", {
2093
2141
  method: "GET";
2094
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2142
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2095
2143
  session: {
2096
2144
  session: Record<string, any> & {
2097
2145
  id: string;
@@ -2123,9 +2171,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2123
2171
  };
2124
2172
  };
2125
2173
  }, OAuthClient>;
2126
- getOAuthClientPublic: import("better-call").StrictEndpoint<"/oauth2/public-client", {
2174
+ getOAuthClientPublic: _$better_call0.StrictEndpoint<"/oauth2/public-client", {
2127
2175
  method: "GET";
2128
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2176
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2129
2177
  session: {
2130
2178
  session: Record<string, any> & {
2131
2179
  id: string;
@@ -2157,9 +2205,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2157
2205
  };
2158
2206
  };
2159
2207
  }, OAuthClient>;
2160
- getOAuthClientPublicPrelogin: import("better-call").StrictEndpoint<"/oauth2/public-client-prelogin", {
2208
+ getOAuthClientPublicPrelogin: _$better_call0.StrictEndpoint<"/oauth2/public-client-prelogin", {
2161
2209
  method: "POST";
2162
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>[];
2210
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[];
2163
2211
  body: z.ZodObject<{
2164
2212
  client_id: z.ZodString;
2165
2213
  oauth_query: z.ZodOptional<z.ZodString>;
@@ -2170,9 +2218,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2170
2218
  };
2171
2219
  };
2172
2220
  }, OAuthClient>;
2173
- getOAuthClients: import("better-call").StrictEndpoint<"/oauth2/get-clients", {
2221
+ getOAuthClients: _$better_call0.StrictEndpoint<"/oauth2/get-clients", {
2174
2222
  method: "GET";
2175
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2223
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2176
2224
  session: {
2177
2225
  session: Record<string, any> & {
2178
2226
  id: string;
@@ -2201,7 +2249,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2201
2249
  };
2202
2250
  };
2203
2251
  }, OAuthClient[] | null>;
2204
- adminUpdateOAuthClient: import("better-call").StrictEndpoint<"/admin/oauth2/update-client", {
2252
+ adminUpdateOAuthClient: _$better_call0.StrictEndpoint<"/admin/oauth2/update-client", {
2205
2253
  method: "PATCH";
2206
2254
  body: z.ZodObject<{
2207
2255
  client_id: z.ZodString;
@@ -2243,9 +2291,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2243
2291
  };
2244
2292
  };
2245
2293
  }, OAuthClientAdministrativeResponse>;
2246
- updateOAuthClient: import("better-call").StrictEndpoint<"/oauth2/update-client", {
2294
+ updateOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/update-client", {
2247
2295
  method: "POST";
2248
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2296
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2249
2297
  session: {
2250
2298
  session: Record<string, any> & {
2251
2299
  id: string;
@@ -2301,9 +2349,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2301
2349
  };
2302
2350
  };
2303
2351
  }, OAuthClientRegistrationResponse>;
2304
- rotateClientSecret: import("better-call").StrictEndpoint<"/oauth2/client/rotate-secret", {
2352
+ rotateClientSecret: _$better_call0.StrictEndpoint<"/oauth2/client/rotate-secret", {
2305
2353
  method: "POST";
2306
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2354
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2307
2355
  session: {
2308
2356
  session: Record<string, any> & {
2309
2357
  id: string;
@@ -2336,9 +2384,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2336
2384
  };
2337
2385
  };
2338
2386
  }, OAuthClient>;
2339
- deleteOAuthClient: import("better-call").StrictEndpoint<"/oauth2/delete-client", {
2387
+ deleteOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/delete-client", {
2340
2388
  method: "POST";
2341
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2389
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2342
2390
  session: {
2343
2391
  session: Record<string, any> & {
2344
2392
  id: string;
@@ -2370,12 +2418,12 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2370
2418
  };
2371
2419
  };
2372
2420
  }, void>;
2373
- getOAuthConsent: import("better-call").StrictEndpoint<"/oauth2/get-consent", {
2421
+ getOAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/get-consent", {
2374
2422
  method: "GET";
2375
2423
  query: z.ZodObject<{
2376
2424
  id: z.ZodString;
2377
2425
  }, z.core.$strip>;
2378
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2426
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2379
2427
  session: {
2380
2428
  session: Record<string, any> & {
2381
2429
  id: string;
@@ -2404,9 +2452,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2404
2452
  };
2405
2453
  };
2406
2454
  }, OAuthConsent<Scope[]>>;
2407
- getOAuthConsents: import("better-call").StrictEndpoint<"/oauth2/get-consents", {
2455
+ getOAuthConsents: _$better_call0.StrictEndpoint<"/oauth2/get-consents", {
2408
2456
  method: "GET";
2409
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2457
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2410
2458
  session: {
2411
2459
  session: Record<string, any> & {
2412
2460
  id: string;
@@ -2435,9 +2483,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2435
2483
  };
2436
2484
  };
2437
2485
  }, OAuthConsent<Scope[]>[]>;
2438
- updateOAuthConsent: import("better-call").StrictEndpoint<"/oauth2/update-consent", {
2486
+ updateOAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/update-consent", {
2439
2487
  method: "POST";
2440
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2488
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2441
2489
  session: {
2442
2490
  session: Record<string, any> & {
2443
2491
  id: string;
@@ -2472,9 +2520,9 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2472
2520
  };
2473
2521
  };
2474
2522
  }, OAuthConsent<Scope[]> | null>;
2475
- deleteOAuthConsent: import("better-call").StrictEndpoint<"/oauth2/delete-consent", {
2523
+ deleteOAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/delete-consent", {
2476
2524
  method: "POST";
2477
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
2525
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
2478
2526
  session: {
2479
2527
  session: Record<string, any> & {
2480
2528
  id: string;
@@ -2506,7 +2554,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2506
2554
  };
2507
2555
  };
2508
2556
  }, void>;
2509
- adminCreateOAuthResource: import("better-call").StrictEndpoint<"/admin/oauth2/resources", {
2557
+ adminCreateOAuthResource: _$better_call0.StrictEndpoint<"/admin/oauth2/resources", {
2510
2558
  method: "POST";
2511
2559
  body: z.ZodObject<{
2512
2560
  identifier: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
@@ -2531,19 +2579,19 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2531
2579
  SERVER_ONLY: true;
2532
2580
  };
2533
2581
  }, OAuthResource>;
2534
- adminListOAuthResources: import("better-call").StrictEndpoint<"/admin/oauth2/resources", {
2582
+ adminListOAuthResources: _$better_call0.StrictEndpoint<"/admin/oauth2/resources", {
2535
2583
  method: "GET";
2536
2584
  metadata: {
2537
2585
  SERVER_ONLY: true;
2538
2586
  };
2539
2587
  }, OAuthResource[]>;
2540
- adminGetOAuthResource: import("better-call").StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2588
+ adminGetOAuthResource: _$better_call0.StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2541
2589
  method: "GET";
2542
2590
  metadata: {
2543
2591
  SERVER_ONLY: true;
2544
2592
  };
2545
2593
  }, OAuthResource>;
2546
- adminUpdateOAuthResource: import("better-call").StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2594
+ adminUpdateOAuthResource: _$better_call0.StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2547
2595
  method: "PATCH";
2548
2596
  body: z.ZodObject<{
2549
2597
  identifier: z.ZodOptional<z.ZodString>;
@@ -2568,7 +2616,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2568
2616
  SERVER_ONLY: true;
2569
2617
  };
2570
2618
  }, OAuthResource>;
2571
- adminDeleteOAuthResource: import("better-call").StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2619
+ adminDeleteOAuthResource: _$better_call0.StrictEndpoint<"/admin/oauth2/resources/:identifier", {
2572
2620
  method: "DELETE";
2573
2621
  metadata: {
2574
2622
  SERVER_ONLY: true;
@@ -2576,7 +2624,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2576
2624
  }, {
2577
2625
  deleted: boolean;
2578
2626
  }>;
2579
- adminLinkClientResource: import("better-call").StrictEndpoint<"/admin/oauth2/resources/:identifier/clients/:client_id", {
2627
+ adminLinkClientResource: _$better_call0.StrictEndpoint<"/admin/oauth2/resources/:identifier/clients/:client_id", {
2580
2628
  method: "POST";
2581
2629
  metadata: {
2582
2630
  SERVER_ONLY: true;
@@ -2584,7 +2632,7 @@ declare const oauthProvider: <O extends OAuthOptions<Scope[]>>(options: O) => {
2584
2632
  }, {
2585
2633
  linked: boolean;
2586
2634
  }>;
2587
- adminUnlinkClientResource: import("better-call").StrictEndpoint<"/admin/oauth2/resources/:identifier/clients/:client_id", {
2635
+ adminUnlinkClientResource: _$better_call0.StrictEndpoint<"/admin/oauth2/resources/:identifier/clients/:client_id", {
2588
2636
  method: "DELETE";
2589
2637
  metadata: {
2590
2638
  SERVER_ONLY: true;
@@ -2,7 +2,7 @@ import { isAPIError } from "better-auth/api";
2
2
  import { APIError as APIError$1 } from "better-call";
3
3
  import { DPOP_SIGNING_ALGORITHMS, isInsufficientScopeError } from "better-auth/oauth2";
4
4
  //#region src/resource-challenge.ts
5
- const DPOP_CHALLENGE_ERRORS = /* @__PURE__ */ new Set(["invalid_dpop_proof"]);
5
+ const DPOP_CHALLENGE_ERRORS = new Set(["invalid_dpop_proof"]);
6
6
  const OAUTH_SCOPE_TOKEN_PATTERN = /^[\x21\x23-\x5b\x5d-\x7e]+$/;
7
7
  const ERROR_DESCRIPTION_PATTERN = /^[\x20-\x21\x23-\x5b\x5d-\x7e]+$/;
8
8
  function quoteAuthParam(value) {
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };