import { BetterAuthConfig, EmailServiceConfig, OIDCProviderConfig, SAMLProviderConfig, SSOProviderConfig, UserAuthConfig } from "./auth-types.js";
import { extractCookieDomain, hasCredentialAccount } from "./auth-config-utils.js";
import * as jose0 from "jose";
import * as zod0 from "zod";
import * as better_auth0 from "better-auth";
import * as _better_auth_oauth_provider0 from "@better-auth/oauth-provider";
import * as better_auth_plugins0 from "better-auth/plugins";
import * as zod_v4_core0 from "zod/v4/core";

//#region src/auth/auth.d.ts

/**
 * Type-only helper: a simplified betterAuth call that TypeScript can evaluate
 * cheaply to produce precise API types. The real createAuth() has complex
 * callbacks/closures that cause TypeScript to fall back to index signatures.
 * This function is never called at runtime.
 *
 * Note: sso() and dash() are intentionally excluded here. They come from
 * @better-auth/sso and @better-auth/infra which resolve @better-auth/core
 * through different pnpm virtual store paths (due to @better-auth/infra
 * bundling better-call@beta). This creates duplicate @better-auth/core
 * instances that TypeScript treats as incompatible, causing the plugins
 * array to widen to BetterAuthPlugin[] and producing an index signature
 * on .api. Since no auth.api.* calls use SSO or dash methods, omitting
 * them is safe and preserves precise types.
 */
