import { SecretConfig } from "@better-auth/core"; import * as z from "zod"; declare module "@better-auth/core" { interface BetterAuthPluginRegistry { "oauth-proxy": { creator: typeof oAuthProxy; }; } } export interface OAuthProxyOptions { /** * The current URL of the application. * The plugin will attempt to infer the current URL from your environment * by checking the base URL from popular hosting providers, * from the request URL if invoked by a client, * or as a fallback, from the `baseURL` in your auth config. * If the URL is not inferred correctly, you can provide a value here." */ currentURL?: string | undefined; /** * If a request in a production url it won't be proxied. * * default to `BETTER_AUTH_URL` */ productionURL?: string | undefined; /** * Maximum age in seconds for the encrypted payload. * Payloads older than this will be rejected to prevent replay attacks. * * Keep this value short (e.g., 30-60 seconds) to minimize the window * for potential replay attacks while still allowing normal OAuth flows. * * @default 60 (1 minute) */ maxAge?: number | undefined; /** * A dedicated secret used to encrypt and decrypt data passed between * servers during the OAuth proxy flow. * * When set, keys derived from this secret are used **instead of** keys * derived from `BETTER_AUTH_SECRET` for OAuth proxy encryption. * This limits exposure of data protected only by the main secret if * the proxy secret is shared across environments (production, preview, * development). A compromised proxy secret can still affect OAuth flows. * * All environments participating in the OAuth proxy flow must share * the same `secret` value. */ secret?: string | SecretConfig | undefined; } export declare const oAuthProxy: (opts?: O) => { id: "oauth-proxy"; version: string; options: NoInfer; endpoints: { /** * @deprecated OAuth proxy callbacks now use `/callback/:id/oauth-proxy`. * This endpoint will be removed in the next minor release. */ oAuthProxy: import("better-call").StrictEndpoint<"/oauth-proxy-callback", { method: "GET"; operationId: string; query: z.ZodObject<{ callbackURL: z.ZodString; profile: z.ZodOptional; }, z.core.$strip>; use: import("better-call").Middleware) => Promise>[]; metadata: { openapi: { operationId: string; deprecated: boolean; 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>; oAuthProxyCompletion: import("better-call").StrictEndpoint<"/callback/:id/oauth-proxy", { method: "GET"; operationId: string; query: z.ZodObject<{ callbackURL: z.ZodString; profile: z.ZodOptional; }, z.core.$strip>; use: import("better-call").Middleware) => Promise>[]; metadata: { scope: "http"; }; }, never>; }; hooks: { before: { matcher(context: import("@better-auth/core").HookEndpointContext): boolean; handler: import("better-call").Middleware) => Promise>; }[]; after: { matcher(context: import("@better-auth/core").HookEndpointContext): boolean; handler: import("better-call").Middleware) => Promise>; }[]; }; };