Documentation
¶
Overview ¶
Package store is the facade over a password store: it binds the on-disk tree to the crypto backends and the secret format.
A store may hold GPG and age entries side by side. The backend for an existing entry follows its file extension; the backend for a new entry follows the store's configured default.
Index ¶
- Variables
- type Match
- type Options
- type Store
- func (s *Store) Copy(from, to string) error
- func (s *Store) Dir() string
- func (s *Store) Exists(name string) bool
- func (s *Store) Find(terms []string) ([]string, error)
- func (s *Store) Get(name string) (*secret.Secret, error)
- func (s *Store) Grep(sub string, match func(string) bool) ([]Match, error)
- func (s *Store) Init(sub string, rcp []crypto.Recipient) error
- func (s *Store) Initialised() bool
- func (s *Store) IsDir(name string) bool
- func (s *Store) List(sub string) ([]string, error)
- func (s *Store) Move(from, to string) error
- func (s *Store) Recipients(name string) ([]crypto.Recipient, error)
- func (s *Store) Reencrypt(sub string, to crypto.Crypto) error
- func (s *Store) Remove(name string) error
- func (s *Store) RemoveDir(name string) error
- func (s *Store) Set(name string, sec *secret.Secret) error
- func (s *Store) SetNew(name string, sec *secret.Secret) error
Constants ¶
This section is empty.
Variables ¶
var ErrExists = errors.New("store: entry already exists")
ErrExists reports a refusal to overwrite an existing entry.
var ErrNotFound = errors.New("store: entry not found")
ErrNotFound reports that an entry does not exist.
var ErrNotInitialised = errors.New("store: not initialised")
ErrNotInitialised reports a store with no recipients file at its root.
Functions ¶
This section is empty.
Types ¶
type Match ¶
type Match struct {
// Name is the entry name.
Name string
// Lines are the matching plaintext lines.
Lines []string
}
Match is one entry containing lines that satisfied a Grep.
type Options ¶
type Options struct {
// Dir is the store root.
Dir string
// Backends are the crypto implementations to support, in lookup order.
Backends []crypto.Crypto
// Default is the backend for new entries; it must be one of Backends.
Default crypto.Crypto
// Umask masks created file permissions; zero means pass's 077.
Umask os.FileMode
}
Options configures a Store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a password store bound to a directory and its crypto backends.
func (*Store) Find ¶
Find returns the names of entries whose path contains any of the terms, case-insensitively.
func (*Store) Grep ¶
Grep decrypts every entry under sub and reports those whose plaintext satisfies match.
func (*Store) Init ¶
Init writes the recipients file for sub (empty for the store root) using the default backend, creating the store directory if needed.
func (*Store) Initialised ¶
Initialised reports whether the store root carries a recipients file for any configured backend.
func (*Store) Move ¶
Move renames an entry or a subfolder. Entries whose recipients change as a result are re-encrypted, since a move into a differently shared subtree would otherwise leave a secret readable by the wrong people.
func (*Store) Recipients ¶
Recipients returns the recipients governing name for its backend.
func (*Store) Reencrypt ¶
Reencrypt rewrites every entry under sub for its current recipients. It is how a recipient change takes effect, and how migration between backends is carried out when to is non-nil.