import type { Oauth2Flow, Server } from '@scalar/oas-utils/entities/spec';
import type { ErrorResponse } from '../../../libs/errors.js';
/** Oauth2 security schemes which are not implicit */
type NonImplicitFlow = Exclude<Oauth2Flow, {
    type: 'implicit';
}>;
type PKCEState = {
    codeVerifier: string;
    codeChallenge: string;
    codeChallengeMethod: string;
};
/**
 * Interpolates server URL template variables (e.g. `https://{env}.example.com`)
 * using the user-set `value` when available, falling back to the OpenAPI `default`.
 * This is needed so OAuth flows that use the server URL as a base resolve correctly
 * when the spec defines server variables.
 */
export declare const getInterpolatedServerUrl: (activeServer?: Server) => string | undefined;
/**
 * Creates a code challenge from the code verifier
 */
export declare const generateCodeChallenge: (verifier: string, encoding: "SHA-256" | "plain") => Promise<string>;
/**
 * Authorize oauth2 flow
 *
 * @returns the accessToken
 */
export declare const authorizeOauth2: (flow: Oauth2Flow, 
/** We use the active server to set a base for relative redirect uris */
activeServer: Server, 
/** If we want to use the proxy */
proxyUrl?: string) => Promise<ErrorResponse<string>>;
/**
 * Makes the BE authorization call to grab the token server to server
 * Used for clientCredentials and authorizationCode
 */
export declare const authorizeServers: (flow: NonImplicitFlow, scopes: string, { code, pkce, proxyUrl, }: {
    code?: string;
    pkce?: PKCEState | null;
    proxyUrl?: string | undefined;
} | undefined, activeServer: Server | undefined) => Promise<ErrorResponse<string>>;
export {};
//# sourceMappingURL=oauth2.d.ts.map