Updated client/client.py

This commit is contained in:
mirai 2022-12-01 10:17:44 +03:00
parent 96c9bb4221
commit 2ffd0443ce

View File

@ -92,29 +92,22 @@ class Client:
def _remove_keys(self) -> None: def _remove_keys(self) -> None:
os.remove("private.pem") os.remove("private.pem")
os.remove("public.pem") os.remove("public.pem")
def _validate_keys(self) -> None: def _validate_keys(self) -> None:
self._key_gen() self._key_gen()
self._key_request() self._key_request()
with open('public.pem', "rb") as f: with open('public.pem', "rb") as f:
first_key = f.read() first_key = f.read()
self.pubkey = rsa.PublicKey.load_pkcs1(first_key) self.pubkey = rsa.PublicKey.load_pkcs1(first_key)
self._remove_keys() self._remove_keys()
def __call__(self): def __call__(self):
self._validate_keys() self._validate_keys()
threads = [ threads = [
threading.Thread(target=self.send_info), threading.Thread(target=self.send_info),
threading.Thread(target=self.update_info) threading.Thread(target=self.update_info)
] ]
for th in threads: for th in threads:
th.start() th.start()