Documentation
¶
Index ¶
- Constants
- func DBPath() (string, error)
- type Entry
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(key string) error
- func (s *Store) Get(key string) (*Entry, error)
- func (s *Store) GetCanary() (*Entry, error)
- func (s *Store) GetHint() (string, error)
- func (s *Store) IsInitialized() (bool, error)
- func (s *Store) List() ([]Entry, error)
- func (s *Store) Save(key string, value []byte, force bool) error
- func (s *Store) SaveCanary(value, salt, nonce []byte) error
- func (s *Store) SaveHint(hint string) error
- func (s *Store) SaveSecure(key string, value, salt, nonce []byte, force bool) error
Constants ¶
const ( // CanaryKey is the reserved key for the master-password validation record. CanaryKey = "__psst_canary__" // HintKey is the reserved key for the optional plain-text password hint. HintKey = "__psst_hint__" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
ID int64
Key string
Value []byte
IsSecure bool
Salt []byte
Nonce []byte
CreatedAt time.Time
}
Entry represents one row in the entries table.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps an open SQLite database.
func Open ¶
Open opens (or creates) the SQLite database at the default path, applies migrations, and returns a ready-to-use Store.
func OpenAt ¶
OpenAt opens (or creates) a SQLite database at the given path. Intended for use in tests where a temporary directory is preferred over ~/.persist.
func (*Store) Delete ¶
Delete removes an entry. Returns an error if the key does not exist or is a reserved key.
func (*Store) IsInitialized ¶
IsInitialized returns true when the canary record exists, indicating that psst init has been completed.
func (*Store) List ¶
List returns all user entries in reverse-chronological order, never including reserved keys.
func (*Store) Save ¶
Save writes a plain-text entry. Returns an error if the key already exists and force is false.
func (*Store) SaveCanary ¶
SaveCanary stores the encrypted canary record, replacing any prior entry.