diff --git a/src/encryption/other_accounts.py b/src/encryption/other_accounts.py index 9e02449..52b69c7 100644 --- a/src/encryption/other_accounts.py +++ b/src/encryption/other_accounts.py @@ -32,12 +32,14 @@ def encrypt( salt = os.urandom(64) key = _generate_key(salt, master_pass.encode("utf-8")) f = Fernet(key) + enc_login = base64.urlsafe_b64decode( f.encrypt(account.login.encode("utf-8")), ) enc_password = base64.urlsafe_b64decode( f.encrypt(account.password.encode("utf-8")), ) + return Account( user_id=account.user_id, name=account.name, @@ -55,12 +57,14 @@ def decrypt( DecryptedAccount object""" key = _generate_key(account.salt, master_pass.encode("utf-8")) f = Fernet(key) + login = f.decrypt( base64.urlsafe_b64encode(account.enc_login), ).decode("utf-8") password = f.decrypt( base64.urlsafe_b64encode(account.enc_password), ).decode("utf-8") + return DecryptedAccount( user_id=account.user_id, name=account.name,