UNPKG

@heroku-cli/command

Version:
60 lines (59 loc) 3.55 kB
import { LinuxHandler } from './credential-handlers/linux-handler.js'; import { MacOSHandler } from './credential-handlers/macos-handler.js'; import { WindowsHandler } from './credential-handlers/windows-handler.js'; import { CredentialStore } from './lib/credential-storage-selector.js'; import { AuthEntry } from './lib/types.js'; /** * Saves authentication credentials to the native credential store (if available) and .netrc file. * * @param account - User's account (email) * @param token - Authentication token * @param hosts - Hostname(s) for netrc storage (e.g., ['api.heroku.com']) * @param service - Service name (defaults to 'heroku-cli') * @returns Promise that resolves when credentials are saved */ export declare function saveAuth(account: string, token: string, hosts: string[], service?: string): Promise<void>; /** * Retrieves authentication credentials from the native credential store (if available) or .netrc file. * * @param account - User's account (email), or undefined to search for account * @param host - Hostname for netrc lookup (e.g., 'api.heroku.com') * @param service - Service name (defaults to 'heroku-cli') * @returns Promise that resolves with the authentication account and token. * @throws Error if no credentials are found in either location. */ export declare function getAuth(account: string | undefined, host: string, service?: string): Promise<AuthEntry>; /** * Lists all accounts stored in the native credential store for a given service. * * @param service - Service name (defaults to 'heroku-cli') * @returns Array of account names, or empty array if no native credential store is available */ export declare function listKeychainAccounts(service?: string): Promise<string[]>; /** * Removes authentication credentials from the platform native store (when present) and .netrc. * Uses {@link getNativeCredentialStore} so legacy HEROKU_NETRC_WRITE-only mode does not skip Keychain/vault cleanup after a mixed login. * * @param account - User's account (email), or undefined when using HEROKU_API_KEY only (native removal is skipped) * @param hosts - Hostname(s) for netrc storage (e.g., ['api.heroku.com']) * @param service - Service name (defaults to 'heroku-cli') * @returns Promise that resolves when credentials are removed */ export declare function removeAuth(account: string | undefined, hosts: string[], service?: string): Promise<void>; /** * Factory function to create the appropriate credential handler based on platform. * @private * @param store - The type of credential store to use * @returns A handler instance for the specified store */ export declare function getCredentialHandler(store: CredentialStore): LinuxHandler | MacOSHandler | WindowsHandler; export { LinuxHandler } from './credential-handlers/linux-handler.js'; export { MacOSHandler } from './credential-handlers/macos-handler.js'; export { NetrcHandler } from './credential-handlers/netrc-handler.js'; export { WindowsHandler } from './credential-handlers/windows-handler.js'; export { CredentialStore, getNativeCredentialStore, getStorageConfig } from './lib/credential-storage-selector.js'; export type { StorageConfig } from './lib/credential-storage-selector.js'; export { deleteLoginState, readLoginState, writeLoginState } from './lib/login-state.js'; export { Netrc, parse } from './lib/netrc-parser.js'; export type { Machines, MachinesWithTokens, MachineToken, Token, } from './lib/netrc-parser.js'; export type { AuthEntry, KeychainAuthEntry, NetrcAuthEntry } from './lib/types.js';