@heroku-cli/command
Version:
base class for Heroku CLI commands
41 lines (40 loc) • 1.62 kB
TypeScript
import { Netrc } from '../lib/netrc-parser.js';
import { NetrcAuthEntry } from '../lib/types.js';
export declare class NetrcHandler {
readonly netrc: Netrc;
/** @param file - Optional netrc path; otherwise uses the default location. */
constructor(file?: string);
/**
* Retrieves authentication credentials for a given host.
* @param host - The hostname to retrieve credentials for.
* @returns The authentication entry for the host, or undefined if not found.
*/
getAuth(host: string): Promise<{
[key: string]: string | undefined;
account?: string;
login?: string;
password?: string;
}>;
/**
* Removes authentication credentials for a given host.
* @param host - The hostname to remove credentials for.
* @returns A promise that resolves when the credentials are removed.
*/
removeAuth(host: string): Promise<void>;
/**
* Removes credentials for multiple hosts with a single netrc load/save.
*/
removeAuthForHosts(hosts: string[]): Promise<void>;
/**
* Saves authentication credentials for a given host.
* @param auth - The authentication entry containing login and password.
* @param host - The hostname to save credentials for.
* @returns A promise that resolves when the credentials are saved.
*/
saveAuth(auth: NetrcAuthEntry, host: string): Promise<void>;
/**
* Saves the same credentials for multiple hosts with a single netrc load/save.
*/
saveAuthForHosts(auth: NetrcAuthEntry, hosts: string[]): Promise<void>;
private applyAuthToHost;
}