Be at liberty and watch our very own FAQ with the Officially Much more likely
- High-peak role (API ask code): describes the process by which API inquiries and you may responses is transformed into binary texts.
- Cryptographic (authorization) layer: defines the method by which messages try encoded prior to becoming carried from transportation method.
- Transportation role: talks of the procedure on the client plus the host to deliver messages over additional existing circle process (instance HTTP, HTTPS, WS (simple websockets), WSS (websockets over HTTPS), TCP, UDP).
As of adaptation cuatro.6, major Telegram clients are having fun with MTProto dos.0, explained on this page. MTProto v1.0 (described here getting reference) try deprecated that is increasingly being eliminated.
The fresh new protocol is designed for accessibility a host API out of applications run on mobile devices
In the perspective of your own higher-peak parts, the client while the server change texts in to the an appointment. The newest lesson is linked to the visitors unit (the application form, is alot more perfect) in the place of a specific websocket/http/https/tcp relationship. Concurrently, each class is connected to a person secret ID where authorization is simply completed.
Multiple connections to a server is generally discover; texts may be submitted either guidelines by way of the associations (a reaction to an inquiry is not necessarily returned through the exact same commitment one to transmitted the first inquire, whether or not most often, this is the instance; but not, inside no instance normally a contact be came back as a result of a link belonging to a unique lesson). If UDP protocol is utilized, a reply is came back by the another Ip address than just usually the one to which the fresh new query had been sent.
- RPC phone calls (consumer to machine): calls so you’re able to API tips
- RPC solutions (servers so you’re able to visitors): outcome of RPC calls
- Content gotten receipt (or have a glimpse at this weblink in other words, alerts regarding status away from a collection of messages)
- Content reputation ask
- Multipart content or basket (a container one to keeps several texts; wanted to post multiple RPC phone calls at the same time more an HTTP partnership, such as for example; plus, a bin can get support gzip).
The message trick means the brand new 128 center pieces of this new SHA256 of your message muscles (and additionally lesson, message ID, etc
From the standpoint off lower height standards, a message try a binary research stream aligned along a great 4 otherwise 16-byte line. The initial multiple sphere regarding the content is fixed as they are employed by the new cryptographic/authorization system.
For every content, possibly private or into the a container, includes an email identifier (64 pieces, discover below), a contact sequence count within a consultation (32 bits), the distance (of the content looks inside the bytes; 32 parts), and you will a human anatomy (any dimensions which is a multiple of cuatro bytes). Likewise, when a bin or just one content is distributed, an inside heading was extra ahead (find less than), then whole message try encoded, and an external header is placed at the top of the newest content (good 64-portion secret identifier and you may an effective 128-part message secret).
A contact body typically includes a 32-bit content type of with sort of-based details. In particular, per RPC mode has a matching message types of. To get more detail, look for Digital Studies Serialization, Mobile Protocol: Solution Texts.
Every number try written only a small amount endian. not, very big wide variety (2048-bit) utilized in RSA and DH try written in the big endian format for the reason that it is when the brand new OpenSSL collection will it.
Prior to a contact (otherwise an excellent multipart message) are transmitted over a network using a transport protocol, it’s encoded inside a certain ways, and an outward header is extra towards the top of new message that is: an excellent 64-piece key identifier (you to exclusively means an authorization secret on servers too as member) and you can good 128-bit message trick. A person trick aided by the content trick describes an actual 256-section key that is exactly what encrypts the message playing with AES-256 security. Keep in mind that the first area of the content as encrypted includes adjustable study (session, content ID, sequence amount, servers sodium) that however has an effect on the message secret (for example this new AES key and you may iv). ), like the cushioning bytes, prepended by the thirty-two bytes obtained from the newest authorization secret. Multipart messages try encoded because an individual content.