Added blank lines in encryption.other_accounts for better readability

This commit is contained in:
StNicolay 2022-12-25 21:03:08 +03:00
parent 50eb3057d5
commit e165020111

View File

@ -32,12 +32,14 @@ def encrypt(
salt = os.urandom(64) salt = os.urandom(64)
key = _generate_key(salt, master_pass.encode("utf-8")) key = _generate_key(salt, master_pass.encode("utf-8"))
f = Fernet(key) f = Fernet(key)
enc_login = base64.urlsafe_b64decode( enc_login = base64.urlsafe_b64decode(
f.encrypt(account.login.encode("utf-8")), f.encrypt(account.login.encode("utf-8")),
) )
enc_password = base64.urlsafe_b64decode( enc_password = base64.urlsafe_b64decode(
f.encrypt(account.password.encode("utf-8")), f.encrypt(account.password.encode("utf-8")),
) )
return Account( return Account(
user_id=account.user_id, user_id=account.user_id,
name=account.name, name=account.name,
@ -55,12 +57,14 @@ def decrypt(
DecryptedAccount object""" DecryptedAccount object"""
key = _generate_key(account.salt, master_pass.encode("utf-8")) key = _generate_key(account.salt, master_pass.encode("utf-8"))
f = Fernet(key) f = Fernet(key)
login = f.decrypt( login = f.decrypt(
base64.urlsafe_b64encode(account.enc_login), base64.urlsafe_b64encode(account.enc_login),
).decode("utf-8") ).decode("utf-8")
password = f.decrypt( password = f.decrypt(
base64.urlsafe_b64encode(account.enc_password), base64.urlsafe_b64encode(account.enc_password),
).decode("utf-8") ).decode("utf-8")
return DecryptedAccount( return DecryptedAccount(
user_id=account.user_id, user_id=account.user_id,
name=account.name, name=account.name,