/** * Sudo Password Manager - handles sudo password caching and prompting * * This module provides a singleton manager for sudo passwords, allowing * bash commands to run with sudo privileges by prompting the user for * their password when needed. */ import { EventEmitter } from 'node:events'; declare class SudoPasswordManager extends EventEmitter { private cachedPassword; private passwordValidUntil; private readonly CACHE_DURATION_MS; private pendingRequest; /** * Get the cached sudo password if still valid. * Falls back to VIGIL_SUDO_PASSWORD or SUDO_PASSWORD env var * when no cached password exists. */ getCachedPassword(): string | null; /** * Cache a sudo password */ cachePassword(password: string): void; /** * Invalidate the cached password (e.g., if sudo fails) */ invalidatePassword(): void; /** * Request a sudo password - emits 'password-needed' event * Returns the password or null if cancelled */ requestPassword(): Promise; /** * Provide the password in response to a 'password-needed' event */ providePassword(password: string | null): void; /** * Cancel the pending password request */ cancelRequest(): void; /** * Check if there's a pending password request */ hasPendingRequest(): boolean; } export declare const sudoPasswordManager: SudoPasswordManager; export declare function getSudoPassword(): Promise; export declare function setCachedSudoPassword(password: string): void; export declare function invalidateSudoPassword(): void; export declare function onSudoPasswordNeeded(callback: () => void): void; export declare function offSudoPasswordNeeded(callback: () => void): void; export declare function provideSudoPassword(password: string | null): void; export {}; //# sourceMappingURL=sudoPasswordManager.d.ts.map