feat(meta): secretbox encryption in place of aes-gcm

This commit is contained in:
Fabio Bozzo
2024-11-28 16:16:04 +01:00
parent dff52f80c4
commit 0349e7e463
4 changed files with 134 additions and 157 deletions

View File

@@ -63,7 +63,7 @@ func (m *Meta) GetEncryptedString(key string, encryptionKey []byte) (string, err
return "", err
}
decrypted, err := crypto.DecryptStringWithAESKey(v, encryptionKey)
decrypted, err := crypto.DecryptStringWithKey(v, encryptionKey)
if err != nil {
return "", err
}
@@ -111,7 +111,7 @@ func (m *Meta) GetEncryptedBytes(key string, encryptionKey []byte) ([]byte, erro
return nil, err
}
decrypted, err := crypto.DecryptStringWithAESKey(v, encryptionKey)
decrypted, err := crypto.DecryptStringWithKey(v, encryptionKey)
if err != nil {
return nil, err
}
@@ -156,12 +156,12 @@ func (m *Meta) AddEncrypted(key string, val any, encryptionKey []byte) error {
switch val := val.(type) {
case string:
encrypted, err = crypto.EncryptWithAESKey([]byte(val), encryptionKey)
encrypted, err = crypto.EncryptWithKey([]byte(val), encryptionKey)
if err != nil {
return err
}
case []byte:
encrypted, err = crypto.EncryptWithAESKey(val, encryptionKey)
encrypted, err = crypto.EncryptWithKey(val, encryptionKey)
if err != nil {
return err
}