miniproto.mtproto.codec.encode_encrypted_message
miniproto.mtproto.codec.encode_encrypted_message
Section titled “miniproto.mtproto.codec.encode_encrypted_message”encode_encrypted_message(auth_key: bytes, server_salt: int, session_id: int, msg_id: int, seq_no: int, body: bytes | object, *, client_to_server: bool = True, padding: bytes | None = None) -> bytesEncrypt and frame one MTProto message using the configured authorization key.
Parameters:
- auth_key (
bytes) – 256-byte MTProto authorization key. - server_salt (
int) – Current 64-bit server salt. - session_id (
int) – Current 64-bit session ID. - msg_id (
int) – MTProto message identifier. - seq_no (
int) – MTProto sequence number. - body (
bytes | object) – Raw or supported encoded body. - client_to_server (
bool) – Use client-to-server derivation, defaulting toTrue. - padding (
bytes | None) – Optional explicit padding; native codec chooses valid padding when omitted.
Returns:
bytes– Complete encrypted MTProto packet bytes.