Developer documentation

MTProto authorization keys and transports

Understand key exchange, byte order, framing and TCP/WebSocket transport without reusing example secrets.

GetTGAPI editorial teamUpdated
Documentation notesReviewed

Based on official sources and independently maintained by GetTGAPI. Documentation and glossary →

On this page
  1. Examples verify encoding, not reusable randomness
  2. Framing differs from the underlying connection
  3. Implementation recommendations

Examples verify encoding, not reusable randomness

Key establishment includes nonces, server identity and DH-parameter checks. Intermediate values in examples are test vectors, not production material to reuse. Follow field-specific byte order rather than reversing an entire payload.

Framing differs from the underlying connection

Abridged, Intermediate, Padded intermediate and Full are MTProto framing schemes. TCP and WebSocket are transports. WebSocket frame boundaries do not define MTProto message boundaries. Respect configured addresses and ports.

Implementation recommendations

Prefer a maintained library. For protocol research, use official vectors offline and test truncation, combined frames, invalid lengths and disconnects. Bound buffers before allocating from network-provided lengths.

Stop on failed security checks and retain sanitized reasons. Do not maintain connectivity by disabling verification or accepting malformed key exchanges.