Files
Matheus Macabu a1e71fc85f SecretsManager: Update decrypt authorization with service identity (#105668)
(cherry picked from commit 9aea342be1764c33033aa1717242829970d5f5be)
2025-05-20 16:24:51 +02:00

29 lines
897 B
Go

package contracts
import (
"context"
"errors"
secretv0alpha1 "github.com/grafana/grafana/pkg/apis/secret/v0alpha1"
"github.com/grafana/grafana/pkg/registry/apis/secret/xkube"
)
var (
ErrDecryptNotFound = errors.New("not found")
ErrDecryptNotAuthorized = errors.New("not authorized")
ErrDecryptFailed = errors.New("decryption failed")
)
// DecryptStorage is the interface for wiring and dependency injection.
type DecryptStorage interface {
Decrypt(ctx context.Context, namespace xkube.Namespace, name string) (secretv0alpha1.ExposedSecureValue, error)
}
// DecryptAuthorizer is the interface for authorizing decryption requests.
type DecryptAuthorizer interface {
Authorize(ctx context.Context, secureValueName string, secureValueDecrypters []string) (identity string, allowed bool)
}
// TEMPORARY: Needed to pass it with wire.
type DecryptAllowList map[string]struct{}