This commit is contained in:
greeneclipse committed 2026-10-15 23:48:34 +02:00
1 parent 26e7453ad9
commit 6586722652
4 files changed
+173 -94

No files matched your search

+4 -4
View File
@@ -7,7 +7,7 @@ import (
"os"
"strings"
"github.com/descrybe/descrybe-v2/apps/api/internal/platformsettings"
"github.com/descrybe/descrybe-v2/apps/api/internal/secretcrypto"
)
// Custom remote source headers are stored only as encrypted options; never in response DTOs.
@@ -48,7 +48,7 @@ func secretEncryptionKey() []byte {
if material == "" {
material = os.Getenv("CREDENTIALS_ENCRYPTION_KEY")
}
return platformsettings.DeriveKey(material, os.Getenv("TOKEN_SIGNING_SECRET"))
return secretcrypto.DeriveKey(material, os.Getenv("TOKEN_SIGNING_SECRET"))
}
func encryptFeedHeaders(headers map[string]string) (string, error) {
clean, err := validatedFeedHeaders(headers)
@@ -66,7 +66,7 @@ func encryptFeedHeaders(headers map[string]string) (string, error) {
if err != nil {
return "", err
}
return platformsettings.EncryptSecret(key, string(b))
return secretcrypto.EncryptSecret(key, string(b))
}
func decryptFeedHeaders(options any) (map[string]string, error) {
opt, ok := options.(map[string]any)
@@ -77,7 +77,7 @@ func decryptFeedHeaders(options any) (map[string]string, error) {
if encrypted == "" {
return nil, nil
}
plain, err := platformsettings.DecryptSecret(secretEncryptionKey(), encrypted)
plain, err := secretcrypto.DecryptSecret(secretEncryptionKey(), encrypted)
if err != nil {
return nil, errors.New("cannot decrypt feed credentials; ensure same APP_ENCRYPTION_KEY on API and worker")
}