From 34a9b059ddcecc23143d78377f3e77f7c979ff21 Mon Sep 17 00:00:00 2001 From: Ivan Golikov Date: Fri, 3 Jan 2025 15:24:09 +0100 Subject: [PATCH] Returning new secret instead of replacing data --- pssecret_server/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pssecret_server/utils.py b/pssecret_server/utils.py index b1ae479..239ff37 100644 --- a/pssecret_server/utils.py +++ b/pssecret_server/utils.py @@ -7,8 +7,8 @@ from pssecret_server.models import Secret def encrypt_secret(data: Secret, fernet: Fernet) -> Secret: - data.data = fernet.encrypt(data.data.encode()).decode() - return data + encrypted = fernet.encrypt(data.data.encode()).decode() + return Secret(data=encrypted) def decrypt_secret(secret: bytes, fernet: Fernet) -> bytes: