@heroku-cli/command
Version:
base class for Heroku CLI commands
51 lines (50 loc) • 2.15 kB
TypeScript
import { KeychainAuthEntry } from '../lib/types.js';
/**
* Handles credential storage and retrieval using the Windows Credential Manager.
* Uses PowerShell commands to interact with the Windows.Security.Credentials.PasswordVault API.
*/
export declare class WindowsHandler {
private readonly scrubber;
/**
* Retrieves the authentication token from Windows Credential Manager.
* @param account - The account login to use (e.g. 'test@example.com')
* @param service - The service name to use
* @returns The stored authentication token.
* @throws Error if the token is not found or retrieval fails.
*/
getAuth(account: string, service: string): string;
/**
* Lists all accounts stored in Windows Credential Manager for a given service.
* @param service - The service name to search for
* @returns Array of account names found for the service
* @throws Error if the search operation fails
*/
listAccounts(service: string): string[];
/**
* Removes the authentication token from Windows Credential Manager.
* @param account - The account login to use (e.g. 'test@example.com')
* @param service - The service name to use
* @returns void
* @throws Error if the removal operation fails.
*/
removeAuth(account: string, service: string): void;
/**
* Saves an authentication entry to Windows Credential Manager.
* If a credential with the same name already exists, it is removed before saving the new one.
* @param auth - The authentication entry containing account and token information to store.
* @returns void
* @throws Error if the save operation fails.
*/
saveAuth(auth: KeychainAuthEntry): void;
/**
* PasswordVault.Retrieve throws when the credential is absent (e.g. netrc-only login).
*/
private isMissingVaultCredential;
/**
* Scrubs account names and passwords/tokens from error messages.
*
* @param message - The error message to scrub
* @returns The scrubbed error message with sensitive data replaced by "[SCRUBBED]"
*/
private scrubError;
}