Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Improve Credential Errors #223

Merged
merged 16 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/secrethub/credentials/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
ErrCannotDecodeCredentialPayload = errCredentials.Code("invalid_credential_header").ErrorPref("cannot decode credential payload: %v")
ErrCannotDecodeEncryptedCredential = errCredentials.Code("cannot_decode_encrypted_credential").Error("cannot decode an encrypted credential without a key")
ErrCannotDecryptCredential = errCredentials.Code("cannot_decrypt_credential").Error("passphrase is incorrect")
ErrNeedPassphrase = errCredentials.Code("credential_passphrase_required").Error("default credential is password-protected. Configure the client to use service credential by provisioning one through the SECRETHUB_CREDENTIAL environment variable")
Marton6 marked this conversation as resolved.
Show resolved Hide resolved
ErrMalformedCredential = errCredentials.Code("malformed_credential").ErrorPref("credential is malformed: %v")
ErrInvalidKey = errCredentials.Code("invalid_key").Error("the given key is not valid for the encryption algorithm")
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/secrethub/credentials/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func ImportKey(credentialReader, passphraseReader Reader) (Key, error) {
}
if encoded.IsEncrypted() {
if passphraseReader == nil {
return Key{}, errors.New("need passphrase")
return Key{}, ErrNeedPassphrase
}

// Try up to three times to get the correct passphrase.
Expand Down