Documentation ¶
Index ¶
- Variables
- type EncodedFSKeystore
- func (ks *EncodedFSKeystore) Delete(name string) error
- func (ks *EncodedFSKeystore) Get(name string) (ci.PrivKey, error)
- func (ks *EncodedFSKeystore) Has(name string) (bool, error)
- func (ks *EncodedFSKeystore) List() ([]string, error)
- func (ks *EncodedFSKeystore) Put(name string, k ci.PrivKey) error
- type FSKeystore
- type Keystore
- type MemKeystore
Constants ¶
This section is empty.
Variables ¶
var ErrKeyExists = fmt.Errorf("key by that name already exists, refusing to overwrite")
ErrKeyExists is an error message returned when a key already exists
var ErrNoSuchKey = fmt.Errorf("no key by the given name was found")
ErrNoSuchKey is an error message returned when no key of a given name was found.
Functions ¶
This section is empty.
Types ¶
type EncodedFSKeystore ¶
type EncodedFSKeystore struct {
*FSKeystore
}
EncodedFSKeystore is extension of FSKeystore that encodes the key filenames in base32
func NewEncodedFSKeystore ¶
func NewEncodedFSKeystore(dir string) (*EncodedFSKeystore, error)
NewEncodedFSKeystore is returns a filesystem-backed keystore which encodes key names using base32.
func (*EncodedFSKeystore) Delete ¶
func (ks *EncodedFSKeystore) Delete(name string) error
Delete removes key from the keystore
func (*EncodedFSKeystore) Get ¶
func (ks *EncodedFSKeystore) Get(name string) (ci.PrivKey, error)
Get retrieves key by its name from the keystore
func (*EncodedFSKeystore) Has ¶
func (ks *EncodedFSKeystore) Has(name string) (bool, error)
Has indicates if key is in keystore
func (*EncodedFSKeystore) List ¶
func (ks *EncodedFSKeystore) List() ([]string, error)
List returns list of all keys in keystore
type FSKeystore ¶
type FSKeystore struct {
// contains filtered or unexported fields
}
FSKeystore is a keystore backed by files in a given directory stored on disk.
func NewFSKeystore ¶
func NewFSKeystore(dir string) (*FSKeystore, error)
NewFSKeystore returns a new filesystem-backed keystore.
func (*FSKeystore) Delete ¶
func (ks *FSKeystore) Delete(name string) error
Delete removes a key from the Keystore
func (*FSKeystore) Get ¶
func (ks *FSKeystore) Get(name string) (ci.PrivKey, error)
Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey otherwise.
func (*FSKeystore) Has ¶ added in v0.4.10
func (ks *FSKeystore) Has(name string) (bool, error)
Has returns whether or not a key exist in the Keystore
func (*FSKeystore) List ¶
func (ks *FSKeystore) List() ([]string, error)
List return a list of key identifier
type Keystore ¶
type Keystore interface { // Has returns whether or not a key exist in the Keystore Has(string) (bool, error) // Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists Put(string, ci.PrivKey) error // Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey // otherwise. Get(string) (ci.PrivKey, error) // Delete removes a key from the Keystore Delete(string) error // List returns a list of key identifier List() ([]string, error) }
Keystore provides a key management interface
func NewKeystore ¶
NewKeystore returns a Keystore using the default implementation.
type MemKeystore ¶
type MemKeystore struct {
// contains filtered or unexported fields
}
MemKeystore is an in memory keystore implementation that is not persisted to any backing storage.
func (*MemKeystore) Delete ¶
func (mk *MemKeystore) Delete(name string) error
Delete remove a key from the Keystore
func (*MemKeystore) Get ¶
func (mk *MemKeystore) Get(name string) (ci.PrivKey, error)
Get retrieve a key from the Keystore
func (*MemKeystore) Has ¶ added in v0.4.10
func (mk *MemKeystore) Has(name string) (bool, error)
Has return whether or not a key exist in the Keystore
func (*MemKeystore) List ¶
func (mk *MemKeystore) List() ([]string, error)
List return a list of key identifier