Documentation
¶
Overview ¶
Package keyring provides password store functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("credential item not found") // ErrNotFound if an item was not found ErrEmptyFields = errors.New("credentials can't be empty") // ErrEmptyFields if fields are empty ErrEmptyPass = errors.New("passphrase can't be empty") // ErrEmptyPass if a passphrase is empty ErrKeyringMalformed = errors.New("the keyring is malformed") // ErrKeyringMalformed when keyring can't be read. )
Functions ¶
func RequestCredentialsFromTty ¶ added in v0.1.1
func RequestCredentialsFromTty(creds *CredentialsItem) error
RequestCredentialsFromTty gets credentials from tty.
Types ¶
type AskPassConstFlow ¶
type AskPassConstFlow string
AskPassConstFlow implements AskPass and returns constant.
func (AskPassConstFlow) GetPass ¶
func (a AskPassConstFlow) GetPass() (string, error)
GetPass implements AskPass interface.
func (AskPassConstFlow) NewPass ¶
func (a AskPassConstFlow) NewPass() (string, error)
NewPass implements AskPass interface.
type AskPassWithTerminal ¶
type AskPassWithTerminal struct{}
AskPassWithTerminal implements AskPass and uses tty to retrieve passphrase. @todo support pipe and stdin
func (AskPassWithTerminal) GetPass ¶
func (a AskPassWithTerminal) GetPass() (string, error)
GetPass implements AskPass interface.
func (AskPassWithTerminal) NewPass ¶
func (a AskPassWithTerminal) NewPass() (string, error)
NewPass implements AskPass interface.
type CredentialsFile ¶
type CredentialsFile interface {
io.ReadWriteCloser
// Open opens a file in FS with flag open options and perm for file permissions if the file is new.
// See os.OpenFile for more info about flag and perm arguments.
Open(flag int, perm os.FileMode) error
// Unlock decrypts a file if supported.
Unlock(new bool) error
// Lock makes it to request Unlock again.
Lock()
// Remove deletes a file from FS.
Remove() error
}
CredentialsFile is an interface to open and edit credentials file.
type CredentialsItem ¶
type CredentialsItem struct {
URL string `yaml:"url"`
Username string `yaml:"username"`
Password string `yaml:"password"`
}
CredentialsItem stores credentials.
type CredentialsStore ¶
type CredentialsStore interface {
// GetForURL returns a credentials item by a URL.
// Error is returned if either the keyring could not be unlocked
// Error ErrNotFound if the credentials were not found.
GetForURL(url string) (CredentialsItem, error)
// AddItem adds a new credential item.
// Error is returned if the vault couldn't be unlocked.
// Error ErrEmptyFields is returned if item is empty.
AddItem(CredentialsItem) error
// RemoveItem deletes an item by url.
// Error is returned if the vault couldn't be unlocked.
// Error ErrNotFound if the credentials were not found.
RemoveItem(url string) error
// Save saves the keyring to the persistent storage.
Save() error
// Destroy removes the keyring from the persistent storage.
Destroy() error
}
CredentialsStore provides password storage functionality.
type Keyring ¶
type Keyring interface {
launchr.Service
CredentialsStore
}
Keyring is a launchr.Service providing password store functionality.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is launchr plugin providing keyring.
func (*Plugin) CobraAddCommands ¶
CobraAddCommands implements launchr.CobraPlugin interface to provide keyring functionality.
func (*Plugin) PluginInfo ¶
func (p *Plugin) PluginInfo() launchr.PluginInfo
PluginInfo implements launchr.Plugin interface.