Returning new secret instead of replacing data

This commit is contained in:
Ivan Golikov 2025-01-03 15:24:09 +01:00
parent ba7537e15e
commit 34a9b059dd

View file

@ -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: