Documentation
¶
Overview ¶
Package keyring provides password store functionality.
Index ¶
- Variables
- func RequestCredentialsFromTty(creds *CredentialsItem) error
- func RequestKeyValueFromTty(item *KeyValueItem) error
- type AskPass
- type AskPassConstFlow
- type AskPassWithTerminal
- type CredentialsFile
- type CredentialsItem
- type DataStore
- type GetKeyValueProcessorOptions
- type KeyValueItem
- type Keyring
- type Plugin
- type SecretItem
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("item not found") // ErrNotFound if an item was not found ErrEmptyFields = errors.New("item 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. )
Keyring errors.
Functions ¶
func RequestCredentialsFromTty ¶ added in v0.1.1
func RequestCredentialsFromTty(creds *CredentialsItem) error
RequestCredentialsFromTty gets credentials from tty.
func RequestKeyValueFromTty ¶ added in v0.2.0
func RequestKeyValueFromTty(item *KeyValueItem) error
RequestKeyValueFromTty gets key-value pair 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(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 DataStore ¶ added in v0.2.0
type DataStore 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) // GetForKey returns a key-value item by a key. // Error is returned if either the keyring could not be unlocked // Error ErrNotFound if the key was not found. GetForKey(key string) (KeyValueItem, 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(SecretItem) error // RemoveByURL deletes an item by url. // Error is returned if the vault couldn't be unlocked. // Error ErrNotFound if the credentials were not found. RemoveByURL(url string) error // RemoveByKey deletes an item by key. // Error is returned if the vault couldn't be unlocked. // Error ErrNotFound if the credentials were not found. RemoveByKey(key string) error // CleanStorage cleanups storage (credentials or key-value). // Error is returned if the vault couldn't be unlocked. CleanStorage(item SecretItem) error // Exists checks if keyring exists in persistent storage. Exists() bool // Save saves the keyring to the persistent storage. Save() error // Destroy removes the keyring from the persistent storage. Destroy() error }
DataStore provides password storage functionality.
type GetKeyValueProcessorOptions ¶ added in v0.3.1
type GetKeyValueProcessorOptions = *action.GenericValueProcessorOptions[struct { Key string `yaml:"key" validate:"not-empty"` }]
GetKeyValueProcessorOptions is a action.ValueProcessorOptions struct.
type KeyValueItem ¶ added in v0.2.0
KeyValueItem stores key-value pair.
type Keyring ¶
Keyring is a launchr.Service providing password store functionality.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is launchr.Plugin plugin providing a keyring.
func (*Plugin) CobraAddCommands ¶
CobraAddCommands implements launchr.CobraPlugin interface to provide keyring functionality.
func (*Plugin) DiscoverActions ¶ added in v0.3.0
DiscoverActions implements launchr.ActionDiscoveryPlugin interface.
func (*Plugin) OnAppInit ¶ added in v0.1.0
OnAppInit implements launchr.Plugin interface.
func (*Plugin) PluginInfo ¶
func (p *Plugin) PluginInfo() launchr.PluginInfo
PluginInfo implements launchr.Plugin interface.
type SecretItem ¶ added in v0.2.0
type SecretItem interface {
// contains filtered or unexported methods
}
SecretItem is an interface that represents an item saved in a storage. It is used in the DataStore interface for adding and manipulating items.