Documentation
¶
Index ¶
- Variables
- type BasicKeyStore
- func (ks *BasicKeyStore) Delete(keyID string, passphrase string) error
- func (ks *BasicKeyStore) Exists(key string) bool
- func (ks *BasicKeyStore) Get(keyID string, passphrase string) (*Key, error)
- func (ks *BasicKeyStore) ListKeys() ([]string, error)
- func (ks *BasicKeyStore) Save(id string, data []byte, passphrase string) (string, error)
- type Key
- type KeyStore
- type ScryptParams
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyPassphrase = errors.New("passphrase is empty") ErrVersionMismatch = errors.New("version mismatch") ErrCipherMismatch = errors.New("cipher mismatch") ErrMACMismatch = errors.New("mac mismatch") ErrEmptyKeysDir = errors.New("keysDir is empty") ErrEmptyNodeIdentity = errors.New("nodeIdentityData is empty") ErrKeyNotFound = errors.New("key not found on this node") ErrTokenInvalid = errors.New("token is invalid") ErrNotUnlockedKey = errors.New("key is not unlocked") )
Functions ¶
This section is empty.
Types ¶
type BasicKeyStore ¶
type BasicKeyStore struct {
// contains filtered or unexported fields
}
BasicKeyStore handles keypair storage. TODO: add cache?
func New ¶
func New(fs afero.Fs, keysDir string) (*BasicKeyStore, error)
New creates a new BasicKeyStore.
func (*BasicKeyStore) Delete ¶
func (ks *BasicKeyStore) Delete(keyID string, passphrase string) error
Delete removes the file referencing the given key.
func (*BasicKeyStore) Exists ¶
func (ks *BasicKeyStore) Exists(key string) bool
Exists returns whether a key is stored
func (*BasicKeyStore) Get ¶
func (ks *BasicKeyStore) Get(keyID string, passphrase string) (*Key, error)
Get unlocks a key by keyID.
func (*BasicKeyStore) ListKeys ¶
func (ks *BasicKeyStore) ListKeys() ([]string, error)
ListKeys lists the keys in the keysDir.
type Key ¶
Key represents a keypair to be stored in a keystore
func UnmarshalKey ¶
UnmarshalKey decrypts and unmarhals the private key
func (*Key) MarshalToJSON ¶
MarshalToJSON encrypts and marshals a key to json byte array.
type KeyStore ¶
type KeyStore interface { Save(id string, data []byte, passphrase string) (string, error) Get(keyID string, passphrase string) (*Key, error) Delete(keyID string, passphrase string) error ListKeys() ([]string, error) }
KeyStore manages a local keystore with lock and unlock functionalities.
Click to show internal directories.
Click to hide internal directories.