Documentation
¶
Index ¶
- Variables
- func SetLogger(l Logger)
- type Auth
- type Item
- func (i *Item) Marshal(secretKey SecretKey) ([]byte, error)
- func (i *Item) Secret() *Secret
- func (i *Item) SecretData() []byte
- func (i *Item) SecretDataFor(name string) []byte
- func (i *Item) SecretFor(name string) *Secret
- func (i *Item) SetSecret(val Secret)
- func (i *Item) SetSecretFor(name string, val Secret)
- type Keyring
- type ListOpts
- type Logger
- type Secret
- type SecretKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidAuth = errors.New("invalid keyring auth")
ErrInvalidAuth if auth is invalid.
View Source
var ErrLocked = errors.New("keyring is locked")
ErrLocked if no keyring key is set.
View Source
var ErrNotAnItem = errors.New("not an encoded keyring item")
ErrNotAnItem if value in keyring is not an encoded keyring item. TODO: Add test.
Functions ¶
Types ¶
type Item ¶
Item is a keyring entry.
func DecodeItem ¶
DecodeItem returns Item from bytes. If encrypted and secret key is specified, it will have the decrypted data and will return (*Item, true, nil).
func (*Item) SetSecretFor ¶
SetSecretFor sets a named secret.
type Keyring ¶
type Keyring interface { // Get item. // Requires Unlock(). Get(id string) (*Item, error) // Set item. // Requires Unlock(). Set(i *Item) error // Delete item. // Doesn't require Unlock(). Delete(id string) (bool, error) // List items. // Requires Unlock(). // Items with ids that start with "." are not returned by List. List(opts *ListOpts) ([]*Item, error) // IDs. // Doesn't require Unlock(). // Items with ids that start with "." are not returned by IDs. IDs(prefix string) ([]string, error) // Exists returns true it has the id. // Doesn't require Unlock(). Exists(id string) (bool, error) // Unlock with auth. Unlock(auth Auth) error // Lock. Lock() error // Salt is default salt value, generated on first access and persisted // until ResetAuth() or Reset(). // This salt value is not encrypted in the keyring. // Doesn't require Unlock(). Salt() ([]byte, error) // Authed returns true if Keyring has ever been unlocked. // Doesn't require Unlock(). Authed() (bool, error) // Reset keyring. // Doesn't require Unlock(). Reset() error }
Keyring defines an interface for accessing keyring items.
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
Logger interface used in this package
type Secret ¶
type Secret struct {
Data []byte `json:"data"`
}
Secret for item.
func NewStringSecret ¶
NewStringSecret returns a new secret for a string.
Click to show internal directories.
Click to hide internal directories.