import { TokenData } from '../types';
/**
 * Authentication service for OAuth flows
 */
export declare class AuthService {
    private static instance;
    private constructor();
    static getInstance(): AuthService;
    /**
     * Open URL in the user's default browser. Cross-platform: macOS, Linux,
     * WSL, Windows. Always prints the URL to stdout first as a fallback —
     * if no browser-opening command is available, the user can copy-paste.
     *
     * On WSL, prefers opening the Windows host browser via WSL interop
     * (wslview → cmd.exe → powershell.exe) before falling back to xdg-open.
     */
    private openBrowser;
    /**
     * Returns the list of browser-opening commands to try in order, based on
     * the current platform. On WSL, returns WSL interop commands first so the
     * Windows browser opens (which is what users actually want on WSL).
     */
    private getBrowserCommands;
    /**
     * Detect whether we're running inside WSL (1 or 2). Returns false on
     * any non-Linux platform or if /proc/sys/kernel/osrelease is not readable.
     */
    private isRunningInWSL;
    /**
     * Try each browser-opening command in order. Advances to the next fallback on:
     *   - Spawn failure (ENOENT / the command not being installed)
     *   - Synchronous throw from spawn()
     *   - Runtime failure where the command spawns but exits with a non-zero
     *     code (e.g. wslview when WSL interop is disabled, xdg-open when no
     *     default browser is registered, cmd.exe failing to launch start)
     *   - Process terminated by signal
     *
     * Stays on the current command when:
     *   - Process exits with code 0 (success)
     *   - Process is still running after 3 seconds (assumed success — opener
     *     is doing real work like launching a slow app, not hung)
     *
     * If all attempts exhaust, logs at debug level — the user still has the
     * sign-in URL printed to stdout as a copy-paste fallback.
     */
    private tryBrowserCommand;
    /**
     * Generate state for CSRF protection
     */
    private generateState;
    /**
     * Build authorization URL
     */
    private buildAuthUrl;
    /**
     * Exchange authorization code for tokens
     */
    private exchangeCodeForTokens;
    /**
     * Decode JWT payload
     */
    private decodeJwt;
    /**
     * Refresh tokens
     */
    refreshTokens(refreshToken: string): Promise<{
        accessToken: string;
        idToken: string;
        expiresIn: number;
    }>;
    /**
     * Login via OAuth browser flow
     */
    login(): Promise<TokenData | null>;
    /**
     * Logout
     */
    logout(): Promise<boolean>;
    /**
     * Get current auth status
     */
    getStatus(): Promise<{
        authenticated: boolean;
        tokens?: TokenData;
    }>;
}
export declare const authService: AuthService;
