Changed comments in cryptograpy.other_accounts to be more precise

This commit is contained in:
StNicolay 2022-11-05 00:22:37 +03:00
parent 570f15001e
commit da42d7ad1d

View File

@ -23,8 +23,8 @@ def _generate_key(salt: bytes, master_pass: bytes) -> bytes:
def encrypt_account_info( def encrypt_account_info(
login: str, passwd: str, master_pass: bytes login: str, passwd: str, master_pass: bytes
) -> tuple[bytes, bytes, bytes]: ) -> tuple[bytes, bytes, bytes]:
"""Encrypts login and password of a user using hash of their master password as a key. """Encrypts login and password of a user using their master password as a key.
Returns a tuple of encrypted login password and salt""" Returns a tuple of encrypted login, password and salt"""
salt = bcrypt.gensalt() salt = bcrypt.gensalt()
key = _generate_key(salt, master_pass) key = _generate_key(salt, master_pass)
f = Fernet(key) f = Fernet(key)
@ -36,6 +36,8 @@ def encrypt_account_info(
def decrypt_account_info( def decrypt_account_info(
enc_login: bytes, enc_pass: bytes, master_pass: bytes, salt: bytes enc_login: bytes, enc_pass: bytes, master_pass: bytes, salt: bytes
) -> tuple[str, str]: ) -> tuple[str, str]:
"""Decrypts login and password using their master password as a key.
Returns a tuple of decrypted login and password"""
key = _generate_key(salt, master_pass) key = _generate_key(salt, master_pass)
f = Fernet(key) f = Fernet(key)
login_bytes = f.decrypt(enc_login) login_bytes = f.decrypt(enc_login)