/**
 * GitHub authentication manager using OAuth device flow
 * Handles authentication for MCP servers without requiring client secrets
 */
import { APICache } from '../cache/APICache.js';
export interface DeviceCodeResponse {
    device_code: string;
    user_code: string;
    verification_uri: string;
    expires_in: number;
    interval: number;
}
export interface TokenResponse {
    access_token: string;
    token_type: string;
    scope: string;
}
export interface AuthStatus {
    isAuthenticated: boolean;
    hasToken: boolean;
    username?: string;
    scopes?: string[];
    expiresAt?: Date;
}
/**
 * Manages GitHub authentication using the OAuth device flow
 * This is the recommended approach for CLI/desktop applications
 */
export declare class GitHubAuthManager {
    private static readonly CLIENT_ID;
    private static readonly DEVICE_CODE_URL;
    private static readonly TOKEN_URL;
    private static readonly USER_URL;
    private static readonly DEFAULT_POLL_INTERVAL;
    private static readonly MAX_POLL_ATTEMPTS;
    private apiCache;
    private activePolling;
    constructor(apiCache: APICache);
    /**
     * Execute a network request with retry logic
     */
    private fetchWithRetry;
    /**
     * Check current authentication status
     */
    getAuthStatus(): Promise<AuthStatus>;
    /**
     * Initiate the device flow authentication process
     */
    initiateDeviceFlow(): Promise<DeviceCodeResponse>;
    /**
     * Poll for token after user has authorized the device
     */
    pollForToken(deviceCode: string, interval?: number): Promise<TokenResponse>;
    /**
     * Complete the authentication flow and store the token
     */
    completeAuthentication(tokenResponse: TokenResponse): Promise<AuthStatus>;
    /**
     * Clear stored authentication and revoke token
     */
    clearAuthentication(): Promise<void>;
    /**
     * Store token securely using encrypted file storage
     */
    private storeToken;
    /**
     * Fetch user information from GitHub
     */
    private fetchUserInfo;
    /**
     * Format authentication instructions for users
     */
    formatAuthInstructions(deviceResponse: DeviceCodeResponse): string;
    /**
     * Check if user needs to authenticate for a specific action
     */
    needsAuthForAction(action: string): boolean;
    /**
     * Wait with abort signal support
     */
    private waitWithAbort;
    /**
     * Clean up any active operations (called on server shutdown)
     */
    cleanup(): Promise<void>;
    /**
     * Get user-friendly error message based on HTTP status code
     * Avoids exposing sensitive information while providing helpful guidance
     */
    private getErrorMessageForStatus;
}
//# sourceMappingURL=GitHubAuthManager.d.ts.map