1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
package persist
import (
"errors"
"github.com/cloudflare/redoctober/config"
"github.com/cloudflare/redoctober/keycache"
"github.com/cloudflare/redoctober/passvault"
)
// Null is a non-persisting store. It is used when persistence is not
// activated.
type Null struct {
config *config.Delegations
}
func newNull(config *config.Delegations) (Store, error) {
return &Null{config: config}, nil
}
func (n *Null) Blob() []byte {
return nil
}
func (n *Null) Policy() string {
return n.config.Policy
}
func (n *Null) Users() []string {
return n.config.Users
}
func (n *Null) Store(bs []byte) error {
return nil
}
func (n *Null) Load() error {
return nil
}
func (n *Null) Persist() {
return
}
func (n *Null) Status() *Status {
return &Status{
State: Disabled,
Summary: nil,
}
}
func (n *Null) Delegate(record passvault.PasswordRecord, name, password string, users, labels []string, uses int, slot, durationString string) error {
return errors.New("persist: null store does not support delegations")
}
func (n *Null) Cache() *keycache.Cache {
cache := keycache.NewCache()
return &cache
}
func (n *Null) Purge() error {
return nil
}
|