Documentation
¶
Index ¶
- Variables
- func Import(src string, key []byte) (export, error)
- type Configuration
- func (c *Configuration) AddProfile(p profile, overwrite bool) error
- func (c Configuration) Export(dst string, key []byte) error
- func (c *Configuration) FromYAML(b []byte) error
- func (c *Configuration) Key() security.Key
- func (c *Configuration) Load() error
- func (c *Configuration) NewProfile(name string, password []byte) (profile, error)
- func (c Configuration) Save() error
- func (c *Configuration) SetKey(key security.Key) error
- func (c *Configuration) SetProfile(id string) error
- func (c *Configuration) SetStorageKey(key security.Key) error
- func (c Configuration) StorageKey() security.Key
- func (c Configuration) StoragePath() string
- func (c Configuration) YAML() []byte
- type Option
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotFound = kr.ErrNotFound
)
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct {
ProfileID string `yaml:"profileId"`
Username string `yaml:"username"`
// contains filtered or unexported fields
}
Configuration for the application.
func Configure ¶
func Configure(options ...Option) (Configuration, error)
Configure creates and returns a Configuration. Several options can be provided to modify the behaviour.
func (*Configuration) AddProfile ¶ added in v0.3.0
func (c *Configuration) AddProfile(p profile, overwrite bool) error
AddProfile adds a profile to the configuration.
func (Configuration) Export ¶ added in v0.3.0
func (c Configuration) Export(dst string, key []byte) error
Export a configuration and profile
func (*Configuration) FromYAML ¶
func (c *Configuration) FromYAML(b []byte) error
FromYAML sets Configuration from yaml.
func (*Configuration) Load ¶
func (c *Configuration) Load() error
Load a Configuration from a yaml file.
func (*Configuration) NewProfile ¶ added in v0.3.0
func (c *Configuration) NewProfile(name string, password []byte) (profile, error)
NewProfile creates a new profile and generates a new storage key for it.
func (*Configuration) SetKey ¶
func (c *Configuration) SetKey(key security.Key) error
SetKey sets the key to the configuration.
func (*Configuration) SetProfile ¶ added in v0.3.0
func (c *Configuration) SetProfile(id string) error
SetPorofile sets profile on the configuration.
func (*Configuration) SetStorageKey ¶ added in v0.3.0
func (c *Configuration) SetStorageKey(key security.Key) error
SetStorageKey sets the storage key to the configuration.
func (Configuration) StorageKey ¶
func (c Configuration) StorageKey() security.Key
StorageKey returns the key for the storage file.
func (Configuration) StoragePath ¶
func (c Configuration) StoragePath() string
StoragePath returns the storage path of the key file.
func (Configuration) YAML ¶
func (c Configuration) YAML() []byte
YAML returns the YAML encoding of the Configuration.
type Option ¶
type Option func(c *Configuration)
Option sets options to the Configuration.
func WithProfile ¶ added in v0.3.0
WithProfile sets a profile to the Configuration.