Debian Codegraph @

persist/null.go

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