mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-08 09:51:57 +00:00
Partially revert "Implement perfect forward secrecy for MTProto (#4618)"
This partially reverts commit 5a3a94eb51.
It should be re-introduced once the rest of comments are addressed.
Session changes are kept for the future, even if unused for now,
as there may be people who have already upgraded their session.
This commit is contained in:
@@ -923,13 +923,7 @@ class MessageMethods:
|
||||
effect=message_effect_id
|
||||
)
|
||||
|
||||
try:
|
||||
result = await self(request)
|
||||
|
||||
except errors.rpcerrorlist.AuthKeyPermEmptyError as e:
|
||||
await self._sender._reconnect(e)
|
||||
result = await self(request)
|
||||
|
||||
result = await self(request)
|
||||
if isinstance(result, types.UpdateShortSentMessage):
|
||||
message = types.Message(
|
||||
id=result.id,
|
||||
|
||||
@@ -262,8 +262,7 @@ class TelegramBaseClient(abc.ABC):
|
||||
base_logger: typing.Union[str, logging.Logger] = None,
|
||||
receive_updates: bool = True,
|
||||
catch_up: bool = False,
|
||||
entity_cache_limit: int = 5000,
|
||||
store_tmp_auth_key_on_disk: bool = True
|
||||
entity_cache_limit: int = 5000
|
||||
):
|
||||
if not api_id or not api_hash:
|
||||
raise ValueError(
|
||||
@@ -289,7 +288,7 @@ class TelegramBaseClient(abc.ABC):
|
||||
# Determine what session object we have
|
||||
if isinstance(session, (str, pathlib.Path)):
|
||||
try:
|
||||
session = SQLiteSession(str(session), store_tmp_auth_key_on_disk=store_tmp_auth_key_on_disk)
|
||||
session = SQLiteSession(str(session))
|
||||
except ImportError:
|
||||
import warnings
|
||||
warnings.warn(
|
||||
@@ -433,7 +432,6 @@ class TelegramBaseClient(abc.ABC):
|
||||
auto_reconnect=self._auto_reconnect,
|
||||
connect_timeout=self._timeout,
|
||||
auth_key_callback=self._auth_key_callback,
|
||||
tmp_auth_key_callback=self._tmp_auth_key_callback,
|
||||
updates_queue=self._updates_queue,
|
||||
auto_reconnect_callback=self._handle_auto_reconnect
|
||||
)
|
||||
@@ -563,7 +561,6 @@ class TelegramBaseClient(abc.ABC):
|
||||
return
|
||||
|
||||
self.session.auth_key = self._sender.auth_key
|
||||
self.session.tmp_auth_key = self._sender.tmp_auth_key
|
||||
await utils.maybe_async(self.session.save())
|
||||
|
||||
try:
|
||||
@@ -786,14 +783,6 @@ class TelegramBaseClient(abc.ABC):
|
||||
self.session.auth_key = auth_key
|
||||
await utils.maybe_async(self.session.save())
|
||||
|
||||
def _tmp_auth_key_callback(self: 'TelegramClient', tmp_auth_key):
|
||||
"""
|
||||
Callback from the sender whenever it needed to generate a
|
||||
new temporary authorization key. This means we are not authorized.
|
||||
"""
|
||||
self.session.tmp_auth_key = tmp_auth_key
|
||||
self.session.save()
|
||||
|
||||
# endregion
|
||||
|
||||
# region Working with different connections/Data Centers
|
||||
|
||||
Reference in New Issue
Block a user