Renamed cryptogra[hy folder into encryption to not overshadow cryptography module
This commit is contained in:
parent
138ec55ae5
commit
b42cbb57a4
@ -6,7 +6,7 @@ from . import (
|
||||
account_checks,
|
||||
account_parsing,
|
||||
bot,
|
||||
cryptography,
|
||||
encryption,
|
||||
database,
|
||||
generate_password,
|
||||
)
|
||||
@ -15,7 +15,7 @@ __all__ = [
|
||||
"account_checks",
|
||||
"account_parsing",
|
||||
"bot",
|
||||
"cryptography",
|
||||
"encryption",
|
||||
"database",
|
||||
"generate_password",
|
||||
]
|
||||
|
@ -5,7 +5,7 @@ import time
|
||||
import telebot
|
||||
from sqlalchemy.future import Engine
|
||||
|
||||
from .. import cryptography, database, generate_password
|
||||
from .. import encryption, database, generate_password
|
||||
from ..account_checks import (
|
||||
check_account,
|
||||
check_account_name,
|
||||
@ -110,7 +110,7 @@ def _set_master_pass2(
|
||||
if text == "/cancel":
|
||||
return _send_tmp_message(bot, mes.chat.id, "Успешная отмена")
|
||||
|
||||
password_hash, master_salt = cryptography.master_pass.encrypt_master_pass(
|
||||
password_hash, master_salt = encryption.master_pass.encrypt_master_pass(
|
||||
text,
|
||||
)
|
||||
database.add.add_master_pass(
|
||||
@ -150,7 +150,7 @@ def _reset_master_pass2(
|
||||
if text == "/cancel":
|
||||
return _send_tmp_message(bot, mes.chat.id, "Успешная отмена")
|
||||
|
||||
hash_, salt = cryptography.master_pass.encrypt_master_pass(text)
|
||||
hash_, salt = encryption.master_pass.encrypt_master_pass(text)
|
||||
database.delete.purge_accounts(engine, mes.from_user.id)
|
||||
database.change.change_master_pass(engine, mes.from_user.id, salt, hash_)
|
||||
_send_tmp_message(
|
||||
@ -263,7 +263,7 @@ def _add_account5(
|
||||
return _send_tmp_message(bot, mes.chat.id, "Успешная отмена")
|
||||
|
||||
salt, hash_ = database.get.get_master_pass(engine, mes.from_user.id)
|
||||
if not cryptography.master_pass.check_master_pass(text, hash_, salt):
|
||||
if not encryption.master_pass.check_master_pass(text, hash_, salt):
|
||||
return _send_tmp_message(
|
||||
bot,
|
||||
mes.chat.id,
|
||||
@ -272,7 +272,7 @@ def _add_account5(
|
||||
|
||||
name, login, passwd = data["name"], data["login"], data["passwd"]
|
||||
|
||||
enc_login, enc_pass, salt = cryptography.other_accounts.encrypt(
|
||||
enc_login, enc_pass, salt = encryption.other_accounts.encrypt(
|
||||
login,
|
||||
passwd,
|
||||
text,
|
||||
@ -340,7 +340,7 @@ def _get_account3(
|
||||
mes.from_user.id,
|
||||
)
|
||||
|
||||
if not cryptography.master_pass.check_master_pass(
|
||||
if not encryption.master_pass.check_master_pass(
|
||||
text,
|
||||
hash_pass,
|
||||
master_salt,
|
||||
@ -350,7 +350,7 @@ def _get_account3(
|
||||
salt, enc_login, enc_pass = database.get.get_account_info(
|
||||
engine, mes.from_user.id, name
|
||||
)
|
||||
login, passwd = cryptography.other_accounts.decrypt(
|
||||
login, passwd = encryption.other_accounts.decrypt(
|
||||
enc_login,
|
||||
enc_pass,
|
||||
text,
|
||||
@ -454,7 +454,7 @@ def _export2(
|
||||
engine,
|
||||
mes.from_user.id,
|
||||
)
|
||||
if not cryptography.master_pass.check_master_pass(
|
||||
if not encryption.master_pass.check_master_pass(
|
||||
text,
|
||||
hash_pass,
|
||||
master_salt,
|
||||
@ -462,7 +462,7 @@ def _export2(
|
||||
return _send_tmp_message(bot, mes.chat.id, "Не подходит мастер пароль")
|
||||
|
||||
accounts = database.get.get_all_accounts(engine, mes.from_user.id)
|
||||
accounts = cryptography.other_accounts.decrypt_multiple(accounts, text)
|
||||
accounts = encryption.other_accounts.decrypt_multiple(accounts, text)
|
||||
json_io = accounts_to_json(accounts)
|
||||
bot_mes = bot.send_document(mes.chat.id, json_io)
|
||||
|
||||
@ -544,7 +544,7 @@ def _import3(
|
||||
engine,
|
||||
mes.from_user.id,
|
||||
)
|
||||
if not cryptography.master_pass.check_master_pass(
|
||||
if not encryption.master_pass.check_master_pass(
|
||||
text,
|
||||
hash_pass,
|
||||
master_salt,
|
||||
@ -559,8 +559,10 @@ def _import3(
|
||||
if not check_account(name, login, passwd):
|
||||
failed.append(name)
|
||||
continue
|
||||
enc_login, enc_passwd, salt = cryptography.other_accounts.encrypt(
|
||||
login, passwd, text
|
||||
enc_login, enc_passwd, salt = encryption.other_accounts.encrypt(
|
||||
login,
|
||||
passwd,
|
||||
text,
|
||||
)
|
||||
result = database.add.add_account(
|
||||
engine, mes.from_user.id, name, salt, enc_login, enc_passwd
|
||||
|
Reference in New Issue
Block a user