Skip to content

miniproto.mtproto.codec.decode_encrypted_message

miniproto.mtproto.codec.decode_encrypted_message

Section titled “miniproto.mtproto.codec.decode_encrypted_message”
decode_encrypted_message(auth_key: bytes, packet: ByteBuffer, *, client_to_server: bool = False) -> DecodedEncryptedMessage

Authenticate, decrypt, and parse one MTProto encrypted envelope.

Parameters:

  • auth_key (bytes) – 256-byte MTProto authorization key.
  • packet (ByteBuffer) – Complete encrypted packet bytes.
  • client_to_server (bool) – Direction used for message-key derivation; defaults to server-to-client.

Returns:

Raises:

  • ValueError – If the native codec rejects framing, key, or integrity data.