Now using env. variables for db info
This commit is contained in:
parent
9d8d9cfdd6
commit
1bde1a1739
@ -26,7 +26,7 @@ def encrypt_account_info(
|
|||||||
"""Encrypts login and password of a user using hash of their master password as a key.
|
"""Encrypts login and password of a user using hash of 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_hash)
|
key = _generate_key(salt, master_pass_hash)
|
||||||
f = Fernet(key)
|
f = Fernet(key)
|
||||||
enc_login = f.encrypt(login.encode("utf-8"))
|
enc_login = f.encrypt(login.encode("utf-8"))
|
||||||
enc_passwd = f.encrypt(passwd.encode("utf-8"))
|
enc_passwd = f.encrypt(passwd.encode("utf-8"))
|
||||||
@ -36,7 +36,7 @@ def encrypt_account_info(
|
|||||||
def decrypt_account_info(
|
def decrypt_account_info(
|
||||||
enc_login: bytes, enc_pass: bytes, master_pass_hash: bytes, salt: bytes
|
enc_login: bytes, enc_pass: bytes, master_pass_hash: bytes, salt: bytes
|
||||||
) -> tuple[str, str]:
|
) -> tuple[str, str]:
|
||||||
key = generate_key(salt, master_pass_hash)
|
key = _generate_key(salt, master_pass_hash)
|
||||||
f = Fernet(key)
|
f = Fernet(key)
|
||||||
login_bytes = f.decrypt(enc_login)
|
login_bytes = f.decrypt(enc_login)
|
||||||
pass_bytes = f.decrypt(enc_pass)
|
pass_bytes = f.decrypt(enc_pass)
|
||||||
|
Reference in New Issue
Block a user