Documentation ¶
Overview ¶
Package passwordpersist manages password persistence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPasswordNotFound = errors.Errorf("password not found")
ErrPasswordNotFound is returned when a password cannot be found in a persistent storage.
var ErrUnsupported = errors.Errorf("password storage not supported")
ErrUnsupported is returned when a password storage is not supported.
Functions ¶
Types ¶
type Multiple ¶
type Multiple []Strategy
Multiple is a Strategy that tries several underlying persistence strategies.
func (Multiple) DeletePassword ¶
DeletePassword deletes the password from all persistent storages.
func (Multiple) GetPassword ¶
GetPassword retrieves the password form the first password storage that has it.
type Strategy ¶
type Strategy interface { // GetPassword gets persisted password, returns ErrNotFound or fatal errors. GetPassword(ctx context.Context, configFile string) (string, error) // PersistPassword persists a password, returns ErrUnsupported or fatal errors. PersistPassword(ctx context.Context, configFile, password string) error // DeletePassword deletes any persisted password, returns fatal errors. DeletePassword(ctx context.Context, configFile string) error }
Strategy encapsulates persisting and fetching passwords.
var File Strategy = filePasswordStorage{}
File is a Strategy that persists the base64-encoded password in a file next to repository config file.
var Keyring Strategy = keyringStrategy{}
Keyring is a Strategy that persists the password in OS-specific keyring.
var None Strategy = noneStrategy{}
None is a strategy that does not persist the password at all.