Documentation ¶
Index ¶
- func WriteStore(password []byte, store Store) ([]byte, error)
- func WriteStoreContext(ctx context.Context, password []byte, store Store) ([]byte, error)
- type Store
- func (s Store) Get(key string) ([]byte, error)
- func (s Store) GetContext(ctx context.Context, key string) ([]byte, error)
- func (s Store) Has(key string) bool
- func (s Store) HasContext(ctx context.Context, key string) bool
- func (s Store) List() []string
- func (s Store) ListContext(ctx context.Context) []string
- func (s Store) Set(key string, val []byte) error
- func (s Store) SetContext(ctx context.Context, key string, val []byte) error
- func (s Store) Unset(key string)
- func (s Store) UnsetContext(ctx context.Context, key string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteStore ¶
WriteStore writes a Store as raw data to be saved. WriteStore uses password encrypt the Store and returns the encrypted data, or an error if the Store could not be encoded to JSON or could not be encrypted.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store defines a key-value storage in scrt.
func NewStoreContext ¶ added in v0.3.3
NewStoreContext performs NewStore with a context.
func ReadStore ¶
ReadStore reads a scrt Store from raw data. ReadStore uses password to decrypt data and returns the Store, or an error if Store data could not be decrypted of parsed. A json.Unmarshal error can mean either that the wrong password was supplied, or that the Store is corrupted.
func ReadStoreContext ¶ added in v0.3.3
ReadStoreContext performs ReadStore with a context.
func (Store) Get ¶
Get returns the value associated to key in the Store, or an error if none is associated.
func (Store) GetContext ¶ added in v0.3.3
GetContext performs Get with a context.
func (Store) HasContext ¶ added in v0.3.3
HasContext performs Has with a context.
func (Store) ListContext ¶ added in v0.3.3
ListContext performs List with a context.
func (Store) SetContext ¶ added in v0.3.3
SetContext performs Set with a context.