diff --git a/pyrogram/crypto/mtproto.py b/pyrogram/crypto/mtproto.py index d42caf7c..10839126 100644 --- a/pyrogram/crypto/mtproto.py +++ b/pyrogram/crypto/mtproto.py @@ -40,14 +40,13 @@ class MTProto: return auth_key_id + msg_key + AES.ige256_encrypt(data + padding, aes_key, aes_iv) @staticmethod - def unpack(b: BytesIO, salt: int, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message: + def unpack(b: BytesIO, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message: assert b.read(8) == auth_key_id, b.getvalue() msg_key = b.read(16) aes_key, aes_iv = KDF(auth_key, msg_key, False) data = BytesIO(AES.ige256_decrypt(b.read(), aes_key, aes_iv)) - - assert data.read(8) == Long(salt) or Long(salt) == Long(MTProto.INITIAL_SALT) + data.read(8) # https://core.telegram.org/mtproto/security_guidelines#checking-session-id assert data.read(8) == session_id diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 993ad2fa..c3dec02e 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -219,7 +219,6 @@ class Session: try: data = MTProto.unpack( BytesIO(packet), - self.current_salt.salt, self.session_id, self.auth_key, self.auth_key_id