mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-09-21 13:34:48 -04:00
Add aTLS endpoint to KMS (#236)
* Move file watcher and validator to internal * Add aTLS endpoint to KMS for Kubernetes external requests * Update Go version in Dockerfiles * Move most KMS packages to internal Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
042f668d20
commit
f9a581f329
66 changed files with 550 additions and 355 deletions
32
kms/internal/storage/memfsstorage.go
Normal file
32
kms/internal/storage/memfsstorage.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package storage
|
||||
|
||||
import "context"
|
||||
|
||||
// MemMapStorage is the standard implementation of the Storage interface, storing keys in memory only.
|
||||
type MemMapStorage struct {
|
||||
dekPool map[string][]byte
|
||||
}
|
||||
|
||||
// NewMemMapStorage creates and initialises a new MemMapStorage object.
|
||||
func NewMemMapStorage() *MemMapStorage {
|
||||
s := &MemMapStorage{
|
||||
dekPool: make(map[string][]byte),
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// Get returns a DEK from MemMapStorage by key ID.
|
||||
func (s *MemMapStorage) Get(ctx context.Context, keyID string) ([]byte, error) {
|
||||
encDEK, ok := s.dekPool[keyID]
|
||||
if ok {
|
||||
return encDEK, nil
|
||||
}
|
||||
return nil, ErrDEKUnset
|
||||
}
|
||||
|
||||
// Put saves a DEK to MemMapStorage by key ID.
|
||||
func (s *MemMapStorage) Put(ctx context.Context, keyID string, encDEK []byte) error {
|
||||
s.dekPool[keyID] = encDEK
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue