Files
redoctober/persist/null.go
Kyle Isom 9f39413adb Properly restore delegations.
This change addresses several points:

1. The integration tests didn't verify that delegations could be used
   for decryption following a restore. The integration tests now
   verify this.

2. There was no functionality for clearing persisted delegations if
   needed. The vault admin can now do this via the command line tool.

3. Restoring active delegations wasn't storing the key with the
   delegation. Keys are now serialised properly.

4. [Minor] The MSP package now reports the name of the offending user
   when it can't find a user name in the database.
2016-08-24 13:22:13 -07:00

64 lines
1.1 KiB
Go

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
}