import Cloudflare from "cloudflare";
interface BrandConfig {
    configDir: string;
    productName: string;
}
export declare function loadBrand(): BrandConfig;
export declare function findBinary(): string | null;
export declare function isInstalled(): boolean;
export declare function version(): string | null;
interface StoredToken {
    apiToken: string;
    accountId: string;
}
export declare function readToken(): StoredToken | null;
export declare function writeToken(apiToken: string, accountId: string): void;
export declare function hasToken(): boolean;
export declare function hasCert(): boolean;
interface CertCredentials {
    apiToken: string;
    accountId: string;
}
/**
 * Parse the ARGO TUNNEL TOKEN PEM block from cert.pem to extract
 * APIToken and AccountTag. Returns null if cert.pem is missing,
 * the token block is absent, or the format is unexpected.
 */
export declare function parseCertPem(): CertCredentials | null;
export declare function getClient(): {
    client: Cloudflare;
    accountId: string;
};
export interface TokenValidation {
    valid: boolean;
    accountId: string | null;
    accountName: string | null;
    error?: string;
}
export declare function validateToken(apiToken: string): Promise<TokenValidation>;
export interface AuthValidation {
    hasToken: boolean;
    tokenValid: boolean;
    error?: string;
}
export declare function validateAuth(): Promise<AuthValidation>;
export interface ZoneInfo {
    id: string;
    name: string;
    status: string;
    nameservers: string[];
    account: {
        id: string;
        name: string;
    };
}
export declare function listZones(): Promise<ZoneInfo[]>;
export declare function getZoneId(domain: string): Promise<string>;
export interface ZoneCreateResult {
    id: string;
    name: string;
    status: string;
    nameservers: string[];
    existing: boolean;
}
export declare function createZone(domain: string): Promise<ZoneCreateResult>;
export interface TunnelCreateResult {
    tunnelId: string;
    tunnelName: string;
}
export declare function createTunnel(name: string): Promise<TunnelCreateResult>;
export declare function configureTunnel(tunnelId: string, domain: string, port: number): Promise<void>;
interface IngressRule {
    hostname?: string;
    service: string;
}
export declare function getTunnelIngress(tunnelId: string): Promise<IngressRule[]>;
export declare function addHostnameToIngress(tunnelId: string, hostname: string, port?: number): Promise<{
    added: boolean;
    alreadyPresent: boolean;
}>;
export declare function fixIngressPort(tunnelId: string, expectedPort: number): Promise<{
    corrected: boolean;
    fromPort?: number;
}>;
export declare function loadAliasDomains(): Set<string>;
export declare function saveAliasDomain(hostname: string): void;
export declare function getConnectorToken(tunnelId: string): Promise<string>;
export declare function createDnsRecord(zoneId: string, subdomain: string, tunnelId: string): Promise<{
    created: boolean;
    existing: boolean;
    updated: boolean;
}>;
interface LoginState {
    pid: number;
    startedAt: number;
    authUrl: string;
    logPath: string;
}
export interface TunnelLoginResult {
    authUrl: string;
    alreadyRunning?: boolean;
}
/**
 * Returns the existing login state if a login process is still alive
 * and cert.pem hasn't been written yet (authorization in progress).
 */
export declare function getActiveLogin(): LoginState | null;
export declare function tunnelLogin(): Promise<TunnelLoginResult>;
export declare function getPersistedTunnelId(): string | null;
export declare function getPersistedDomain(): string | null;
export interface TunnelStatus {
    installed: boolean;
    version: string | null;
    hasCert: boolean;
    hasToken: boolean;
    tokenValid: boolean | null;
    authError: string | null;
    running: boolean;
    pid: number | null;
    tunnelId: string | null;
    domain: string | null;
    adminUrl: string | null;
    publicUrl: string | null;
    upSince: number | null;
    restartCount: number;
}
export declare function getStatus(domain?: string): Promise<TunnelStatus>;
export declare function startTunnel(connectorToken: string, tunnelId: string, domain: string): void;
export declare function stopTunnel(): void;
export {};
//# sourceMappingURL=cloudflared.d.ts.map