UNPKG

@heroku-cli/command

Version:
60 lines (59 loc) • 2.65 kB
import { KeychainAuthEntry } from '../lib/types.js'; export declare function createChildEnvironment(): NodeJS.ProcessEnv; /** * Handles credentials in the Linux Secret Service. * Uses D-Bus for metadata searches and secret-tool (libsecret) to retrieve and mutate secrets. */ 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 searching or retrieving the token fails, or no matching item exists. */ getAuth(account: string, service: string): string; /** * Retrieves the authentication token from the Linux keyring when a matching item exists. * @param account - The account login to use (e.g. 'test@example.com') * @param service - The service name to use * @returns The stored authentication token, or undefined if no matching item exists. * @throws Error if searching or retrieving the token fails. */ getAuthIfAvailable(account: string, service: string): string | undefined; /** * 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; }