Compare commits
No commits in common. "b4c6e17ce25a71567e7777cc424f2f8f1ebb34aa" and "63de9010de68f9bb6d43357d62c834d489444a8a" have entirely different histories.
b4c6e17ce2
...
63de9010de
@ -27,8 +27,8 @@ def encrypt_account_info(
|
||||
salt = os.urandom(64)
|
||||
key = _generate_key(salt, master_pass.encode("utf-8"))
|
||||
f = Fernet(key)
|
||||
enc_login = base64.urlsafe_b64decode(f.encrypt(login.encode("utf-8")))
|
||||
enc_passwd = base64.urlsafe_b64decode(f.encrypt(passwd.encode("utf-8")))
|
||||
enc_login = f.encrypt(login.encode("utf-8"))
|
||||
enc_passwd = f.encrypt(passwd.encode("utf-8"))
|
||||
return (enc_login, enc_passwd, salt)
|
||||
|
||||
|
||||
@ -39,6 +39,6 @@ def decrypt_account_info(
|
||||
Returns a tuple of decrypted login and password"""
|
||||
key = _generate_key(salt, master_pass.encode("utf-8"))
|
||||
f = Fernet(key)
|
||||
login_bytes = f.decrypt(base64.urlsafe_b64encode(enc_login)).decode("utf-8")
|
||||
pass_bytes = f.decrypt(base64.urlsafe_b64encode(enc_pass)).decode("utf-8")
|
||||
return (login_bytes, pass_bytes)
|
||||
login_bytes = f.decrypt(enc_login)
|
||||
pass_bytes = f.decrypt(enc_pass)
|
||||
return (login_bytes.decode("utf-8"), pass_bytes.decode("utf-8"))
|
||||
|
@ -25,8 +25,8 @@ class Account(sqlmodel.SQLModel, table=True):
|
||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
||||
)
|
||||
enc_login: bytes = sqlmodel.Field(
|
||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(500), nullable=False)
|
||||
)
|
||||
enc_pass: bytes = sqlmodel.Field(
|
||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(500), nullable=False)
|
||||
)
|
||||
|
Reference in New Issue
Block a user