Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DefaultCredentialManager

Default Credential Manager is our implementation of the Imperative Credential Manager. This manager invokes methods created by the keytar utility (https://www.npmjs.com/package/keytar) to access the secure credential vault on the user's machine.

Keychains Used by Keytar

OS Vault
Windows Credential Vault
macOS Keychain
Linux Secret Sevice API/libsecret

Keytar must be installed by the app using imperative (like zowe-cli).

On Linux, Keytar will not work out of the box without some additional configuration to install libsecret. Keytar provides the following documentation for Linux users to install libsecret:


Depending on your distribution, you will need to run the following command:

  • Debian/Ubuntu: sudo apt-get install libsecret-1-dev
  • Red Hat-based: sudo yum install libsecret-devel
  • Arch Linux: sudo pacman -S libsecret

Hierarchy

Index

Constructors

constructor

Properties

Private Readonly WIN32_CRED_MAX_STRING_LENGTH

WIN32_CRED_MAX_STRING_LENGTH: 2560 = 2560

Maximum credential length allowed by Windows 7 and newer.

We don't support older versions of Windows where the limit is 512 bytes.

Private allServices

allServices: string[]

Combined list of services that the plugin will go through

Private keytar

keytar: typeof keytar

Reference to the lazily loaded keytar module.

Private loadError

loadError: ImperativeError

Errors that occurred while loading keytar will be stored in here.

Every method of this class should call the checkForKeytar method before proceeding. It is this method that will check for keytar and throw this error if it was detected that keytar wasn't loaded.

Protected Readonly service

service: string

The service that the Credential Manager is running under. Imperative will set this to the cliName

Static Readonly SVC_NAME

SVC_NAME: "Zowe" = "Zowe"

The service name for our built-in credential manager.

Accessors

Private defaultService

  • get defaultService(): string

name

  • get name(): string

Protected possibleSolutions

  • get possibleSolutions(): string[]

Methods

Private checkForKeytar

  • checkForKeytar(): void
  • This function is called before the {@link deletePassword}, {@link getPassword}, and {@link setPassword} functions. It will check if keytar is not null and will throw an error if it is.

    The error thrown will be the contents of loadError or a new ImperativeError. The former error will be the most common one as we expect failures during the load since keytar is optional. The latter error will indicate that some unknown condition has happened so we will create a new ImperativeError with the report suppressed. The report is suppressed because it may be possible that a detailed report could capture a username and password, which would probably be a bad thing.

    throws

    ImperativeError when keytar is null or undefined.

    Returns void

delete

  • delete(account: string): Promise<void>

Protected deleteCredentials

  • deleteCredentials(account: string): Promise<void>

Private deleteCredentialsHelper

  • deleteCredentialsHelper(account: string, keepCurrentSvc?: boolean): Promise<boolean>

Private getCredentialsHelper

Private getMissingEntryMessage

  • getMissingEntryMessage(account: string): string

initialize

load

  • load(account: string, optional?: boolean): Promise<string>

Protected loadCredentials

save

  • save(account: string, secureValue: string): Promise<void>

Protected saveCredentials

secureErrorDetails

  • secureErrorDetails(): string | undefined

Private setCredentialsHelper

Generated using TypeDoc