Documentation
¶
Overview ¶
Package storage is the on-disk layout of a password store: name-to-path mapping, tree walking, and durable writes.
The layout is byte-identical to pass. A store is a plain directory tree, an entry is a file named after the entry plus a crypto extension, and nothing binpass-specific is ever written into it.
Index ¶
- Variables
- type Entry
- type FS
- func (f *FS) DirPath(name string) (string, error)
- func (f *FS) Entries(name string, exts []string) ([]Entry, error)
- func (f *FS) Find(name string, exts []string) (string, error)
- func (f *FS) IsDir(name string) bool
- func (f *FS) MkdirAll(path string) error
- func (f *FS) Name(path string) (string, error)
- func (f *FS) Path(name, ext string) (string, error)
- func (f *FS) Read(path string) ([]byte, error)
- func (f *FS) Remove(path string) error
- func (f *FS) Rename(from, to string) error
- func (f *FS) Write(path string, data []byte) error
- func (f *FS) WriteFrom(path string, produce func(io.Writer) error) error
Constants ¶
This section is empty.
Variables ¶
var ErrOutsideStore = errors.New("storage: path escapes the store")
ErrOutsideStore reports a name that escapes the store root.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// Name is the slash-separated store name, without extension.
Name string
// Path is the absolute file path.
Path string
// Ext is the crypto extension, including the dot.
Ext string
}
Entry is one secret found in the store.
type FS ¶
type FS struct {
// Dir is the absolute store root.
Dir string
// Umask masks the permissions of created files and directories,
// honouring PASSWORD_STORE_UMASK.
Umask os.FileMode
}
FS is a store rooted at a directory.
func (*FS) Entries ¶
Entries walks the subtree rooted at name and returns its entries, sorted by name. Dotfiles and dot-directories are skipped, matching pass, which keeps .git, .gpg-id and .binpass out of listings.
func (*FS) Find ¶
Find returns the path of the entry called name, whatever its crypto extension, preferring exts in the order given. It reports fs.ErrNotExist when no candidate exists.
func (*FS) Name ¶
Name converts an absolute entry path back into a store name, stripping the crypto extension. The result always uses forward slashes.
func (*FS) Path ¶
Path returns the absolute path of an entry name with the given extension. Names are slash-separated and relative to the store root.
func (*FS) Remove ¶
Remove deletes an entry file and then prunes the directories it leaves empty, up to the store root, exactly as pass does.
func (*FS) Rename ¶
Rename moves an entry, creating the destination directory and pruning any directories the move empties.