-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystore.go
33 lines (27 loc) · 866 Bytes
/
keystore.go
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
package keystore
import (
"errors"
"github.com/adrianosela/padl/api/kms"
)
var (
// ErrKeyExists is the error type returned
// when the PutKey() method is called with
// a key that already exists in the keystore
ErrKeyExists = errors.New("key already exists")
// ErrKeyNotFound is returned when GetKey(),
// UpdateKey(), or DeleteKey() is called with
// an id (or key with id in the case of update)
// that is not found in the keystore
ErrKeyNotFound = errors.New("key not found")
)
// Keystore represents all the necessary operations
// to build a key storage solution
type Keystore interface {
PutPrivKey(*kms.PrivateKey) error
GetPrivKey(string) (*kms.PrivateKey, error)
UpdatePrivKey(*kms.PrivateKey) error
DeletePrivKey(string) error
PutPubKey(*kms.PublicKey) error
GetPubKey(string) (*kms.PublicKey, error)
DeletePubKey(string) error
}