@heroku-cli/command
Version:
base class for Heroku CLI commands
51 lines (50 loc) • 2.14 kB
TypeScript
import { KeychainAuthEntry } from '../lib/types.js';
/**
* Handles credential storage, removal, and retrieval using the Linux Secret Service API.
* Uses the secret-tool command-line utility (part of libsecret) to interact with desktop keyrings.
*/
export declare class LinuxHandler {
private readonly scrubber;
/**
* Retrieves the authentication token from the Linux keyring.
* @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 the Linux keyring 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 the Linux keyring.
* @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 the Linux keyring.
* If a credential with the same attributes already exists, it is updated with the new token.
* @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;
/**
* secret-tool clear fails when no matching credential exists; treat as successful no-op for logout.
*/
private isMissingSecretClearFailure;
/**
* 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;
}