UNPKG

@heroku-cli/command

Version:
47 lines (46 loc) 1.92 kB
import { KeychainAuthEntry } from '../lib/types.js'; /** * Handles credential storage, removal, and retrieval using the macOS Keychain. * Uses the macOS security command-line tool to interact with the Keychain. */ export declare class MacOSHandler { private readonly scrubber; /** * Retrieves the authentication token from macOS Keychain. * @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 macOS Keychain 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 macOS Keychain. * @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 macOS Keychain. * If a credential with the same name 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; /** * 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; }