mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-10 16:40:57 +03:00
Detect BrokenAuthKeyError on MtProtoSender._decode_msg
This commit is contained in:
parent
a992f42781
commit
4a8e5c865a
|
@ -4,7 +4,10 @@ from threading import RLock
|
||||||
|
|
||||||
from .. import helpers as utils
|
from .. import helpers as utils
|
||||||
from ..crypto import AES
|
from ..crypto import AES
|
||||||
from ..errors import BadMessageError, InvalidChecksumError, rpc_message_to_error
|
from ..errors import (
|
||||||
|
BadMessageError, InvalidChecksumError, BrokenAuthKeyError,
|
||||||
|
rpc_message_to_error
|
||||||
|
)
|
||||||
from ..extensions import BinaryReader, BinaryWriter
|
from ..extensions import BinaryReader, BinaryWriter
|
||||||
from ..tl.all_tlobjects import tlobjects
|
from ..tl.all_tlobjects import tlobjects
|
||||||
from ..tl.types import MsgsAck
|
from ..tl.types import MsgsAck
|
||||||
|
@ -147,6 +150,9 @@ class MtProtoSender:
|
||||||
|
|
||||||
with BinaryReader(body) as reader:
|
with BinaryReader(body) as reader:
|
||||||
if len(body) < 8:
|
if len(body) < 8:
|
||||||
|
if body == b'l\xfe\xff\xff':
|
||||||
|
raise BrokenAuthKeyError()
|
||||||
|
else:
|
||||||
raise BufferError("Can't decode packet ({})".format(body))
|
raise BufferError("Can't decode packet ({})".format(body))
|
||||||
|
|
||||||
# TODO Check for both auth key ID and msg_key correctness
|
# TODO Check for both auth key ID and msg_key correctness
|
||||||
|
|
Loading…
Reference in New Issue
Block a user