Be sure to check out our FAQ on Technically Inclined

  • High-top part (API ask words): represent the method whereby API queries and responses try converted to digital messages.
  • Cryptographic (authorization) layer: describes the method by which messages is actually encoded just before getting sent through the transportation protocol.
  • Transport role: talks of the method into the client and servers to send messages more more existing circle method (such HTTP, HTTPS, WS (basic websockets), WSS (websockets more HTTPS), TCP, UDP).

At the time of variation 4.six, biggest Telegram clients are playing with MTProto dos.0, discussed on this page. MTProto v1.0 (discussed here having site) try deprecated in fact it is increasingly being phased out.

The method is designed for access to a machine API out-of programs powered by mobile phones

From the perspective of the highest-peak parts, the client together with host exchange texts in to the a session. New course was linked to the consumer product (the application, becoming a great deal more specific) as opposed to a particular websocket/http/https/tcp connection. Likewise, for every single training was connected with a user trick ID whereby consent is largely complete.

Numerous involvement with a host could be open; texts may be sent in possibly guidelines due to any of the contacts (a response to an inquiry is not necessarily came back from same connection you to carried the original query, even in the event frequently, that’s the case; not, during the zero case normally an email become came back courtesy a link belonging to another tutorial). In the event the UDP process can be used, an answer will be returned from the another type of Ip than the one that this new inquire ended up being sent.

  • RPC calls (visitors to help you servers): calls to API procedures
  • RPC answers (server to visitors): outcome of RPC calls
  • Message obtained acknowledgment (or in other words, alerts regarding condition away from some texts)
  • Message updates query
  • Multipart message otherwise container (a container you to definitely retains multiple texts; necessary to posting numerous RPC calls at a time over a keen HTTP partnership, particularly; including, a container could possibly get help gzip).

The message secret means the new 128 center items of new SHA256 of message looks (and course, message ID, an such like

Regarding perspective regarding down peak standards, a contact was a binary study weight aligned along a great 4 otherwise sixteen-byte border. The initial several fields in the content is repaired as they are utilized by the latest cryptographic/authorization system.

Each message, often personal otherwise inside a bin, consists of a message identifier (64 parts, look for less than), an email sequence number inside a session (32 parts), the length (of content human body within the bytes; thirty-two pieces), and you may a human anatomy (people proportions that’s a multiple of cuatro bytes). In addition, when a container otherwise an individual message is distributed, an internal header try additional ahead (look for less than), then entire content is encoded, and an outward heading is put on top of the brand new message (a great 64-piece trick identifier and you can good 128-section content key).

A message system usually includes an effective thirty-two-bit content sort of followed closely by sorts of-dependent variables. Specifically, each RPC mode has actually a matching message sorts of. For much more outline, come across Digital Analysis Serialization, Mobile Method: Solution Texts.

The wide variety try composed very little endian. not, huge numbers (2048-bit) found in RSA and you can DH are written in the major endian structure because that is where brand new OpenSSL collection does it.

Prior to a message (or a multipart content) becoming carried over a network using a transport process, it is encrypted in a specific way, and you can an external header is additional near the top of the fresh content that is: a great 64-section key identifier (you to definitely uniquely means an authorization secret towards the host also since the member) and you will an effective 128-bit message trick. A user trick making use of the message key talks of an authentic 256-piece secret that is what encrypts the message playing with AES-256 security. Remember that the first part of the content as encoded contains adjustable analysis (class, content ID, succession matter, machine sodium) you to naturally has an effect on the message trick (which means that the new AES trick and you can iv). ), for instance the padding bytes, prepended because of the thirty two bytes taken from the brand new agreement secret. Multipart texts try encoded while the one content.