/**
 * Token Manager for CLIProxyAPI
 *
 * Handles OAuth token storage, retrieval, and validation.
 * Tokens are stored in ~/.ccs/cliproxy/auth/ directory.
 */
import { CLIProxyProvider } from '../types';
import { AuthStatus } from './auth-types';
/**
 * Get token directory for provider
 */
export declare function getProviderTokenDir(provider: CLIProxyProvider): string;
/**
 * Check if a JSON file contains a token for the given provider
 * Reads the file and checks the "type" field
 */
export declare function isTokenFileForProvider(filePath: string, provider: CLIProxyProvider): boolean;
export type ProviderTokenSnapshot = {
    file: string;
    mtimeMs: number;
    accountId?: string;
    fingerprint?: string;
};
export declare function listProviderTokenSnapshots(provider: CLIProxyProvider, tokenDir?: string): ProviderTokenSnapshot[];
export declare function findNewTokenSnapshot(currentTokenFiles: ProviderTokenSnapshot[], knownTokenFiles: ProviderTokenSnapshot[], expectedAccountId?: string): ProviderTokenSnapshot | null;
export declare function findNewTokenSnapshotForAuthAttempt(provider: CLIProxyProvider, tokenDir: string, knownTokenFiles: ProviderTokenSnapshot[], expectedAccountId?: string): ProviderTokenSnapshot | null;
/**
 * Check if provider has valid authentication
 * CLIProxyAPI stores OAuth tokens as JSON files in the auth directory.
 * Detection strategy:
 * 1. First check by filename prefix (fast path)
 * 2. If no match, check JSON content for "type" field (Gemini uses {email}-{projectID}.json without prefix)
 */
export declare function isAuthenticated(provider: CLIProxyProvider): boolean;
/**
 * Get detailed auth status for provider
 * Uses same detection strategy as isAuthenticated: prefix first, then content
 */
export declare function getAuthStatus(provider: CLIProxyProvider): AuthStatus;
/**
 * Get auth status for all providers
 */
export declare function getAllAuthStatus(): AuthStatus[];
/**
 * Clear authentication for provider
 * Only removes files belonging to the specified provider (by prefix or content)
 * Does NOT remove the shared auth directory or other providers' files
 */
export declare function clearAuth(provider: CLIProxyProvider): boolean;
/**
 * Register account from newly created token file
 * Scans auth directory for new token and extracts email
 * @param provider - The CLIProxy provider
 * @param tokenDir - Directory containing token files
 * @param nickname - Optional nickname (uses auto-generated from email if not provided)
 */
export declare function registerAccountFromToken(provider: CLIProxyProvider, tokenDir: string, nickname?: string, verbose?: boolean, expectedAccountId?: string): import('../accounts/account-manager').AccountInfo | null;
/**
 * Display auth status for all providers
 */
export declare function displayAuthStatus(): void;
/**
 * Ensure OAuth token is valid for provider, refreshing if expired or expiring soon.
 * This prevents UND_ERR_SOCKET errors caused by expired tokens during API calls.
 *
 * Refresh responsibility:
 * - gemini: CCS refreshes directly via Google OAuth
 * - codex, agy, kiro, ghcp, qwen, iflow: CLIProxyAPIPlus handles refresh
 *   automatically in background (e.g. kiro refreshes every 1 min).
 *   CCS only checks if token file exists (authentication state).
 * - claude: not yet implemented
 *
 * @param provider The CLIProxy provider
 * @param verbose Log progress if true
 * @returns Object with valid status and whether refresh occurred
 */
export declare function ensureTokenValid(provider: CLIProxyProvider, _verbose?: boolean): Promise<{
    valid: boolean;
    refreshed: boolean;
    error?: string;
}>;
//# sourceMappingURL=token-manager.d.ts.map