Documentation
¶
Index ¶
- Constants
- type Account
- type BackendError
- type FileBackend
- func (s *FileBackend) AddNamespace(ns *Namespace) (*Namespace, error)
- func (s *FileBackend) Decrypt() error
- func (s *FileBackend) DeleteNamespace(namespace *Namespace)
- func (s *FileBackend) FindNamespace(name string) (*Namespace, error)
- func (s *FileBackend) ListNamespaces() []*Namespace
- func (s *FileBackend) Prepare() error
- func (s *FileBackend) Save() error
- func (s *FileBackend) SetPassword(password string)
- type Namespace
- type NotFoundError
- type Storage
Constants ¶
const DefaultTokenLength = 6
DefaultTokenLength defines what is the default length of the generated token. Most services are using 6 characters.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendError ¶
type BackendError struct {
Message string
}
BackendError is an error to tell the user something went wrong processing the backend storage.
func (BackendError) Error ¶
func (e BackendError) Error() string
type FileBackend ¶
type FileBackend struct {
// contains filtered or unexported fields
}
FileBackend structure represents the credential storage.
func NewFileStorage ¶
func NewFileStorage() *FileBackend
NewFileStorage creates a new File Backend Storage.
func (*FileBackend) AddNamespace ¶
func (s *FileBackend) AddNamespace(ns *Namespace) (*Namespace, error)
AddNamespace adds a namespace to the namespace list if it's not already there.
func (*FileBackend) Decrypt ¶
func (s *FileBackend) Decrypt() error
Decrypt tries to decrypt the storage.
func (*FileBackend) DeleteNamespace ¶
func (s *FileBackend) DeleteNamespace(namespace *Namespace)
DeleteNamespace removes a specific namespace from the fileStorage.
func (*FileBackend) FindNamespace ¶
func (s *FileBackend) FindNamespace(name string) (*Namespace, error)
FindNamespace returns with a namespace if the namespace does not exist error is not nil.
func (*FileBackend) ListNamespaces ¶
func (s *FileBackend) ListNamespaces() []*Namespace
ListNamespaces returns with all the namespaces defined in the storage.
func (*FileBackend) Prepare ¶
func (s *FileBackend) Prepare() error
Prepare tries to load the credentials file and tries to decrypt it.
func (*FileBackend) Save ¶
func (s *FileBackend) Save() error
Save tries to encrypt and save the storage.
func (*FileBackend) SetPassword ¶
func (s *FileBackend) SetPassword(password string)
SetPassword sets the password for the file storage.
type Namespace ¶
Namespace represents a Namespace "category".
func (*Namespace) DeleteAccount ¶
DeleteAccount removes a specific Account from the Namespace.
type NotFoundError ¶
NotFoundError is an error to tell the user the requested entity is not there.
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type Storage ¶
type Storage interface { SetPassword(password string) Prepare() error Decrypt() error FindNamespace(namespace string) (*Namespace, error) DeleteNamespace(namespace *Namespace) AddNamespace(namespace *Namespace) (*Namespace, error) ListNamespaces() []*Namespace Save() error }
Storage is an interface that describes a storage backend.