mirror of
https://github.com/warmbly/warmbly.git
synced 2026-09-06 08:01:24 +00:00
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.
29 lines
683 B
Go
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,
|
|
}
|
|
}
|