declare function _inferAuthType(): better_auth0.Auth<{
  plugins: [{
    id: "bearer";
    version: string;
    hooks: {
      before: {
        matcher(context: better_auth0.HookEndpointContext): boolean;
        handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          context: {
            headers: Headers;
          };
        } | undefined>;
      }[];
      after: {
        matcher(context: better_auth0.HookEndpointContext): true;
        handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>;
      }[];
    };
    options: better_auth_plugins0.BearerOptions | undefined;
  }, {
    id: "oauth-proxy";
    version: string;
    options: NoInfer<better_auth_plugins0.OAuthProxyOptions>;
    endpoints: {
      oAuthProxy: better_auth0.StrictEndpoint<"/oauth-proxy-callback", {
        method: "GET";
        operationId: string;
        query: zod0.ZodObject<{
          callbackURL: zod0.ZodString;
          profile: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>)[];
        metadata: {
          openapi: {
            operationId: string;
            description: string;
            parameters: ({
              in: "query";
              name: string;
              required: true;
              description: string;
            } | {
              in: "query";
              name: string;
              required: false;
              description: string;
            })[];
            responses: {
              302: {
                description: string;
                headers: {
                  Location: {
                    description: string;
                    schema: {
                      type: string;
                    };
                  };
                };
              };
            };
          };
        };
      }, never>;
    };
    hooks: {
      before: {
        matcher(context: better_auth0.HookEndpointContext): boolean;
        handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>;
      }[];
      after: {
        matcher(context: better_auth0.HookEndpointContext): boolean;
        handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>;
      }[];
    };
  }, {
    id: "jwt";
    version: string;
    options: NoInfer<better_auth_plugins0.JwtOptions>;
    endpoints: {
      getJwks: better_auth0.StrictEndpoint<string, {
        method: "GET";
        metadata: {
          openapi: {
            operationId: string;
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        keys: {
                          type: string;
                          description: string;
                          items: {
                            type: string;
                            properties: {
                              kid: {
                                type: string;
                                description: string;
                              };
                              kty: {
                                type: string;
                                description: string;
                              };
                              alg: {
                                type: string;
                                description: string;
                              };
                              use: {
                                type: string;
                                description: string;
                                enum: string[];
                                nullable: boolean;
                              };
                              n: {
                                type: string;
                                description: string;
                                nullable: boolean;
                              };
                              e: {
                                type: string;
                                description: string;
                                nullable: boolean;
                              };
                              crv: {
                                type: string;
                                description: string;
                                nullable: boolean;
                              };
                              x: {
                                type: string;
                                description: string;
                                nullable: boolean;
                              };
                              y: {
                                type: string;
                                description: string;
                                nullable: boolean;
                              };
                            };
                            required: string[];
                          };
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, jose0.JSONWebKeySet>;
      getToken: better_auth0.StrictEndpoint<"/token", {
        method: "GET";
        requireHeaders: true;
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        metadata: {
          openapi: {
            operationId: string;
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        token: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        token: string;
      }>;
      signJWT: better_auth0.StrictEndpoint<string, {
        method: "POST";
        metadata: {
          $Infer: {
            body: {
              payload: jose0.JWTPayload;
              overrideOptions?: better_auth_plugins0.JwtOptions | undefined;
            };
          };
        };
        body: zod0.ZodObject<{
          payload: zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>;
          overrideOptions: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
        }, zod_v4_core0.$strip>;
      }, {
        token: string;
      }>;
      verifyJWT: better_auth0.StrictEndpoint<string, {
        method: "POST";
        metadata: {
          $Infer: {
            body: {
              token: string;
              issuer?: string;
            };
            response: {
              payload: {
                sub: string;
                aud: string;
                [key: string]: any;
              } | null;
            };
          };
        };
        body: zod0.ZodObject<{
          token: zod0.ZodString;
          issuer: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
      }, {
        payload: (jose0.JWTPayload & Required<Pick<jose0.JWTPayload, "sub" | "aud">>) | null;
      }>;
    };
    hooks: {
      after: {
        matcher(context: better_auth0.HookEndpointContext): boolean;
        handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>;
      }[];
    };
    schema: {
      jwks: {
        fields: {
          publicKey: {
            type: "string";
            required: true;
          };
          privateKey: {
            type: "string";
            required: true;
          };
          createdAt: {
            type: "date";
            required: true;
          };
          expiresAt: {
            type: "date";
            required: false;
          };
        };
      };
    };
  }, {
    id: "oauth-provider";
    version: string;
    options: NoInfer<{
      loginPage: string;
      consentPage: string;
    }>;
    init: (ctx: better_auth0.AuthContext) => void;
    hooks: {
      before: {
        matcher(ctx: better_auth0.HookEndpointContext): any;
        handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>;
      }[];
      after: {
        matcher(ctx: better_auth0.HookEndpointContext): boolean;
        handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          redirect: boolean;
          url: string;
        } | undefined>;
      }[];
    };
    endpoints: {
      getOAuthServerConfig: better_auth0.StrictEndpoint<"/.well-known/oauth-authorization-server", {
        method: "GET";
        metadata: {
          SERVER_ONLY: true;
        };
      }, _better_auth_oauth_provider0.AuthServerMetadata>;
      getOpenIdConfig: better_auth0.StrictEndpoint<"/.well-known/openid-configuration", {
        method: "GET";
        metadata: {
          SERVER_ONLY: true;
        };
      }, Omit<_better_auth_oauth_provider0.OIDCMetadata, "id_token_signing_alg_values_supported"> & {
        id_token_signing_alg_values_supported: better_auth_plugins0.JWSAlgorithms[] | ["HS256"];
      }>;
      oauth2Authorize: better_auth0.StrictEndpoint<"/oauth2/authorize", {
        method: "GET";
        query: zod0.ZodObject<{
          response_type: zod0.ZodOptional<zod0.ZodEnum<{
            code: "code";
          }>>;
          client_id: zod0.ZodString;
          redirect_uri: zod0.ZodOptional<zod0.ZodURL>;
          scope: zod0.ZodOptional<zod0.ZodString>;
          state: zod0.ZodOptional<zod0.ZodString>;
          request_uri: zod0.ZodOptional<zod0.ZodString>;
          code_challenge: zod0.ZodOptional<zod0.ZodString>;
          code_challenge_method: zod0.ZodOptional<zod0.ZodEnum<{
            S256: "S256";
          }>>;
          nonce: zod0.ZodOptional<zod0.ZodString>;
          prompt: zod0.ZodOptional<zod0.ZodEnum<{
            none: "none";
            consent: "consent";
            login: "login";
            create: "create";
            select_account: "select_account";
            "login consent": "login consent";
            "select_account consent": "select_account consent";
          }>>;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
            parameters: ({
              name: string;
              in: "query";
              required: false;
              schema: {
                type: "string";
                format?: undefined;
              };
              description: string;
            } | {
              name: string;
              in: "query";
              required: true;
              schema: {
                type: "string";
                format?: undefined;
              };
              description: string;
            } | {
              name: string;
              in: "query";
              required: false;
              schema: {
                type: "string";
                format: string;
              };
              description: string;
            })[];
            responses: {
              "302": {
                description: string;
                headers: {
                  Location: {
                    description: string;
                    schema: {
                      type: string;
                      format: string;
                    };
                  };
                };
              };
              "400": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                        };
                        error_description: {
                          type: string;
                        };
                        state: {
                          type: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        redirect: boolean;
        url: string;
      }>;
      oauth2Consent: better_auth0.StrictEndpoint<"/oauth2/consent", {
        method: "POST";
        body: zod0.ZodObject<{
          accept: zod0.ZodBoolean;
          scope: zod0.ZodOptional<zod0.ZodString>;
          oauth_query: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        metadata: {
          openapi: {
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        redirect_uri: {
                          type: string;
                          format: string;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        redirect: boolean;
        url: string;
      }>;
      oauth2Continue: better_auth0.StrictEndpoint<"/oauth2/continue", {
        method: "POST";
        body: zod0.ZodObject<{
          selected: zod0.ZodOptional<zod0.ZodBoolean>;
          created: zod0.ZodOptional<zod0.ZodBoolean>;
          postLogin: zod0.ZodOptional<zod0.ZodBoolean>;
          oauth_query: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        metadata: {
          openapi: {
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        redirect_uri: {
                          type: string;
                          format: string;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        redirect: boolean;
        url: string;
      }>;
      oauth2Token: better_auth0.StrictEndpoint<"/oauth2/token", {
        method: "POST";
        body: zod0.ZodObject<{
          grant_type: zod0.ZodEnum<{
            authorization_code: "authorization_code";
            client_credentials: "client_credentials";
            refresh_token: "refresh_token";
          }>;
          client_id: zod0.ZodOptional<zod0.ZodString>;
          client_secret: zod0.ZodOptional<zod0.ZodString>;
          code: zod0.ZodOptional<zod0.ZodString>;
          code_verifier: zod0.ZodOptional<zod0.ZodString>;
          redirect_uri: zod0.ZodOptional<zod0.ZodURL>;
          refresh_token: zod0.ZodOptional<zod0.ZodString>;
          resource: zod0.ZodOptional<zod0.ZodString>;
          scope: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
        metadata: {
          allowedMediaTypes: string[];
          openapi: {
            description: string;
            requestBody: {
              required: boolean;
              content: {
                "application/json": {
                  schema: {
                    type: "object";
                    properties: {
                      grant_type: {
                        type: string;
                        enum: string[];
                        description: string;
                      };
                      client_id: {
                        type: string;
                        description: string;
                      };
                      client_secret: {
                        type: string;
                        description: string;
                      };
                      code: {
                        type: string;
                        description: string;
                      };
                      code_verifier: {
                        type: string;
                        description: string;
                      };
                      redirect_uri: {
                        type: string;
                        format: string;
                        description: string;
                      };
                      refresh_token: {
                        type: string;
                        description: string;
                      };
                      resource: {
                        type: string;
                        description: string;
                      };
                      scope: {
                        type: string;
                        description: string;
                      };
                    };
                    required: string[];
                  };
                };
              };
            };
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        access_token: {
                          type: string;
                          description: string;
                        };
                        token_type: {
                          type: string;
                          description: string;
                          enum: string[];
                        };
                        expires_in: {
                          type: string;
                          description: string;
                        };
                        refresh_token: {
                          type: string;
                          description: string;
                        };
                        scope: {
                          type: string;
                          description: string;
                        };
                        id_token: {
                          type: string;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
              "400": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                        };
                        error_description: {
                          type: string;
                        };
                        error_uri: {
                          type: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        access_token: string;
        expires_in: number;
        expires_at: number;
        token_type: "Bearer";
        refresh_token: string | undefined;
        scope: string;
        id_token: string | undefined;
      }>;
      oauth2Introspect: better_auth0.StrictEndpoint<"/oauth2/introspect", {
        method: "POST";
        body: zod0.ZodObject<{
          client_id: zod0.ZodOptional<zod0.ZodString>;
          client_secret: zod0.ZodOptional<zod0.ZodString>;
          token: zod0.ZodString;
          token_type_hint: zod0.ZodOptional<zod0.ZodEnum<{
            refresh_token: "refresh_token";
            access_token: "access_token";
          }>>;
        }, zod_v4_core0.$strip>;
        metadata: {
          allowedMediaTypes: string[];
          openapi: {
            description: string;
            requestBody: {
              required: boolean;
              content: {
                "application/json": {
                  schema: {
                    type: "object";
                    properties: {
                      client_id: {
                        type: string;
                        description: string;
                      };
                      client_secret: {
                        type: string;
                        description: string;
                      };
                      token: {
                        type: string;
                        description: string;
                      };
                      token_type_hint: {
                        type: string;
                        enum: string[];
                        description: string;
                      };
                      resource: {
                        type: string;
                        description: string;
                      };
                    };
                    required: string[];
                  };
                };
              };
            };
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        active: {
                          type: string;
                          description: string;
                        };
                        scope: {
                          type: string;
                          description: string;
                        };
                        client_id: {
                          type: string;
                          description: string;
                        };
                        username: {
                          type: string;
                          description: string;
                        };
                        token_type: {
                          type: string;
                          description: string;
                        };
                        exp: {
                          type: string;
                          description: string;
                        };
                        iat: {
                          type: string;
                          description: string;
                        };
                        nbf: {
                          type: string;
                          description: string;
                        };
                        sub: {
                          type: string;
                          description: string;
                        };
                        aud: {
                          type: string;
                          description: string;
                        };
                        iss: {
                          type: string;
                          description: string;
                        };
                        jti: {
                          type: string;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
              "400": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                        };
                        error_description: {
                          type: string;
                        };
                        error_uri: {
                          type: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, jose0.JWTPayload>;
      oauth2Revoke: better_auth0.StrictEndpoint<"/oauth2/revoke", {
        method: "POST";
        body: zod0.ZodObject<{
          client_id: zod0.ZodOptional<zod0.ZodString>;
          client_secret: zod0.ZodOptional<zod0.ZodString>;
          token: zod0.ZodString;
          token_type_hint: zod0.ZodOptional<zod0.ZodEnum<{
            refresh_token: "refresh_token";
            access_token: "access_token";
          }>>;
        }, zod_v4_core0.$strip>;
        metadata: {
          allowedMediaTypes: string[];
          openapi: {
            description: string;
            requestBody: {
              required: boolean;
              content: {
                "application/json": {
                  schema: {
                    type: "object";
                    properties: {
                      client_id: {
                        type: string;
                        description: string;
                      };
                      client_secret: {
                        type: string;
                        description: string;
                      };
                      token: {
                        type: string;
                        description: string;
                      };
                      token_type_hint: {
                        type: string;
                        enum: string[];
                        description: string;
                      };
                    };
                    required: string[];
                  };
                };
              };
            };
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      description: string;
                    };
                  };
                };
              };
              "400": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                        };
                        error_description: {
                          type: string;
                        };
                        error_uri: {
                          type: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, null | undefined>;
      oauth2UserInfo: better_auth0.StrictEndpoint<"/oauth2/userinfo", {
        method: "GET";
        metadata: {
          openapi: {
            description: string;
            security: ({
              bearerAuth: never[];
              OAuth2?: undefined;
            } | {
              OAuth2: string[];
              bearerAuth?: undefined;
            })[];
            parameters: {
              name: string;
              in: "header";
              required: false;
              schema: {
                type: "string";
              };
              description: string;
            }[];
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        sub: {
                          type: string;
                          description: string;
                        };
                        email: {
                          type: string;
                          format: string;
                          nullable: boolean;
                          description: string;
                        };
                        name: {
                          type: string;
                          nullable: boolean;
                          description: string;
                        };
                        picture: {
                          type: string;
                          format: string;
                          nullable: boolean;
                          description: string;
                        };
                        given_name: {
                          type: string;
                          nullable: boolean;
                          description: string;
                        };
                        family_name: {
                          type: string;
                          nullable: boolean;
                          description: string;
                        };
                        email_verified: {
                          type: string;
                          nullable: boolean;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
              "401": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                        };
                        error_description: {
                          type: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
              "403": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                        };
                        error_description: {
                          type: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        email?: string | undefined;
        email_verified?: boolean | undefined;
        name?: string | undefined;
        picture?: string | undefined;
        given_name?: string | undefined;
        family_name?: string | undefined;
        sub: string;
      }>;
      oauth2EndSession: better_auth0.StrictEndpoint<"/oauth2/end-session", {
        method: "GET";
        query: zod0.ZodObject<{
          id_token_hint: zod0.ZodString;
          client_id: zod0.ZodOptional<zod0.ZodString>;
          post_logout_redirect_uri: zod0.ZodOptional<zod0.ZodURL>;
          state: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        redirect_uri: {
                          type: string;
                          format: string;
                          description: string;
                        };
                        message: {
                          type: string;
                          description: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        redirect: boolean;
        url: string;
      } | undefined>;
      registerOAuthClient: better_auth0.StrictEndpoint<"/oauth2/register", {
        method: "POST";
        body: zod0.ZodObject<{
          redirect_uris: zod0.ZodArray<zod0.ZodURL>;
          scope: zod0.ZodOptional<zod0.ZodString>;
          client_name: zod0.ZodOptional<zod0.ZodString>;
          client_uri: zod0.ZodOptional<zod0.ZodString>;
          logo_uri: zod0.ZodOptional<zod0.ZodString>;
          contacts: zod0.ZodOptional<zod0.ZodArray<zod0.ZodString>>;
          tos_uri: zod0.ZodOptional<zod0.ZodString>;
          policy_uri: zod0.ZodOptional<zod0.ZodString>;
          software_id: zod0.ZodOptional<zod0.ZodString>;
          software_version: zod0.ZodOptional<zod0.ZodString>;
          software_statement: zod0.ZodOptional<zod0.ZodString>;
          post_logout_redirect_uris: zod0.ZodOptional<zod0.ZodArray<zod0.ZodURL>>;
          token_endpoint_auth_method: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodEnum<{
            none: "none";
            client_secret_basic: "client_secret_basic";
            client_secret_post: "client_secret_post";
          }>>>;
          grant_types: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodArray<zod0.ZodEnum<{
            authorization_code: "authorization_code";
            client_credentials: "client_credentials";
            refresh_token: "refresh_token";
          }>>>>;
          response_types: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodArray<zod0.ZodEnum<{
            code: "code";
          }>>>>;
          type: zod0.ZodOptional<zod0.ZodEnum<{
            web: "web";
            native: "native";
            "user-agent-based": "user-agent-based";
          }>>;
          subject_type: zod0.ZodOptional<zod0.ZodEnum<{
            public: "public";
            pairwise: "pairwise";
          }>>;
          skip_consent: zod0.ZodOptional<zod0.ZodNever>;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        client_id: {
                          type: string;
                          description: string;
                        };
                        client_secret: {
                          type: string;
                          description: string;
                        };
                        client_secret_expires_at: {
                          type: string;
                          description: string;
                        };
                        scope: {
                          type: string;
                          description: string;
                        };
                        user_id: {
                          type: string;
                          description: string;
                        };
                        client_id_issued_at: {
                          type: string;
                          description: string;
                        };
                        client_name: {
                          type: string;
                          description: string;
                        };
                        client_uri: {
                          type: string;
                          description: string;
                        };
                        logo_uri: {
                          type: string;
                          description: string;
                        };
                        contacts: {
                          type: string;
                          items: {
                            type: string;
                          };
                          description: string;
                        };
                        tos_uri: {
                          type: string;
                          description: string;
                        };
                        policy_uri: {
                          type: string;
                          description: string;
                        };
                        software_id: {
                          type: string;
                          description: string;
                        };
                        software_version: {
                          type: string;
                          description: string;
                        };
                        software_statement: {
                          type: string;
                          description: string;
                        };
                        redirect_uris: {
                          type: string;
                          items: {
                            type: string;
                            format: string;
                          };
                          description: string;
                        };
                        post_logout_redirect_uris: {
                          type: string;
                          items: {
                            type: string;
                            format: string;
                          };
                          description: string;
                        };
                        token_endpoint_auth_method: {
                          type: string;
                          description: string;
                          enum: string[];
                        };
                        grant_types: {
                          type: string;
                          items: {
                            type: string;
                            enum: string[];
                          };
                          description: string;
                        };
                        response_types: {
                          type: string;
                          items: {
                            type: string;
                            enum: string[];
                          };
                          description: string;
                        };
                        public: {
                          type: string;
                          description: string;
                        };
                        type: {
                          type: string;
                          description: string;
                          enum: string[];
                        };
                        disabled: {
                          type: string;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      adminCreateOAuthClient: better_auth0.StrictEndpoint<"/admin/oauth2/create-client", {
        method: "POST";
        body: zod0.ZodObject<{
          redirect_uris: zod0.ZodArray<zod0.ZodURL>;
          scope: zod0.ZodOptional<zod0.ZodString>;
          client_name: zod0.ZodOptional<zod0.ZodString>;
          client_uri: zod0.ZodOptional<zod0.ZodString>;
          logo_uri: zod0.ZodOptional<zod0.ZodString>;
          contacts: zod0.ZodOptional<zod0.ZodArray<zod0.ZodString>>;
          tos_uri: zod0.ZodOptional<zod0.ZodString>;
          policy_uri: zod0.ZodOptional<zod0.ZodString>;
          software_id: zod0.ZodOptional<zod0.ZodString>;
          software_version: zod0.ZodOptional<zod0.ZodString>;
          software_statement: zod0.ZodOptional<zod0.ZodString>;
          post_logout_redirect_uris: zod0.ZodOptional<zod0.ZodArray<zod0.ZodURL>>;
          token_endpoint_auth_method: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodEnum<{
            none: "none";
            client_secret_basic: "client_secret_basic";
            client_secret_post: "client_secret_post";
          }>>>;
          grant_types: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodArray<zod0.ZodEnum<{
            authorization_code: "authorization_code";
            client_credentials: "client_credentials";
            refresh_token: "refresh_token";
          }>>>>;
          response_types: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodArray<zod0.ZodEnum<{
            code: "code";
          }>>>>;
          type: zod0.ZodOptional<zod0.ZodEnum<{
            web: "web";
            native: "native";
            "user-agent-based": "user-agent-based";
          }>>;
          client_secret_expires_at: zod0.ZodDefault<zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodString, zod0.ZodNumber]>>>;
          skip_consent: zod0.ZodOptional<zod0.ZodBoolean>;
          enable_end_session: zod0.ZodOptional<zod0.ZodBoolean>;
          require_pkce: zod0.ZodOptional<zod0.ZodBoolean>;
          subject_type: zod0.ZodOptional<zod0.ZodEnum<{
            public: "public";
            pairwise: "pairwise";
          }>>;
          metadata: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodUnknown>>;
        }, zod_v4_core0.$strip>;
        metadata: {
          SERVER_ONLY: true;
          openapi: {
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        client_id: {
                          type: string;
                          description: string;
                        };
                        client_secret: {
                          type: string;
                          description: string;
                        };
                        client_secret_expires_at: {
                          type: string;
                          description: string;
                        };
                        scope: {
                          type: string;
                          description: string;
                        };
                        user_id: {
                          type: string;
                          description: string;
                        };
                        client_id_issued_at: {
                          type: string;
                          description: string;
                        };
                        client_name: {
                          type: string;
                          description: string;
                        };
                        client_uri: {
                          type: string;
                          description: string;
                        };
                        logo_uri: {
                          type: string;
                          description: string;
                        };
                        contacts: {
                          type: string;
                          items: {
                            type: string;
                          };
                          description: string;
                        };
                        tos_uri: {
                          type: string;
                          description: string;
                        };
                        policy_uri: {
                          type: string;
                          description: string;
                        };
                        software_id: {
                          type: string;
                          description: string;
                        };
                        software_version: {
                          type: string;
                          description: string;
                        };
                        software_statement: {
                          type: string;
                          description: string;
                        };
                        redirect_uris: {
                          type: string;
                          items: {
                            type: string;
                            format: string;
                          };
                          description: string;
                        };
                        token_endpoint_auth_method: {
                          type: string;
                          description: string;
                          enum: string[];
                        };
                        grant_types: {
                          type: string;
                          items: {
                            type: string;
                            enum: string[];
                          };
                          description: string;
                        };
                        response_types: {
                          type: string;
                          items: {
                            type: string;
                            enum: string[];
                          };
                          description: string;
                        };
                        public: {
                          type: string;
                          description: string;
                        };
                        type: {
                          type: string;
                          description: string;
                          enum: string[];
                        };
                        disabled: {
                          type: string;
                          description: string;
                        };
                        require_pkce: {
                          type: string;
                          description: string;
                          default: boolean;
                        };
                        metadata: {
                          type: string;
                          additionalProperties: boolean;
                          nullable: boolean;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      createOAuthClient: better_auth0.StrictEndpoint<"/oauth2/create-client", {
        method: "POST";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        body: zod0.ZodObject<{
          redirect_uris: zod0.ZodArray<zod0.ZodURL>;
          scope: zod0.ZodOptional<zod0.ZodString>;
          client_name: zod0.ZodOptional<zod0.ZodString>;
          client_uri: zod0.ZodOptional<zod0.ZodString>;
          logo_uri: zod0.ZodOptional<zod0.ZodString>;
          contacts: zod0.ZodOptional<zod0.ZodArray<zod0.ZodString>>;
          tos_uri: zod0.ZodOptional<zod0.ZodString>;
          policy_uri: zod0.ZodOptional<zod0.ZodString>;
          software_id: zod0.ZodOptional<zod0.ZodString>;
          software_version: zod0.ZodOptional<zod0.ZodString>;
          software_statement: zod0.ZodOptional<zod0.ZodString>;
          post_logout_redirect_uris: zod0.ZodOptional<zod0.ZodArray<zod0.ZodURL>>;
          token_endpoint_auth_method: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodEnum<{
            none: "none";
            client_secret_basic: "client_secret_basic";
            client_secret_post: "client_secret_post";
          }>>>;
          grant_types: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodArray<zod0.ZodEnum<{
            authorization_code: "authorization_code";
            client_credentials: "client_credentials";
            refresh_token: "refresh_token";
          }>>>>;
          response_types: zod0.ZodOptional<zod0.ZodDefault<zod0.ZodArray<zod0.ZodEnum<{
            code: "code";
          }>>>>;
          type: zod0.ZodOptional<zod0.ZodEnum<{
            web: "web";
            native: "native";
            "user-agent-based": "user-agent-based";
          }>>;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              "200": {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        client_id: {
                          type: string;
                          description: string;
                        };
                        client_secret: {
                          type: string;
                          description: string;
                        };
                        client_secret_expires_at: {
                          type: string;
                          description: string;
                        };
                        scope: {
                          type: string;
                          description: string;
                        };
                        user_id: {
                          type: string;
                          description: string;
                        };
                        client_id_issued_at: {
                          type: string;
                          description: string;
                        };
                        client_name: {
                          type: string;
                          description: string;
                        };
                        client_uri: {
                          type: string;
                          description: string;
                        };
                        logo_uri: {
                          type: string;
                          description: string;
                        };
                        contacts: {
                          type: string;
                          items: {
                            type: string;
                          };
                          description: string;
                        };
                        tos_uri: {
                          type: string;
                          description: string;
                        };
                        policy_uri: {
                          type: string;
                          description: string;
                        };
                        software_id: {
                          type: string;
                          description: string;
                        };
                        software_version: {
                          type: string;
                          description: string;
                        };
                        software_statement: {
                          type: string;
                          description: string;
                        };
                        redirect_uris: {
                          type: string;
                          items: {
                            type: string;
                            format: string;
                          };
                          description: string;
                        };
                        token_endpoint_auth_method: {
                          type: string;
                          description: string;
                          enum: string[];
                        };
                        grant_types: {
                          type: string;
                          items: {
                            type: string;
                            enum: string[];
                          };
                          description: string;
                        };
                        response_types: {
                          type: string;
                          items: {
                            type: string;
                            enum: string[];
                          };
                          description: string;
                        };
                        public: {
                          type: string;
                          description: string;
                        };
                        type: {
                          type: string;
                          description: string;
                          enum: string[];
                        };
                        disabled: {
                          type: string;
                          description: string;
                        };
                        metadata: {
                          type: string;
                          additionalProperties: boolean;
                          nullable: boolean;
                          description: string;
                        };
                      };
                      required: string[];
                    };
                  };
                };
              };
            };
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      getOAuthClient: better_auth0.StrictEndpoint<"/oauth2/get-client", {
        method: "GET";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        query: zod0.ZodObject<{
          client_id: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      getOAuthClientPublic: better_auth0.StrictEndpoint<"/oauth2/public-client", {
        method: "GET";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        query: zod0.ZodObject<{
          client_id: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      getOAuthClientPublicPrelogin: better_auth0.StrictEndpoint<"/oauth2/public-client-prelogin", {
        method: "POST";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>)[];
        body: zod0.ZodObject<{
          client_id: zod0.ZodString;
          oauth_query: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      getOAuthClients: better_auth0.StrictEndpoint<"/oauth2/get-clients", {
        method: "GET";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient[] | null>;
      adminUpdateOAuthClient: better_auth0.StrictEndpoint<"/admin/oauth2/update-client", {
        method: "PATCH";
        body: zod0.ZodObject<{
          client_id: zod0.ZodString;
          update: zod0.ZodObject<{
            redirect_uris: zod0.ZodOptional<zod0.ZodArray<zod0.ZodURL>>;
            scope: zod0.ZodOptional<zod0.ZodString>;
            client_name: zod0.ZodOptional<zod0.ZodString>;
            client_uri: zod0.ZodOptional<zod0.ZodString>;
            logo_uri: zod0.ZodOptional<zod0.ZodString>;
            contacts: zod0.ZodOptional<zod0.ZodArray<zod0.ZodString>>;
            tos_uri: zod0.ZodOptional<zod0.ZodString>;
            policy_uri: zod0.ZodOptional<zod0.ZodString>;
            software_id: zod0.ZodOptional<zod0.ZodString>;
            software_version: zod0.ZodOptional<zod0.ZodString>;
            software_statement: zod0.ZodOptional<zod0.ZodString>;
            post_logout_redirect_uris: zod0.ZodOptional<zod0.ZodArray<zod0.ZodURL>>;
            grant_types: zod0.ZodOptional<zod0.ZodArray<zod0.ZodEnum<{
              authorization_code: "authorization_code";
              client_credentials: "client_credentials";
              refresh_token: "refresh_token";
            }>>>;
            response_types: zod0.ZodOptional<zod0.ZodArray<zod0.ZodEnum<{
              code: "code";
            }>>>;
            type: zod0.ZodOptional<zod0.ZodEnum<{
              web: "web";
              native: "native";
              "user-agent-based": "user-agent-based";
            }>>;
            client_secret_expires_at: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodString, zod0.ZodNumber]>>;
            skip_consent: zod0.ZodOptional<zod0.ZodBoolean>;
            enable_end_session: zod0.ZodOptional<zod0.ZodBoolean>;
            metadata: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodUnknown>>;
          }, zod_v4_core0.$strip>;
        }, zod_v4_core0.$strip>;
        metadata: {
          SERVER_ONLY: true;
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      updateOAuthClient: better_auth0.StrictEndpoint<"/oauth2/update-client", {
        method: "POST";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        body: zod0.ZodObject<{
          client_id: zod0.ZodString;
          update: zod0.ZodObject<{
            redirect_uris: zod0.ZodOptional<zod0.ZodArray<zod0.ZodURL>>;
            scope: zod0.ZodOptional<zod0.ZodString>;
            client_name: zod0.ZodOptional<zod0.ZodString>;
            client_uri: zod0.ZodOptional<zod0.ZodString>;
            logo_uri: zod0.ZodOptional<zod0.ZodString>;
            contacts: zod0.ZodOptional<zod0.ZodArray<zod0.ZodString>>;
            tos_uri: zod0.ZodOptional<zod0.ZodString>;
            policy_uri: zod0.ZodOptional<zod0.ZodString>;
            software_id: zod0.ZodOptional<zod0.ZodString>;
            software_version: zod0.ZodOptional<zod0.ZodString>;
            software_statement: zod0.ZodOptional<zod0.ZodString>;
            post_logout_redirect_uris: zod0.ZodOptional<zod0.ZodArray<zod0.ZodURL>>;
            grant_types: zod0.ZodOptional<zod0.ZodArray<zod0.ZodEnum<{
              authorization_code: "authorization_code";
              client_credentials: "client_credentials";
              refresh_token: "refresh_token";
            }>>>;
            response_types: zod0.ZodOptional<zod0.ZodArray<zod0.ZodEnum<{
              code: "code";
            }>>>;
            type: zod0.ZodOptional<zod0.ZodEnum<{
              web: "web";
              native: "native";
              "user-agent-based": "user-agent-based";
            }>>;
          }, zod_v4_core0.$strip>;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      rotateClientSecret: better_auth0.StrictEndpoint<"/oauth2/client/rotate-secret", {
        method: "POST";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        body: zod0.ZodObject<{
          client_id: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthClient>;
      deleteOAuthClient: better_auth0.StrictEndpoint<"/oauth2/delete-client", {
        method: "POST";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        body: zod0.ZodObject<{
          client_id: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, void>;
      getOAuthConsent: better_auth0.StrictEndpoint<"/oauth2/get-consent", {
        method: "GET";
        query: zod0.ZodObject<{
          id: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthConsent<_better_auth_oauth_provider0.Scope[]>>;
      getOAuthConsents: better_auth0.StrictEndpoint<"/oauth2/get-consents", {
        method: "GET";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthConsent<_better_auth_oauth_provider0.Scope[]>[]>;
      updateOAuthConsent: better_auth0.StrictEndpoint<"/oauth2/update-consent", {
        method: "POST";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        body: zod0.ZodObject<{
          id: zod0.ZodString;
          update: zod0.ZodObject<{
            scopes: zod0.ZodArray<zod0.ZodString>;
          }, zod_v4_core0.$strip>;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, _better_auth_oauth_provider0.OAuthConsent<_better_auth_oauth_provider0.Scope[]> | null>;
      deleteOAuthConsent: better_auth0.StrictEndpoint<"/oauth2/delete-consent", {
        method: "POST";
        use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
          session: {
            session: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              userId: string;
              expiresAt: Date;
              token: string;
              ipAddress?: string | null | undefined;
              userAgent?: string | null | undefined;
            };
            user: Record<string, any> & {
              id: string;
              createdAt: Date;
              updatedAt: Date;
              email: string;
              emailVerified: boolean;
              name: string;
              image?: string | null | undefined;
            };
          };
        }>)[];
        body: zod0.ZodObject<{
          id: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
          };
        };
      }, void>;
    };
    schema: {
      oauthClient: {
        modelName: string;
        fields: {
          clientId: {
            type: "string";
            unique: true;
            required: true;
          };
          clientSecret: {
            type: "string";
            required: false;
          };
          disabled: {
            type: "boolean";
            defaultValue: false;
            required: false;
          };
          skipConsent: {
            type: "boolean";
            required: false;
          };
          enableEndSession: {
            type: "boolean";
            required: false;
          };
          subjectType: {
            type: "string";
            required: false;
          };
          scopes: {
            type: "string[]";
            required: false;
          };
          userId: {
            type: "string";
            required: false;
            references: {
              model: string;
              field: string;
            };
          };
          createdAt: {
            type: "date";
            required: false;
          };
          updatedAt: {
            type: "date";
            required: false;
          };
          name: {
            type: "string";
            required: false;
          };
          uri: {
            type: "string";
            required: false;
          };
          icon: {
            type: "string";
            required: false;
          };
          contacts: {
            type: "string[]";
            required: false;
          };
          tos: {
            type: "string";
            required: false;
          };
          policy: {
            type: "string";
            required: false;
          };
          softwareId: {
            type: "string";
            required: false;
          };
          softwareVersion: {
            type: "string";
            required: false;
          };
          softwareStatement: {
            type: "string";
            required: false;
          };
          redirectUris: {
            type: "string[]";
            required: true;
          };
          postLogoutRedirectUris: {
            type: "string[]";
            required: false;
          };
          tokenEndpointAuthMethod: {
            type: "string";
            required: false;
          };
          grantTypes: {
            type: "string[]";
            required: false;
          };
          responseTypes: {
            type: "string[]";
            required: false;
          };
          public: {
            type: "boolean";
            required: false;
          };
          type: {
            type: "string";
            required: false;
          };
          requirePKCE: {
            type: "boolean";
            required: false;
          };
          referenceId: {
            type: "string";
            required: false;
          };
          metadata: {
            type: "json";
            required: false;
          };
        };
      };
      oauthRefreshToken: {
        fields: {
          token: {
            type: "string";
            required: true;
          };
          clientId: {
            type: "string";
            required: true;
            references: {
              model: string;
              field: string;
            };
          };
          sessionId: {
            type: "string";
            required: false;
            references: {
              model: string;
              field: string;
              onDelete: "set null";
            };
          };
          userId: {
            type: "string";
            required: true;
            references: {
              model: string;
              field: string;
            };
          };
          referenceId: {
            type: "string";
            required: false;
          };
          expiresAt: {
            type: "date";
          };
          createdAt: {
            type: "date";
          };
          revoked: {
            type: "date";
            required: false;
          };
          authTime: {
            type: "date";
            required: false;
          };
          scopes: {
            type: "string[]";
            required: true;
          };
        };
      };
      oauthAccessToken: {
        modelName: string;
        fields: {
          token: {
            type: "string";
            unique: true;
          };
          clientId: {
            type: "string";
            required: true;
            references: {
              model: string;
              field: string;
            };
          };
          sessionId: {
            type: "string";
            required: false;
            references: {
              model: string;
              field: string;
              onDelete: "set null";
            };
          };
          userId: {
            type: "string";
            required: false;
            references: {
              model: string;
              field: string;
            };
          };
          referenceId: {
            type: "string";
            required: false;
          };
          refreshId: {
            type: "string";
            required: false;
            references: {
              model: string;
              field: string;
            };
          };
          expiresAt: {
            type: "date";
          };
          createdAt: {
            type: "date";
          };
          scopes: {
            type: "string[]";
            required: true;
          };
        };
      };
      oauthConsent: {
        modelName: string;
        fields: {
          clientId: {
            type: "string";
            required: true;
            references: {
              model: string;
              field: string;
            };
          };
          userId: {
            type: "string";
            required: false;
            references: {
              model: string;
              field: string;
            };
          };
          referenceId: {
            type: "string";
            required: false;
          };
          scopes: {
            type: "string[]";
            required: true;
          };
          createdAt: {
            type: "date";
          };
          updatedAt: {
            type: "date";
          };
        };
      };
    };
    rateLimit: ({
      pathMatcher: (path: string) => path is "/oauth2/token";
      window: number;
      max: number;
    } | {
      pathMatcher: (path: string) => path is "/oauth2/authorize";
      window: number;
      max: number;
    } | {
      pathMatcher: (path: string) => path is "/oauth2/introspect";
      window: number;
      max: number;
    } | {
      pathMatcher: (path: string) => path is "/oauth2/revoke";
      window: number;
      max: number;
    } | {
      pathMatcher: (path: string) => path is "/oauth2/register";
      window: number;
      max: number;
    } | {
      pathMatcher: (path: string) => path is "/oauth2/userinfo";
      window: number;
      max: number;
    })[];
  }, better_auth_plugins0.DefaultOrganizationPlugin<{
    schema: {
      invitation: {
        additionalFields: {
          authMethod: {
            type: "string";
            required: false;
          };
        };
      };
      organization: {
        additionalFields: {
          preferredAuthMethod: {
            type: "string";
            input: true;
            required: false;
          };
          serviceAccountUserId: {
            type: "string";
            input: true;
            required: false;
          };
        };
      };
    };
  }>, {
    id: "device-authorization";
    version: string;
    schema: {
      deviceCode: {
        fields: {
          deviceCode: {
            type: "string";
            required: true;
          };
          userCode: {
            type: "string";
            required: true;
          };
          userId: {
            type: "string";
            required: false;
          };
          expiresAt: {
            type: "date";
            required: true;
          };
          status: {
            type: "string";
            required: true;
          };
          lastPolledAt: {
            type: "date";
            required: false;
          };
          pollingInterval: {
            type: "number";
            required: false;
          };
          clientId: {
            type: "string";
            required: false;
          };
          scope: {
            type: "string";
            required: false;
          };
        };
      };
    };
    endpoints: {
      deviceCode: better_auth0.StrictEndpoint<"/device/code", {
        method: "POST";
        body: zod0.ZodObject<{
          client_id: zod0.ZodString;
          scope: zod0.ZodOptional<zod0.ZodString>;
        }, zod_v4_core0.$strip>;
        error: zod0.ZodObject<{
          error: zod0.ZodEnum<{
            invalid_request: "invalid_request";
            invalid_client: "invalid_client";
          }>;
          error_description: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        device_code: {
                          type: string;
                          description: string;
                        };
                        user_code: {
                          type: string;
                          description: string;
                        };
                        verification_uri: {
                          type: string;
                          format: string;
                          description: string;
                        };
                        verification_uri_complete: {
                          type: string;
                          format: string;
                          description: string;
                        };
                        expires_in: {
                          type: string;
                          description: string;
                        };
                        interval: {
                          type: string;
                          description: string;
                        };
                      };
                    };
                  };
                };
              };
              400: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                          enum: string[];
                        };
                        error_description: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        device_code: string;
        user_code: string;
        verification_uri: string;
        verification_uri_complete: string;
        expires_in: number;
        interval: number;
      }>;
      deviceToken: better_auth0.StrictEndpoint<"/device/token", {
        method: "POST";
        body: zod0.ZodObject<{
          grant_type: zod0.ZodLiteral<"urn:ietf:params:oauth:grant-type:device_code">;
          device_code: zod0.ZodString;
          client_id: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        error: zod0.ZodObject<{
          error: zod0.ZodEnum<{
            invalid_request: "invalid_request";
            authorization_pending: "authorization_pending";
            slow_down: "slow_down";
            expired_token: "expired_token";
            access_denied: "access_denied";
            invalid_grant: "invalid_grant";
          }>;
          error_description: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        session: {
                          $ref: string;
                        };
                        user: {
                          $ref: string;
                        };
                      };
                    };
                  };
                };
              };
              400: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        error: {
                          type: string;
                          enum: string[];
                        };
                        error_description: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        access_token: string;
        token_type: string;
        expires_in: number;
        scope: string;
      }>;
      deviceVerify: better_auth0.StrictEndpoint<"/device", {
        method: "GET";
        query: zod0.ZodObject<{
          user_code: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        error: zod0.ZodObject<{
          error: zod0.ZodEnum<{
            invalid_request: "invalid_request";
          }>;
          error_description: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        user_code: {
                          type: string;
                          description: string;
                        };
                        status: {
                          type: string;
                          enum: string[];
                          description: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        user_code: string;
        status: string;
      }>;
      deviceApprove: better_auth0.StrictEndpoint<"/device/approve", {
        method: "POST";
        body: zod0.ZodObject<{
          userCode: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        error: zod0.ZodObject<{
          error: zod0.ZodEnum<{
            invalid_request: "invalid_request";
            expired_token: "expired_token";
            access_denied: "access_denied";
            device_code_already_processed: "device_code_already_processed";
            unauthorized: "unauthorized";
          }>;
          error_description: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        requireHeaders: true;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        success: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        success: boolean;
      }>;
      deviceDeny: better_auth0.StrictEndpoint<"/device/deny", {
        method: "POST";
        body: zod0.ZodObject<{
          userCode: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        error: zod0.ZodObject<{
          error: zod0.ZodEnum<{
            invalid_request: "invalid_request";
            expired_token: "expired_token";
            access_denied: "access_denied";
            unauthorized: "unauthorized";
          }>;
          error_description: zod0.ZodString;
        }, zod_v4_core0.$strip>;
        requireHeaders: true;
        metadata: {
          openapi: {
            description: string;
            responses: {
              200: {
                description: string;
                content: {
                  "application/json": {
                    schema: {
                      type: "object";
                      properties: {
                        success: {
                          type: string;
                        };
                      };
                    };
                  };
                };
              };
            };
          };
        };
      }, {
        success: boolean;
      }>;
    };
    $ERROR_CODES: {
      USER_NOT_FOUND: better_auth0.RawError<"USER_NOT_FOUND">;
      FAILED_TO_CREATE_SESSION: better_auth0.RawError<"FAILED_TO_CREATE_SESSION">;
      INVALID_DEVICE_CODE: better_auth0.RawError<"INVALID_DEVICE_CODE">;
      EXPIRED_DEVICE_CODE: better_auth0.RawError<"EXPIRED_DEVICE_CODE">;
      EXPIRED_USER_CODE: better_auth0.RawError<"EXPIRED_USER_CODE">;
      AUTHORIZATION_PENDING: better_auth0.RawError<"AUTHORIZATION_PENDING">;
      ACCESS_DENIED: better_auth0.RawError<"ACCESS_DENIED">;
      INVALID_USER_CODE: better_auth0.RawError<"INVALID_USER_CODE">;
      DEVICE_CODE_ALREADY_PROCESSED: better_auth0.RawError<"DEVICE_CODE_ALREADY_PROCESSED">;
      POLLING_TOO_FREQUENTLY: better_auth0.RawError<"POLLING_TOO_FREQUENTLY">;
      INVALID_DEVICE_CODE_STATUS: better_auth0.RawError<"INVALID_DEVICE_CODE_STATUS">;
      AUTHENTICATION_REQUIRED: better_auth0.RawError<"AUTHENTICATION_REQUIRED">;
    };
    options: Partial<{
      expiresIn: better_auth_plugins0.TimeString;
      interval: better_auth_plugins0.TimeString;
      deviceCodeLength: number;
      userCodeLength: number;
      schema: {
        deviceCode?: {
          modelName?: string | undefined;
          fields?: {
            deviceCode?: string | undefined;
            userCode?: string | undefined;
            userId?: string | undefined;
            expiresAt?: string | undefined;
            status?: string | undefined;
            lastPolledAt?: string | undefined;
            pollingInterval?: string | undefined;
            clientId?: string | undefined;
            scope?: string | undefined;
          } | undefined;
        } | undefined;
      };
      generateDeviceCode?: (() => string | Promise<string>) | undefined;
      generateUserCode?: (() => string | Promise<string>) | undefined;
      validateClient?: ((clientId: string) => boolean | Promise<boolean>) | undefined;
      onDeviceAuthRequest?: ((clientId: string, scope: string | undefined) => void | Promise<void>) | undefined;
      verificationUri?: string | undefined;
    }>;
  }];
}>;
type AuthInstance = ReturnType<typeof _inferAuthType>;
declare function createAuth(config: BetterAuthConfig): AuthInstance;
declare const auth: AuthInstance;
//#endregion
export { type BetterAuthConfig, type EmailServiceConfig, type OIDCProviderConfig, type SAMLProviderConfig, type SSOProviderConfig, type UserAuthConfig, auth, createAuth, extractCookieDomain, hasCredentialAccount };