Encryption: Refactor secrets service (#41771)

* Refactor kmsproviders pkg

* Update tests

* Fix linting

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>
This commit is contained in:
Tania B
2021-11-17 11:52:45 +02:00
committed by GitHub
parent b8dd9fdd4a
commit bc60ae3c66
9 changed files with 104 additions and 48 deletions
+4 -6
View File
@@ -6,6 +6,10 @@ import (
"xorm.io/xorm"
)
const (
EnvelopeEncryptionFeatureToggle = "envelopeEncryption"
)
// Service is an envelope encryption service in charge of encrypting/decrypting secrets.
// It is a replacement for encryption.Service
type Service interface {
@@ -24,12 +28,6 @@ type Service interface {
GetDecryptedValue(ctx context.Context, sjd map[string][]byte, key, fallback string) string
}
type ProvidersRegistrar interface {
CurrentProviderID() string
GetProviders() map[string]Provider
RegisterProvider(providerID string, provider Provider)
}
// Store defines methods to interact with secrets storage
type Store interface {
GetDataKey(ctx context.Context, name string) (*DataKey, error)