import type { VirtualFS } from '../virtual-fs';
export declare const DEFAULT_CLOUDFLARE_API_BASE_URL = "https://api.cloudflare.com/client/v4";
export declare const DEFAULT_CLOUDFLARE_AUTH_URL = "https://dash.cloudflare.com/oauth2/auth";
export declare const DEFAULT_CLOUDFLARE_TOKEN_URL = "https://dash.cloudflare.com/oauth2/token";
export declare const DEFAULT_CLOUDFLARE_REVOKE_URL = "https://dash.cloudflare.com/oauth2/revoke";
export declare const DEFAULT_WRANGLER_CLIENT_ID = "54d11594-84e4-41aa-b438-e81b8fa78ee7";
export declare const DEFAULT_WRANGLER_CALLBACK_HOST = "localhost";
export declare const DEFAULT_WRANGLER_CALLBACK_PORT = 8976;
export declare const WRANGLER_CALLBACK_PATH = "/oauth/callback";
export declare const WRANGLER_CALLBACK_URL = "http://localhost:8976/oauth/callback";
export declare const WRANGLER_LEGACY_AUTH_CONFIG_PATH = "/home/user/.wrangler/config/default.toml";
export declare const WRANGLER_AUTH_CONFIG_PATH = "/home/user/.config/.wrangler/config/default.toml";
export declare const DEFAULT_WRANGLER_OAUTH_SCOPES: readonly ["account:read", "user:read", "workers:write", "workers_kv:write", "workers_routes:write", "workers_scripts:write", "workers_tail:read", "d1:write", "pages:write", "zone:read", "ssl_certs:write", "ai:write", "ai-search:write", "ai-search:run", "queues:write", "pipelines:write", "secrets_store:write", "artifacts:write", "flagship:write", "containers:write", "cloudchamber:write", "connectivity:admin", "email_routing:write", "email_sending:write", "browser:write"];
export interface WranglerAuthConfig {
    accessToken: string | null;
    expirationTime: string | null;
    path: string | null;
    rawText: string;
    refreshToken: string | null;
    scopes: string[];
}
export interface PendingWranglerAuthState {
    authUrl: string;
    clientId: string;
    codeVerifier: string;
    createdAt: number;
    redirectUri: string;
    scopes: string[];
    state: string;
    tokenUrl: string;
}
export interface CloudflareApiErrorShape {
    code?: number;
    message?: string;
}
export interface CloudflareUser {
    email: string | null;
    id: string | null;
    name: string | null;
}
export interface CloudflareAccount {
    id: string;
    name: string;
}
export interface CloudflareTokenVerification {
    expiresOn: string | null;
    id: string | null;
    notBefore: string | null;
    status: string | null;
}
export type CloudflareAuthHeaders = {
    apiToken: string;
} | {
    apiKey: string;
    email: string;
};
export declare function normalizeCloudflareApiBaseUrl(value?: string | null): string;
export declare function normalizeCloudflareAuthUrl(value?: string | null): string;
export declare function normalizeCloudflareTokenUrl(value?: string | null): string;
export declare function normalizeCloudflareRevokeUrl(value?: string | null): string;
export declare function readWranglerAuthConfig(vfs: VirtualFS): WranglerAuthConfig;
export declare function getPreferredWranglerAuthConfigPath(vfs: VirtualFS): string;
export declare function getPreferredWranglerPendingAuthPath(vfs: VirtualFS): string;
export declare function writeWranglerAuthConfig(vfs: VirtualFS, input: {
    accessToken: string;
    expirationTime?: string | null;
    refreshToken?: string | null;
    scopes?: readonly string[];
}): void;
export declare function deleteWranglerAuthConfig(vfs: VirtualFS): boolean;
export declare function writePendingWranglerAuthState(vfs: VirtualFS, state: PendingWranglerAuthState): void;
export declare function readPendingWranglerAuthState(vfs: VirtualFS): PendingWranglerAuthState | null;
export declare function deletePendingWranglerAuthState(vfs: VirtualFS): boolean;
export declare function prepareCloudflareAuthPopup(): Window | null;
export declare function cancelPreparedCloudflareAuthPopup(): void;
export declare function openCloudflareAuthWindow(url: string): void;
export declare function createWranglerPkcePair(): Promise<{
    codeChallenge: string;
    codeVerifier: string;
    state: string;
}>;
export declare function buildWranglerAuthorizationUrl(input: {
    authUrl: string;
    clientId: string;
    codeChallenge: string;
    scopes: readonly string[];
    state: string;
}): string;
export declare function exchangeWranglerAuthorizationCode(input: {
    clientId: string;
    code: string;
    codeVerifier: string;
    redirectUri?: string;
    tokenUrl: string;
}): Promise<{
    accessToken: string;
    expirationTime: string | null;
    refreshToken: string | null;
    scopes: string[];
}>;
export declare function refreshWranglerAccessToken(input: {
    clientId: string;
    refreshToken: string;
    tokenUrl: string;
}): Promise<{
    accessToken: string;
    expirationTime: string | null;
    refreshToken: string | null;
    scopes: string[];
}>;
export declare function revokeWranglerRefreshToken(input: {
    clientId: string;
    refreshToken: string;
    revokeUrl: string;
}): Promise<void>;
export declare function fetchCloudflareCurrentUser(apiBaseUrl: string, auth: CloudflareAuthHeaders): Promise<CloudflareUser>;
export declare function fetchCloudflareAccounts(apiBaseUrl: string, auth: CloudflareAuthHeaders): Promise<CloudflareAccount[]>;
export declare function verifyCloudflareUserApiToken(apiBaseUrl: string, apiToken: string): Promise<CloudflareTokenVerification>;
export declare function isWranglerAccessTokenExpired(config: WranglerAuthConfig): boolean;
//# sourceMappingURL=wrangler-auth.d.ts.map