Files
warmbly/internal/app/cipher/service.go
T
Matthew Meszaros b9a5871308 feat: key the cipher service by organization ID
cipher.CipherService.Cipher(ctx, orgID) now resolves, generates, and
caches DEKs per organization (Redis key decrypted_key:<orgID>).
Platform-level secrets keep the zero-UUID identity, renamed to
platformCipherID since it no longer partitions against user keys.
2026-06-10 17:16:26 +02:00

29 lines
683 B
Go

package cipher
import (
"context"
"github.com/google/uuid"
"github.com/warmbly/warmbly/internal/infrastructure/cache"
"github.com/warmbly/warmbly/internal/infrastructure/encryptedkeys"
"github.com/warmbly/warmbly/internal/infrastructure/kms"
)
type CipherService interface {
Cipher(ctx context.Context, orgID uuid.UUID) (*Cipher, error)
}
type cipherService struct {
encryptedKeys encryptedkeys.Store
cache *cache.Cache
kms kms.Provider
}
func NewService(kms kms.Provider, cache *cache.Cache, encryptedKeys encryptedkeys.Store) CipherService {
return &cipherService{
kms: kms,
cache: cache,
encryptedKeys: encryptedKeys,
}
}