Update content of files

This commit is contained in:
GitHub Action 2023-06-30 09:18:03 +00:00
parent bbf4ea3c6c
commit e0f6bb9d53
3 changed files with 891 additions and 927 deletions

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,7 @@
<li><a href="/bots">A General Bot Platform Overview</a></li>
<li><a href="/bots/api">Full API Reference for Developers</a></li>
</ul>
<h3><a class="anchor" href="#what-features-do-bots-have" id="what-features-do-bots-have" name="what-features-do-bots-have"><i class="anchor-icon"></i></a>What features do bots have?</h3>
<h3><a class="anchor" name="what-features-do-bots-have" href="#what-features-do-bots-have"><i class="anchor-icon"></i></a>What features do bots have?</h3>
<ul>
<li><a href="#inputs"><strong>Inputs</strong></a><ul>
<li><a href="#inputs">Text</a></li>
@ -83,21 +83,22 @@
<li><a href="#botfather"><strong>BotFather, creating and managing bots</strong></a></li>
</ul>
<hr>
<h3><a class="anchor" href="#inputs" id="inputs" name="inputs"><i class="anchor-icon"></i></a>Inputs</h3>
<p>Users can send <strong>messages of all types</strong> to bots, including text, files, locations, stickers, voice messages and even <a href="/bots/api#dice">dice</a> if they're feeling lucky. However, Telegram bots offer many other tools for building flexible interfaces tailored to your specific needs:</p>
<h3><a class="anchor" name="inputs" href="#inputs"><i class="anchor-icon"></i></a>Inputs</h3>
<p>Users can send <strong>messages of all types</strong> to bots, including text, files, locations, stickers, voice messages and even <a href="/bots/api#dice">dice</a> if they&#39;re feeling lucky. However, Telegram bots offer many other tools for building flexible interfaces tailored to your specific needs:</p>
<ul>
<li><a href="#commands">Commands</a> that are highlighted in messages and can be selected from a list after typing <code>/</code>.</li>
<li><a href="#keyboards">Keyboards</a> that replace the user's keyboard with predefined answer options.</li>
<li><a href="#keyboards">Keyboards</a> that replace the user&#39;s keyboard with predefined answer options.</li>
<li><a href="#inline-keyboards">Buttons</a> that are shown next to messages from the bot.</li>
</ul>
<p>For even more flexibility, <a href="#web-apps">Web Apps</a> support 100% custom interfaces with JavaScript. </p>
<div>
<a href="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" target="_blank"><img src="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" title="Inputs" class="dev_page_image" width="70%"></a>
<a href="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" target="_blank"><img src="/file/464001858/11318/ahAJjwERIX8.164875/ce1372cbf73e3ea94e" title="Inputs" class="dev_page_image" width=70% /></a>
</div>
<blockquote>
<p><strong>Note:</strong> Telegram bots can support <a href="#language-support">multiple languages</a> that adapt to the users' language settings in the app.</p>
<p><strong>Note:</strong> Telegram bots can support <a href="#language-support">multiple languages</a> that adapt to the users&#39; language settings in the app.</p>
</blockquote>
<h4><a class="anchor" href="#commands" id="commands" name="commands"><i class="anchor-icon"></i></a>Commands</h4>
<h4><a class="anchor" name="commands" href="#commands"><i class="anchor-icon"></i></a>Commands</h4>
<p>A command is a simple <code>/keyword</code> that tells the bot what to do. Telegram apps will:</p>
<ul>
<li><strong>Highlight</strong> commands in messages. When the user taps a highlighted command, that command is immediately sent again.</li>
@ -112,58 +113,61 @@
<li>/newlocation </li>
<li>/newrule </li>
</ul>
<p>Commands should be <strong>as specific as possible</strong> for example <code>/newlocation</code> or <code>/newrule</code> <strong>is better</strong> than a <code>/new</code> command that then requires an additional parameter from the user like "<em>location</em>" or "<em>rule</em>".</p>
<p>Commands should be <strong>as specific as possible</strong> for example <code>/newlocation</code> or <code>/newrule</code> <strong>is better</strong> than a <code>/new</code> command that then requires an additional parameter from the user like &quot;<em>location</em>“ or ”<em>rule</em>&quot;.</p>
<div>
<a href="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" target="_blank"><img src="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" title="Commands" class="dev_page_image" width="44%"></a>
<a href="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" target="_blank"><img src="/file/464001775/10227/HCr0XgSUHrg.119089/c17ff5d34fe528361e" title="Commands" class="dev_page_image"
width=44% /></a>
</div>
<blockquote>
<p>We require <strong>all developers</strong> to support several <a href="#global-commands">Global Commands</a> to make sure Telegram bots offer a consistent and user-friendly experience.</p>
</blockquote>
<h5><a class="anchor" href="#command-scopes" id="command-scopes" name="command-scopes"><i class="anchor-icon"></i></a>Command Scopes</h5>
<p>Your bot is able to <strong>show different commands</strong> to different users and groups  you can control this using <a href="/bots/api#botcommandscope">scopes</a>. For example, your bot could show additional commands to group admins or translate the list based on the users <a href="/bots/api#user">language_code</a>.</p>
<h5><a class="anchor" name="command-scopes" href="#command-scopes"><i class="anchor-icon"></i></a>Command Scopes</h5>
<p>Your bot is able to <strong>show different commands</strong> to different users and groups you can control this using <a href="/bots/api#botcommandscope">scopes</a>. For example, your bot could show additional commands to group admins or translate the list based on the users <a href="/bots/api#user">language_code</a>.</p>
<blockquote>
<p>Keep in mind that Bot API <a href="/bots/api#update">updates</a> <strong>will not contain any information</strong> about the scope of a command sent by the user in fact, they may contain commands that dont exist at all in your bot. Your backend should <strong>always</strong> verify that received commands are valid and that the user was authorized to use them regardless of scope.</p>
</blockquote>
<blockquote>
<p>Bots with privacy mode enabled will only receive commands in groups under special conditions, <a href="#privacy-mode">see here</a>.</p>
</blockquote>
<h4><a class="anchor" href="#keyboards" id="keyboards" name="keyboards"><i class="anchor-icon"></i></a>Keyboards</h4>
<h4><a class="anchor" name="keyboards" href="#keyboards"><i class="anchor-icon"></i></a>Keyboards</h4>
<p>Bots are able to interpret free text input from users, but offering <strong>specific suggestions</strong> is often more intuitive this is where <strong>custom keyboards</strong> can be extremely useful.</p>
<p>Whenever your bot sends a message, it can <strong>display a special keyboard</strong> with predefined reply options (see <a href="/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a>). Telegram apps that receive the message will display your keyboard to the user. Using any of the buttons will immediately send the respective text. This way you can drastically <strong>simplify</strong> and <strong>streamline</strong> user interaction with your bot.</p>
<div>
<a href="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" target="_blank"><img src="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" title="Keyboards" class="dev_page_image" width="44%"></a>
<a href="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" target="_blank"><img src="/file/464001950/1191a/2RwpmgU-swU.123554/b50478c124d5914c23" title="Keyboards" class="dev_page_image" width=44% /></a>
</div>
<blockquote>
<p>Check out the <a href="/bots/api#replykeyboardmarkup">one_time_keyboard</a> parameter to automatically hide your bot's keyboard as soon as it's been used.</p>
<p>Check out the <a href="/bots/api#replykeyboardmarkup">one_time_keyboard</a> parameter to automatically hide your bot&#39;s keyboard as soon as it&#39;s been used.</p>
</blockquote>
<p>You can also <strong>customize the text placeholder</strong> in the input field by setting the <code>input_field_placeholder</code> parameter.</p>
<h4><a class="anchor" href="#inline-keyboards" id="inline-keyboards" name="inline-keyboards"><i class="anchor-icon"></i></a>Inline Keyboards</h4>
<p>There are times when you'd prefer to do things <strong>without sending any messages</strong> to the chat like when a user is changing settings, toggling options or navigating search results. In such cases, you can use <a href="/bots/api#inlinekeyboardmarkup">Inline Keyboards</a> that are shown directly below their relevant messages.</p>
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards <strong>doesn't send messages to the chat</strong>. Instead, inline keyboards support buttons that can work behind the scenes or open different interfaces: <a href="/bots/api#inlinekeyboardbutton">callback buttons</a>, <a href="/bots/api#inlinekeyboardbutton">URL buttons</a>, <a href="/bots/api#inlinekeyboardbutton">switch-to-inline buttons</a>, <a href="/bots/api#inlinekeyboardbutton">game buttons</a> and <a href="/bots/api#inlinekeyboardbutton">payment buttons</a>. </p>
<h4><a class="anchor" name="inline-keyboards" href="#inline-keyboards"><i class="anchor-icon"></i></a>Inline Keyboards</h4>
<p>There are times when you&#39;d prefer to do things <strong>without sending any messages</strong> to the chat like when a user is changing settings, toggling options or navigating search results. In such cases, you can use <a href="/bots/api#inlinekeyboardmarkup">Inline Keyboards</a> that are shown directly below their relevant messages.</p>
<p>Unlike with custom reply keyboards, pressing buttons on inline keyboards <strong>doesn&#39;t send messages to the chat</strong>. Instead, inline keyboards support buttons that can work behind the scenes or open different interfaces: <a href="/bots/api#inlinekeyboardbutton">callback buttons</a>, <a href="/bots/api#inlinekeyboardbutton">URL buttons</a>, <a href="/bots/api#inlinekeyboardbutton">switch-to-inline buttons</a>, <a href="/bots/api#inlinekeyboardbutton">game buttons</a> and <a href="/bots/api#inlinekeyboardbutton">payment buttons</a>. </p>
<div>
<a href="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" target="_blank"><img src="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" title="Inline Keyboard" class="dev_page_image" width="44%"></a>
<a href="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" target="_blank"><img src="/file/464001863/110f3/I47qTXAD9Z4.120010/e0ea04f66357b640ec" title="Inline Keyboard" class="dev_page_image" width=44% /></a>
</div>
<blockquote>
<p>To provide a <strong>better user experience</strong>, consider <a href="/bots/api#editmessagereplymarkup">editing your keyboard</a> when the user toggles a setting button or navigates to a new page this is both <strong>faster</strong> and <strong>smoother</strong> than sending a whole new message and deleting the previous one.</p>
</blockquote>
<h4><a class="anchor" href="#menu-button" id="menu-button" name="menu-button"><i class="anchor-icon"></i></a>Menu Button</h4>
<p>In all bot chats, a menu button appears near the message field. By default, tapping this button <strong>opens a menu</strong> that can hold some or all of a bot's commands, including a short description for each. Users can then <strong>select a command from the menu</strong> without needing to type it out.</p>
<h4><a class="anchor" name="menu-button" href="#menu-button"><i class="anchor-icon"></i></a>Menu Button</h4>
<p>In all bot chats, a menu button appears near the message field. By default, tapping this button <strong>opens a menu</strong> that can hold some or all of a bot&#39;s commands, including a short description for each. Users can then <strong>select a command from the menu</strong> without needing to type it out.</p>
<p>You can set different texts of the menu button and its command descriptions for various <strong>individual users</strong> or <strong>groups of users</strong> for example, showing translated text based on the users language, as explained <a href="#commands">here</a>.</p>
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001581/11d85/f42u9c5Wncg.133752/b5a95b7f1221032d7d" style="max-width: 400px;" title="Bot Menu Button" alt="Video: Bot Menu Button">
<source src="/file/464001555/10fbd/jvTuV2Ke7WQ.1916669.mp4/a056de323645db409d" type="video/mp4">
</source></video>
</video>
</div>
<p>The <strong>menu button</strong> can alternatively be used to launch a <a href="#web-apps">Web App</a>.</p>
<h4><a class="anchor" href="#global-commands" id="global-commands" name="global-commands"><i class="anchor-icon"></i></a>Global Commands</h4>
<h4><a class="anchor" name="global-commands" href="#global-commands"><i class="anchor-icon"></i></a>Global Commands</h4>
<p>To make basic interactions more uniform, we ask all developers to support a few <strong>basic commands</strong>. Telegram apps will have interface shortcuts for these commands.</p>
<ul>
<li>/start - begins the interaction with the user, like sending an introductory message. This command can also be used to pass additional parameters to the bot (see <a href="#deep-linking">Deep Linking</a>).</li>
<li>/help - returns a help message, like a short text about what your bot can do and a list of commands.</li>
<li>/settings - (if applicable) shows the bot's settings for this user and suggests commands to edit them.</li>
<li>/settings - (if applicable) shows the bot&#39;s settings for this user and suggests commands to edit them.</li>
</ul>
<p>Users will see a <strong>Start</strong> button the first time they open a chat with your bot. <strong>Help</strong> and <strong>Settings</strong> links will be available in the menu on the bot's profile page if you add them in <a href="https://t.me/botfather">@BotFather</a>.</p>
<h3><a class="anchor" href="#chat-and-user-selection" id="chat-and-user-selection" name="chat-and-user-selection"><i class="anchor-icon"></i></a>Chat and User Selection</h3>
<p>Users will see a <strong>Start</strong> button the first time they open a chat with your bot. <strong>Help</strong> and <strong>Settings</strong> links will be available in the menu on the bot&#39;s profile page if you add them in <a href="https://t.me/botfather">@BotFather</a>.</p>
<h3><a class="anchor" name="chat-and-user-selection" href="#chat-and-user-selection"><i class="anchor-icon"></i></a>Chat and User Selection</h3>
<p>Bots can present the user with a <strong>friendly</strong> and <strong>intuitive</strong> interface that lists any number of groups, channels or other users according to a custom set of <strong>criteria</strong>. Tapping on a chat will send its identifier to the bot in a service message and seamlessly close the interface.</p>
<p>A group management bot is the <strong>perfect example</strong>: an admin could select a chat the bot should manage, and then select a user it should promote this would happen without ever typing any text.</p>
<p>Here is a <strong>quick start guide</strong> to use this feature:</p>
@ -171,65 +175,66 @@
<li>Pick a set of criteria and store them in a <a href="https://core.telegram.org/bots/api#keyboardbuttonrequestchat">KeyboardButtonRequestChat</a> object (or <a href="https://core.telegram.org/bots/api#keyboardbuttonrequestuser">KeyboardButtonRequestUser</a> for users).</li>
<li>Create a <a href="https://core.telegram.org/bots/api#keyboardbutton">KeyboardButton</a> and store the criteria under <code>request_chat</code> or <code>request_user</code> respectively.</li>
<li>Send a <a href="https://core.telegram.org/bots/api#replykeyboardmarkup">ReplyKeyboardMarkup</a> that contains the button you just created.</li>
<li>When the user selects a chat, you'll receive its identifier in a <code>chat_shared</code> or <code>user_shared</code> service message.</li>
<li>When the user selects a chat, you&#39;ll receive its identifier in a <code>chat_shared</code> or <code>user_shared</code> service message.</li>
</ul>
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" loop="" muted="" poster="/file/464001277/1132d/dAINJNWL9jw.34909/08eaf646c24be49a87" style="max-width: 400px;" title="Select Chats For Bots" alt="Select Chats For Bots" vindex="1" preload="auto">
<source src="/file/464001095/11121/M6HpBwtivTE.1913043.mp4/0514a29affa78a6dca" type="video/mp4">
</source></video>
</video>
</div>
<blockquote>
<p>Keep in mind that the bot may not be able to use the identifier it receives if the corresponding chat or user is not already known or accessible by some other means.</p>
</blockquote>
<hr>
<h3><a class="anchor" href="#interactions" id="interactions" name="interactions"><i class="anchor-icon"></i></a>Interactions</h3>
<h3><a class="anchor" name="interactions" href="#interactions"><i class="anchor-icon"></i></a>Interactions</h3>
<p>In addition to sending commands and messages to the chat with the bot, there are several ways of interacting with them without opening any specific chat or group.</p>
<ul>
<li><a href="#inline-requests"><strong>Inline mode</strong></a> allows sending requests to bots right from the input field from any chat on Telegram.</li>
<li><a href="#deep-linking"><strong>Deep linking</strong></a> allows special links that send certain parameters to the bot when opened.</li>
<li><a href="#attachment-menu"><strong>Attachment menu</strong></a> integration makes it possible to use bots from the attachment menu in chats.</li>
</ul>
<h4><a class="anchor" href="#inline-requests" id="inline-requests" name="inline-requests"><i class="anchor-icon"></i></a>Inline Requests</h4>
<p>Users can interact with your bot via <strong>inline queries</strong> straight from the message field <strong>in any chat</strong>. All they need to do is start a message with your bot's <em>@username</em> and enter a keyword.</p>
<h4><a class="anchor" name="inline-requests" href="#inline-requests"><i class="anchor-icon"></i></a>Inline Requests</h4>
<p>Users can interact with your bot via <strong>inline queries</strong> straight from the message field <strong>in any chat</strong>. All they need to do is start a message with your bot&#39;s <em>@username</em> and enter a keyword.</p>
<p>Having received the query, your bot can return some results. As soon as the user selects one, it is sent to the <strong>relevant chat</strong>. This way, people can request and send content from your bot in any of their chats, groups or channels.</p>
<p>Remember that inline functionality has to be enabled via <a href="https://t.me/botfather">@BotFather</a>, or your bot will not receive inline <a href="/bots/api#update">Updates</a>.</p>
<div>
<a href="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" target="_blank"><img src="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" title="Inline Mode" class="dev_page_image" width="51%/"></a>
<a href="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" target="_blank"><img src="/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2606a53d683374703" title="Inline Mode" class="dev_page_image" width=51%/></a>
</div>
<blockquote>
<p>Examples of inline bots include <a href="https://gif.t.me">@gif</a>, <a href="https://bing.t.me">@bing</a> and <a href="https://wiki.t.me">@wiki</a>. <a href="#web-apps">Web App</a> bots can also be used inline try typing <a href="https://durgerkingbot.t.me">@durgerkingbot</a> in any chat.</p>
</blockquote>
<h4><a class="anchor" href="#deep-linking" id="deep-linking" name="deep-linking"><i class="anchor-icon"></i></a>Deep Linking</h4>
<p>Telegram bots have a deep linking mechanism that allows <strong>additional parameters</strong> to be passed to the bot on startup. It could be a command that launches the bot or an authentication token to connect the user's Telegram account to their account on another platform.</p>
<h4><a class="anchor" name="deep-linking" href="#deep-linking"><i class="anchor-icon"></i></a>Deep Linking</h4>
<p>Telegram bots have a deep linking mechanism that allows <strong>additional parameters</strong> to be passed to the bot on startup. It could be a command that launches the bot or an authentication token to connect the user&#39;s Telegram account to their account on another platform.</p>
<p>Each bot has a link that <strong>opens a conversation</strong> with it in Telegram <code>https://t.me/&lt;bot_username&gt;</code>. Parameters can be added directly to this link to let your bot work with additional information on the fly, without any user input.</p>
<blockquote>
<p>A-Z, a-z, 0-9, _ and - are allowed. We recommend using base64url to encode parameters with binary and other types of content. The parameter can be up to 64 characters long.</p>
</blockquote>
<p><strong>Private Chats</strong>
In private chats, you can use the <code>start</code> parameter to automatically pass any value to your bot whenever a user presses the link. For example, you could use:</p>
<p><strong>Private Chats</strong><br>In private chats, you can use the <code>start</code> parameter to automatically pass any value to your bot whenever a user presses the link. For example, you could use:</p>
<pre><code>https://t.me/your_bot?start=airplane</code></pre>
<p>When someone opens a chat with your bot via this link, you will receive:</p>
<pre><code>/start airplane</code></pre>
<p><strong>Groups</strong>
In groups, you can add the parameter <code>startgroup</code> to this link. For example:</p>
<p><strong>Groups</strong><br>In groups, you can add the parameter <code>startgroup</code> to this link. For example:</p>
<pre><code>https://t.me/your_bot?startgroup=spaceship</code></pre>
<p>Following a link with this parameter prompts the user to select a group to add the bot to the resulting update will contain text in the form:</p>
<pre><code>/start@your_bot spaceship</code></pre>
<blockquote>
<p><a href="#web-apps">Web Apps</a> also support deep linking, for more information check out our <a href="/bots/webapps#adding-bots-to-the-attachment-menu">dedicated guide</a>.</p>
</blockquote>
<h4><a class="anchor" href="#attachment-menu" id="attachment-menu" name="attachment-menu"><i class="anchor-icon"></i></a>Attachment Menu</h4>
<h4><a class="anchor" name="attachment-menu" href="#attachment-menu"><i class="anchor-icon"></i></a>Attachment Menu</h4>
<p>Certain bots can be added directly to a users <strong>attachment menu</strong> giving them easy access to the bot in any chat. Currently, this option is restricted to certain <a href="/bots/webapps#launching-web-apps-from-the-attachment-menu">approved bots</a>, but may be expanded later.</p>
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001491/11651/uwMWNdO29NE.215169/1b37285bbd8fc81244" style="max-width: 400px;" title="Attachment Menu" alt="Video: Bot Attachment Menu">
<source src="/file/464001177/11b03/ruSbBLQiLJ8.928268.mp4/d9ad95048d23f3cc3f" type="video/mp4">
</source></video>
</video>
</div>
<blockquote>
<p>Try adding <a href="https://t.me/durgerkingbot?startattach">@DurgerKingBot</a> to your attachment menu.</p>
</blockquote>
<hr>
<h3><a class="anchor" href="#integration" id="integration" name="integration"><i class="anchor-icon"></i></a>Integration</h3>
<h3><a class="anchor" name="integration" href="#integration"><i class="anchor-icon"></i></a>Integration</h3>
<p>There are various ways of futher integrating bots with Telegram and other services.</p>
<ul>
<li>Use <a href="#web-apps">Web Apps</a> to replace any website.</li>
@ -238,7 +243,7 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
<li>Create gaming bots by integrating <a href="#html5-games">HTML5 Games</a>.</li>
<li>Help users create and manage <a href="#stickers-and-custom-emoji">Telegram Stickers</a>.</li>
</ul>
<h3><a class="anchor" href="#web-apps" id="web-apps" name="web-apps"><i class="anchor-icon"></i></a>Web Apps</h3>
<h3><a class="anchor" name="web-apps" href="#web-apps"><i class="anchor-icon"></i></a>Web Apps</h3>
<p>Bots can easily process <strong>complex inputs</strong> of any kind and <strong>dynamic interaction flows</strong> via <a href="webapps">Web Apps</a>. With this unique feature, you can develop any number of flexible, streamlined interfaces in <strong>JavaScript</strong>.</p>
<blockquote>
<p>Web Apps are covered in detail in our <a href="webapps">dedicated guide</a> you should read it carefully to learn the wide variety of features they can offer.</p>
@ -246,14 +251,15 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001434/100bf/eWprjdgzEbE.100386/644bbea83084f44c8f" style="max-width: 400px;" title="Attachment Menu" alt="Video: Bot Attachment Menu">
<source src="/file/464001679/11aa9/KQx_BlPVXRo.4922145.mp4/c65433c8ac11a347a8" type="video/mp4">
</source></video>
</video>
</div>
<p>If you develop a <strong>Web App</strong>, be sure to follow our <a href="webapps#design-guidelines">design guidelines</a> you'll want your custom interface to <strong>seamlessly integrate</strong> into the app to provide users the best possible experience.</p>
<h3><a class="anchor" href="#payments" id="payments" name="payments"><i class="anchor-icon"></i></a>Payments</h3>
<p>Telegram bots can accept payments with a sleek, streamlined interface that collects all necessary data from the user. Telegram <strong>doesn't collect</strong> any payment data like the user's credit card information and sends it directly to one of the supported <a href="payments#supported-payment-providers">payment providers</a>.</p>
<p>If you develop a <strong>Web App</strong>, be sure to follow our <a href="webapps#design-guidelines">design guidelines</a> you&#39;ll want your custom interface to <strong>seamlessly integrate</strong> into the app to provide users the best possible experience.</p>
<h3><a class="anchor" name="payments" href="#payments"><i class="anchor-icon"></i></a>Payments</h3>
<p>Telegram bots can accept payments with a sleek, streamlined interface that collects all necessary data from the user. Telegram <strong>doesn&#39;t collect</strong> any payment data like the user&#39;s credit card information and sends it directly to one of the supported <a href="payments#supported-payment-providers">payment providers</a>.</p>
<p>Here is a <strong>quick start guide</strong> to implement payments:</p>
<ul>
<li>Pick a <a href="payments#supported-payment-providers">provider</a> and obtain the <a href="payments#getting-a-token">proper token</a> as well as a <strong>test token</strong> from the "<strong>Stripe TEST MODE</strong>" provider.</li>
<li>Pick a <a href="payments#supported-payment-providers">provider</a> and obtain the <a href="payments#getting-a-token">proper token</a> as well as a <strong>test token</strong> from the &quot;<strong>Stripe TEST MODE</strong>&quot; provider.</li>
<li>Implement payments via the <a href="/bots/api#payments">appropriate API methods</a>.</li>
<li>Test your implementation by using your <strong>test token</strong> along with a <a href="https://stripe.com/docs/testing#cards">test credit card</a>.</li>
</ul>
@ -266,37 +272,38 @@ In groups, you can add the parameter <code>startgroup</code> to this link. For e
</ul>
<p>A full and exhaustive guide, including live checklist, parameters and in-depth method descriptions is available <a href="/bots/payments">here</a>. We <strong>strongly recommend</strong> that you read the full guide before going live.</p>
<div>
<a href="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" target="_blank"><img src="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" title="Payments" class="dev_page_image" width="50%"></a>
<a href="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" target="_blank"><img src="/file/464001393/101fc/SB_bFCLR0tg.130549/7ecf91aaa44737e8cb" title="Payments" class="dev_page_image" width=50% /></a>
</div>
<blockquote>
<p>Telegram does not directly process the payments, does not store data about orders and does not collect any fees. Invoices are forwarded directly to the payment provider.
For this reason, disputes must be solved between the user, the bot developer and the payment provider. You can read more about this in the <a href="https://telegram.org/privacy#7-third-party-payment-services">Privacy Policy</a>.</p>
<p>Telegram does not directly process the payments, does not store data about orders and does not collect any fees. Invoices are forwarded directly to the payment provider.<br>For this reason, disputes must be solved between the user, the bot developer and the payment provider. You can read more about this in the <a href="https://telegram.org/privacy#7-third-party-payment-services">Privacy Policy</a>.</p>
</blockquote>
<h3><a class="anchor" href="#web-login" id="web-login" name="web-login"><i class="anchor-icon"></i></a>Web Login</h3>
<h3><a class="anchor" name="web-login" href="#web-login"><i class="anchor-icon"></i></a>Web Login</h3>
<p>Telegram offers a <strong>flexible</strong>, <strong>lightweight</strong> and <strong>free</strong> framework to authenticate users on any website and app. This can be used to bridge your platform with Telegram, providing a smooth experience to your users. You can also freely rely on this framework to implement a <strong>fast</strong> and <strong>signup-free</strong> login on your site, regardless of its connection to Telegram.</p>
<h4><a class="anchor" href="#widgets" id="widgets" name="widgets"><i class="anchor-icon"></i></a>Widgets</h4>
<h4><a class="anchor" name="widgets" href="#widgets"><i class="anchor-icon"></i></a>Widgets</h4>
<p>The Telegram login widget is a <strong>simple and secure way to authorize users</strong> on your website.</p>
<ol>
<li>Choose a bot ideally its name and profile pic <strong>should match</strong> the website title and logo.</li>
<li>Use the <code>/setdomain</code> command in <a href="https://t.me/botfather">@BotFather</a> to pair the bot with your website domain. </li>
<li>Configure your widget using <a href="/widgets/login#widget-configuration">our dedicated tool</a> and embed it on your website.</li>
</ol>
<h4><a class="anchor" href="#inline-login" id="inline-login" name="inline-login"><i class="anchor-icon"></i></a>Inline Login</h4>
<p>When users open your website via an <strong>inline button</strong>, you can use the <a href="/bots/api#loginurl">login_url</a> parameter as an alternative to login widgets. This way, you'll be able to <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots">seamlessly authorize</a> them on your website or app before the page even loads.</p>
<h4><a class="anchor" name="inline-login" href="#inline-login"><i class="anchor-icon"></i></a>Inline Login</h4>
<p>When users open your website via an <strong>inline button</strong>, you can use the <a href="/bots/api#loginurl">login_url</a> parameter as an alternative to login widgets. This way, you&#39;ll be able to <a href="https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots">seamlessly authorize</a> them on your website or app before the page even loads.</p>
<div>
<a href="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" target="_blank"><img src="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" width="50%" title="Login Widget" class="dev_page_image"></a>
<a href="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" target="_blank"><img src="/file/464001287/105ea/23bO4ntH4tc.43741/c9624e36c3462b6540" width=50% title="Login Widget" class="dev_page_image" /></a>
</div>
<blockquote>
<p>Make sure to review our <a href="/widgets/login#checking-authorization">guide</a> on authenticating the received data as well as our <a href="https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2">sample code</a>.</p>
</blockquote>
<h3><a class="anchor" href="#html5-games" id="html5-games" name="html5-games"><i class="anchor-icon"></i></a>HTML5 Games</h3>
<h3><a class="anchor" name="html5-games" href="#html5-games"><i class="anchor-icon"></i></a>HTML5 Games</h3>
<p>Bots can serve as <strong>standalone gaming platforms</strong> with our <a href="/bots/api#games">HTML5 Gaming API</a> you can develop multiplayer or single-player games and let your users have fun comparing <strong>ranks</strong>, <strong>scores</strong> and much more.</p>
<p>To get started, follow these simple steps:</p>
<ul>
<li>Send the <code>/newgame</code> command to <a href="https://t.me/botfather">@BotFather</a></li>
<li>Provide a <strong>description text</strong>, an <strong>image</strong> or an <strong>optional gif</strong> to showcase its gameplay</li>
<li>Send the game to users via the <a href="/bots/api#sendgame">sendGame</a> method or via an <a href="/bots/api#inlinequeryresultgame">inline query</a></li>
<li>When someone wants to play, you'll receive the appropriate <code>game_short_name</code> in a <a href="/bots/api#callbackquery">CallbackQuery</a></li>
<li>When someone wants to play, you&#39;ll receive the appropriate <code>game_short_name</code> in a <a href="/bots/api#callbackquery">CallbackQuery</a></li>
<li>To launch the game, provide the <strong>HTML5 Game URL</strong> as the <code>url</code> param of <a href="/bots/api#answercallbackquery">answerCallbackQuery</a></li>
</ul>
<p>Then, to handle <strong>highscores</strong>:</p>
@ -310,50 +317,49 @@ For this reason, disputes must be solved between the user, the bot developer and
<li><a href="/bots/api#games">HTML5 Games Bot API Docs</a></li>
</ul>
<div>
<a href="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" target="_blank"><img src="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" title="Games" width="50%" class="dev_page_image"></a>
<a href="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" target="_blank"><img src="/file/464001558/11b92/y_Fu9QQWtj0.141959/dc9db48f66800bf271" title="Games" width=50% class="dev_page_image" /></a>
</div>
<blockquote>
<p>Check out <a href="https://t.me/gamebot">@GameBot</a> and <a href="https://t.me/gamee">@gamee</a> for examples of what you can do using our Gaming Platform.</p>
</blockquote>
<h3><a class="anchor" href="#stickers-and-custom-emoji" id="stickers-and-custom-emoji" name="stickers-and-custom-emoji"><i class="anchor-icon"></i></a>Stickers and Custom Emoji</h3>
<h3><a class="anchor" name="stickers-and-custom-emoji" href="#stickers-and-custom-emoji"><i class="anchor-icon"></i></a>Stickers and Custom Emoji</h3>
<p><a href="https://core.telegram.org/stickers">Stickers</a> and <a href="https://telegram.org/blog/custom-emoji">Custom Emoji</a> are a distinctive Telegram feature used by millions of users to share artwork every day. Stickers and custom emoji take many forms ranging from <strong>basic images</strong> to smooth <strong>vector animations</strong> and high-detail <strong>.WEBM videos</strong>.</p>
<p>All these formats are supported by our <a href="api#stickers">Bot API</a>, which allows bots to <strong>create</strong>, <strong>edit</strong>, <strong>delete</strong> and <strong>share</strong> new artwork packs on the fly. Telegram's <a href="https://core.telegram.org/import-stickers">Import API</a> lets users <strong>migrate packs</strong> from other platforms and sticker apps.</p>
<p><strong>Creating a new pack</strong>
To create a <strong>new pack</strong>, simply:</p>
<p>All these formats are supported by our <a href="api#stickers">Bot API</a>, which allows bots to <strong>create</strong>, <strong>edit</strong>, <strong>delete</strong> and <strong>share</strong> new artwork packs on the fly. Telegram&#39;s <a href="https://core.telegram.org/import-stickers">Import API</a> lets users <strong>migrate packs</strong> from other platforms and sticker apps.</p>
<p><strong>Creating a new pack</strong><br>To create a <strong>new pack</strong>, simply:</p>
<ul>
<li><strong>Prepare</strong> your artwork following our <a href="https://core.telegram.org/stickers">technical requirements</a>.</li>
<li><strong>Create</strong> a new sticker pack via <a href="api#createnewstickerset">createStickerSet</a>. Set <code>sticker_type</code> to <em>regular</em> to create a sticker pack or to <em>custom emoji</em> to create a pack of custom emoji. Attach the <a href="api#file">files</a> you wish to include in the pack as an array of <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a></li>
<li>You can use <a href="api#addstickertoset">addStickerToSet</a> to add stickers or emoji later on.</li>
</ul>
<p><strong>Additional features</strong>
Regular stickers and custom emoji support <strong>keywords</strong> that users can type to quickly find the respective artwork this can be useful when a sticker doesn't have obvious ties to a specific emoji. You can use the <code>keywords</code> parameter in <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a> to specify them.</p>
<p><strong>Additional features</strong><br>Regular stickers and custom emoji support <strong>keywords</strong> that users can type to quickly find the respective artwork this can be useful when a sticker doesn&#39;t have obvious ties to a specific emoji. You can use the <code>keywords</code> parameter in <a href="https://core.telegram.org/bots#inputsticker">InputSticker</a> to specify them.</p>
<p>Custom emoji additionally support <strong>adaptive colors</strong> they will always match the current context (e.g., white on photos, accent color when used as status, etc.); to enable this feature, use the <code>needs_repainting</code> parameter in <a href="api#createnewstickerset">createStickerSet</a>.</p>
<p>Once you're done creating and sharing your artwork, don't forget to check out our <a href="api#stickers">remaining sticker methods</a> to find out how to <a href="api#setstickersetthumb">edit</a>, <a href="api#deletestickerfromset">delete</a> and even <a href="api#setstickerpositioninset">reorder</a> your pack. </p>
<p>Once you&#39;re done creating and sharing your artwork, don&#39;t forget to check out our <a href="api#stickers">remaining sticker methods</a> to find out how to <a href="api#setstickersetthumb">edit</a>, <a href="api#deletestickerfromset">delete</a> and even <a href="api#setstickerpositioninset">reorder</a> your pack. </p>
<blockquote>
<p>Note that these methods will only work on packs <strong>created by the bot that is calling them</strong>.</p>
</blockquote>
<h3><a class="anchor" href="#language-support" id="language-support" name="language-support"><i class="anchor-icon"></i></a>Language Support</h3>
<h3><a class="anchor" name="language-support" href="#language-support"><i class="anchor-icon"></i></a>Language Support</h3>
<p>Bots can tailor their interfaces to <strong>support multiple languages</strong> updating inputs and information on the fly. A users <a href="/bots/api#user">language_code</a> is included in every relevant <a href="/bots/api#update">update</a> as an <a href="https://en.wikipedia.org/wiki/IETF_language_tag">IETF language tag</a>, allowing bots to adapt accordingly. </p>
<p>We recommend that you follow our guidelines to provide <strong>the best user experience</strong>.</p>
<ul>
<li>Your interfaces, texts and <a href="/bots/api#answerinlinequery">inline results</a> should adapt seamlessly to the <em>language_code</em>, without user intervention.</li>
<li>Connected <a href="/bots/webapps">WebApps</a> will receive the user's <em>language_code</em> your HTML page should account for it.</li>
<li>Connected <a href="/bots/webapps">WebApps</a> will receive the user&#39;s <em>language_code</em> your HTML page should account for it.</li>
<li><a href="/bots/games">HTML5 Games</a> can obtain language information if you specify it as a <a href="/bots/games#using-url-parameters">URL parameter</a>. You can generate this parameter from the <em>language_code</em> field in the <a href="/bots/api#user">User</a> object served with the initial game <a href="/bots/api#callbackquery">CallbackQuery</a>.</li>
<li>The bot's <strong>Name</strong>, <strong>Description</strong> and <strong>About text</strong> can be natively localized with the respective <a href="https://core.telegram.org/bots/api#setmydescription">methods</a>.</li>
<li>The bot&#39;s <strong>Name</strong>, <strong>Description</strong> and <strong>About text</strong> can be natively localized with the respective <a href="https://core.telegram.org/bots/api#setmydescription">methods</a>.</li>
<li>Command lists can also be specified for individual languages more on this <a href="#commands">here</a>.</li>
</ul>
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;">
<video class="blog_video_player tl_blog_vid_autoplay" onclick="videoTogglePlay(this)" autoplay="" loop="" controls="" muted="" poster="/file/464001822/10cd0/EvtvjnhA-kA.132475/e285952b505535d85a" style="max-width: 400px;" title="Language Support" alt="Video: Language Support">
<source src="/file/464001083/105cd/NF4ViAHfTJc.3601652.mp4/0fd787953c11a6371d" type="video/mp4">
</source></video>
</video>
</div>
<blockquote>
<p>The <em>language_code</em> is an <strong>optional field</strong> it could be empty.
If you target the general public, your code should always fall back to either the last recorded language tag or English (in this order) when the field is missing for a specific user. </p>
<p>The <em>language_code</em> is an <strong>optional field</strong> it could be empty.<br>If you target the general public, your code should always fall back to either the last recorded language tag or English (in this order) when the field is missing for a specific user. </p>
</blockquote>
<hr>
<h3><a class="anchor" href="#bot-management" id="bot-management" name="bot-management"><i class="anchor-icon"></i></a>Bot Management</h3>
<h4><a class="anchor" href="#privacy-mode" id="privacy-mode" name="privacy-mode"><i class="anchor-icon"></i></a>Privacy Mode</h4>
<h3><a class="anchor" name="bot-management" href="#bot-management"><i class="anchor-icon"></i></a>Bot Management</h3>
<h4><a class="anchor" name="privacy-mode" href="#privacy-mode"><i class="anchor-icon"></i></a>Privacy Mode</h4>
<p>Bots are frequently added to groups to perform basic tasks or assist moderators like automatically posting company announcements or even celebrating birthdays. By default, <strong>all bots</strong> added to groups run in Privacy Mode and only see relevant messages and commands:</p>
<ul>
<li>Commands explicitly meant for them (e.g., <code>/command@this_bot</code>).</li>
@ -367,20 +373,21 @@ If you target the general public, your code should always fall back to either th
<li>All messages from private chats.</li>
<li>All messages from channels where they are a member.</li>
</ul>
<p>Privacy mode is <strong>enabled by default</strong> for all bots, except bots that were added to a group as admins (bot admins always receive <strong>all messages</strong>). It can be disabled so that the bot receives all messages like an ordinary user (the bot will need to be re-added to the group for this change to take effect). We only recommend doing this in cases where it is <strong>absolutely necessary</strong> for your bot to work. In most cases, using the force reply option for the bot's messages should be more than enough.</p>
<p>Privacy mode is <strong>enabled by default</strong> for all bots, except bots that were added to a group as admins (bot admins always receive <strong>all messages</strong>). It can be disabled so that the bot receives all messages like an ordinary user (the bot will need to be re-added to the group for this change to take effect). We only recommend doing this in cases where it is <strong>absolutely necessary</strong> for your bot to work. In most cases, using the force reply option for the bot&#39;s messages should be more than enough.</p>
<div>
<a href="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" target="_blank"><img src="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" title="Privacy Mode" class="dev_page_image" width="50%/"></a>
<a href="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" target="_blank"><img src="/file/464001338/107af/JdbERa0BATg.62371/28977e9a96aed3860a" title="Privacy Mode" class="dev_page_image" width=50%/></a>
</div>
<blockquote>
<p>This mode not only increases user privacy, but also makes the bot more efficient by reducing the number of inputs it needs to process. Users can always see a bots current privacy setting in the list of group members.</p>
</blockquote>
<h3><a class="anchor" href="#testing-your-bot" id="testing-your-bot" name="testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h3>
<h3><a class="anchor" name="testing-your-bot" href="#testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h3>
<p>You can quickly test your bot <strong>without interfering</strong> with its users by simply running another instance of your code on a different bot account. To do so, create a <em>new bot</em> via <a href="https://t.me/botfather">@BotFather</a>, obtain its token and use it in the testing instance of your code.</p>
<p>All further testing and debugging can happen privately on the new bot, without affecting the original instance.</p>
<blockquote>
<p>If you need to share file references across bots, note that the <code>file_id</code> field is tied to a single bot id, so your test instance cannot use a shared <code>file_id</code> database to quickly send media files must be individually reuploaded.</p>
</blockquote>
<h4><a class="anchor" href="#dedicated-test-environment" id="dedicated-test-environment" name="dedicated-test-environment"><i class="anchor-icon"></i></a>Dedicated test environment</h4>
<h4><a class="anchor" name="dedicated-test-environment" href="#dedicated-test-environment"><i class="anchor-icon"></i></a>Dedicated test environment</h4>
<p>Telegram also offers a dedicated <strong>test environment</strong> suitable for more advanced testing. Bots and users in this environment generally have more flexible restrictions for example:</p>
<ul>
<li>When working with the test environment, you may use HTTP links without TLS to test your <a href="https://core.telegram.org/bots/features#web-apps">Web Apps</a> or <a href="https://core.telegram.org/bots/features#web-login">Web Login</a>.</li>
@ -389,62 +396,55 @@ If you target the general public, your code should always fall back to either th
<blockquote>
<p><strong>Flood limits</strong> are not raised in the test environment, and may at times be stricter. To minimize how this impacts your bot, you should make sure that it handles errors with retry policies and does not depend on hardcoded limit values.</p>
</blockquote>
<h4><a class="anchor" href="#creating-a-bot-in-the-test-environment" id="creating-a-bot-in-the-test-environment" name="creating-a-bot-in-the-test-environment"><i class="anchor-icon"></i></a>Creating a bot in the test environment</h4>
<h4><a class="anchor" name="creating-a-bot-in-the-test-environment" href="#creating-a-bot-in-the-test-environment"><i class="anchor-icon"></i></a>Creating a bot in the test environment</h4>
<p>The test environment is <strong>completely separate</strong> from the main environment, so you will need to create a new user account and a new bot with <a href="https://t.me/botfather">@BotFather</a>.</p>
<p>To create an account and log in, use either of the following:</p>
<ul>
<li><strong>iOS</strong>: tap 10 times on the Settings icon &gt; Accounts &gt; Login to another account &gt; Test.</li>
<li><strong>Telegram Desktop</strong>: open ☰ Settings &gt; Shift + Alt + Right click 'Add Account' and select 'Test Server'.</li>
<li><strong>macOS</strong>: click the Settings icon 10 times to open the Debug Menu, ⌘ + click 'Add Account' and log in via phone number.</li>
<li><strong>Telegram Desktop</strong>: open ☰ Settings &gt; Shift + Alt + Right click &#39;Add Account&#39; and select &#39;Test Server&#39;.</li>
<li><strong>macOS</strong>: click the Settings icon 10 times to open the Debug Menu, ⌘ + click &#39;Add Account&#39; and log in via phone number.</li>
</ul>
<p>After logging in, simply <a href="#creating-a-new-bot">create a new bot</a> following the standard procedure and send your requests to the Test Bot API in this format:</p>
<pre><code>https://api.telegram.org/bot&lt;token&gt;/test/METHOD_NAME</code></pre>
<blockquote>
<p>When working with the test environment, you may use HTTP links without TLS in the <code>url</code> field of both <a href="/bots/api#loginurl">LoginUrl</a> and <a href="/bots/api#webappinfo">WebAppInfo</a>.</p>
</blockquote>
<h4><a class="anchor" href="#status-alerts" id="status-alerts" name="status-alerts"><i class="anchor-icon"></i></a>Status alerts</h4>
<h4><a class="anchor" name="status-alerts" href="#status-alerts"><i class="anchor-icon"></i></a>Status alerts</h4>
<p>Millions choose Telegram for its speed. To best benefit users, your bot also <strong>needs to be responsive</strong>. In order to help developers keep their bots in shape, <a href="https://t.me/botfather">@BotFather</a> will send <strong>status alerts</strong> if it sees something is wrong.</p>
<p>We check the number of replies and the <em>request/response</em> conversion rate for popular bots (~300 requests per minute, this value may change in the future). If your bot returns an <strong>abnormally low number</strong>, you will receive a notification from <a href="https://t.me/botfather">@BotFather</a>.</p>
<h5><a class="anchor" href="#responding-to-alerts" id="responding-to-alerts" name="responding-to-alerts"><i class="anchor-icon"></i></a>Responding to alerts</h5>
<h5><a class="anchor" name="responding-to-alerts" href="#responding-to-alerts"><i class="anchor-icon"></i></a>Responding to alerts</h5>
<p>By default, <strong>you will only get one alert per bot per hour</strong>. </p>
<p>Each alert has the following buttons:</p>
<ul>
<li><strong>Fixed</strong> - Use this if you found an issue with your bot and fixed it. If you press the fix button, we will resume sending alerts in the regular way so that you can see if your fix worked within 5-10 minutes instead of having to wait for an hour.</li>
<li><strong>Support</strong> - Use this to open a chat with <a href="https://t.me/botsupport">@BotSupport</a> if you don't see any issues with your bot or if you think the problem is on our side.</li>
<li><strong>Mute for 8h/1w</strong> - Use this if you can't fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. <strong>We do not recommend</strong> using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot's settings via <a href="https://t.me/botfather">@BotFather</a>.</li>
<li><strong>Support</strong> - Use this to open a chat with <a href="https://t.me/botsupport">@BotSupport</a> if you don&#39;t see any issues with your bot or if you think the problem is on our side.</li>
<li><strong>Mute for 8h/1w</strong> - Use this if you can&#39;t fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. <strong>We do not recommend</strong> using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot&#39;s settings via <a href="https://t.me/botfather">@BotFather</a>.</li>
</ul>
<h5><a class="anchor" href="#monitored-issues" id="monitored-issues" name="monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
<h5><a class="anchor" name="monitored-issues" href="#monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
<p>We currently notify you about the following issues:</p>
<ul>
<li>
<p><strong>Too few private messages are sent.</strong> Value: <strong>{value}</strong> - Your bot is sending far fewer messages than it did in previous weeks. This is useful for newsletter-style bots that send messages without prompts from users. The larger the value, the more significant the difference.</p>
<li><p><strong>Too few private messages are sent.</strong> Value: <strong>{value}</strong> - Your bot is sending far fewer messages than it did in previous weeks. This is useful for newsletter-style bots that send messages without prompts from users. The larger the value, the more significant the difference.</p>
</li>
<li>
<p><strong>Too few replies to incoming private messages</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all messages that are being sent to it (the request/response conversion rate for your bot was too low for at least two of the last three 5-minute periods). </p>
<li><p><strong>Too few replies to incoming private messages</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all messages that are being sent to it (the request/response conversion rate for your bot was too low for at least two of the last three 5-minute periods). </p>
</li>
</ul>
<blockquote>
<p>To provide a good user experience, please respond to all messages that are sent to your bot. Respond to message updates by calling send… methods (e.g. <a href="/bots/api#sendmessage">sendMessage</a>).</p>
</blockquote>
<ul>
<li>
<p><strong>Too few answers to inline queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to <code>inline_query</code> updates by calling <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</p>
</li>
<li>
<p><strong>Too few answers to callback queries</strong>. Conversion rate: <strong>{value}</strong></p>
</li>
<li>
<p><strong>Too few answers to callback game queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all callback queries that are being sent to it (with or without games), calculated in the same way as above. Respond to <code>callback_query</code> updates by calling <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</p>
</li>
<li><strong>Too few answers to inline queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to <code>inline_query</code> updates by calling <a href="/bots/api#answerinlinequery">answerInlineQuery</a>.</li>
</ul>
<h4><a class="anchor" href="#local-bot-api" id="local-bot-api" name="local-bot-api"><i class="anchor-icon"></i></a>Local Bot API</h4>
<p>You can host and work with <strong>your own instance</strong> of our open-source <a href="/bots/api">Bot API</a>.
The <strong>source code</strong> is available <a href="https://github.com/tdlib/telegram-bot-api">here</a>, along with a quick <a href="https://github.com/tdlib/telegram-bot-api#installation">installation guide</a>.</p>
<ul>
<li><strong>Too few answers to callback queries</strong>. Conversion rate: <strong>{value}</strong></li>
<li><strong>Too few answers to callback game queries</strong>. Conversion rate: <strong>{value}</strong> - Your bot is not replying to all callback queries that are being sent to it (with or without games), calculated in the same way as above. Respond to <code>callback_query</code> updates by calling <a href="/bots/api#answercallbackquery">answerCallbackQuery</a>.</li>
</ul>
<h4><a class="anchor" name="local-bot-api" href="#local-bot-api"><i class="anchor-icon"></i></a>Local Bot API</h4>
<p>You can host and work with <strong>your own instance</strong> of our open-source <a href="/bots/api">Bot API</a>.<br>The <strong>source code</strong> is available <a href="https://github.com/tdlib/telegram-bot-api">here</a>, along with a quick <a href="https://github.com/tdlib/telegram-bot-api#installation">installation guide</a>.</p>
<p>After <strong>installing the server</strong>, remember to use the <a href="/bots/api#logout">logOut</a> method before <strong>redirecting requests</strong> to your new local API URL.</p>
<blockquote>
<p>Your local instance runs on port <code>8081</code> by default and will only accept HTTP requests, so a TLS termination proxy has to be used to handle remote HTTPS requests.</p>
</blockquote>
<p>By hosting our API locally you'll gain access to <strong>some upgrades</strong>, including:</p>
<p>By hosting our API locally you&#39;ll gain access to <strong>some upgrades</strong>, including:</p>
<table class="table">
<thead>
<tr>
@ -476,36 +476,31 @@ The <strong>source code</strong> is available <a href="https://github.com/tdlib/
</tbody>
</table>
<blockquote>
<p>You can find an exhaustive list <a href="/bots/api#using-a-local-bot-api-server">here</a>.
All limits may be subject to change in the future, so make sure to follow <a href="https://t.me/botnews">@BotNews</a>.</p>
<p>You can find an exhaustive list <a href="/bots/api#using-a-local-bot-api-server">here</a>.<br>All limits may be subject to change in the future, so make sure to follow <a href="https://t.me/botnews">@BotNews</a>.</p>
</blockquote>
<hr>
<h3><a class="anchor" href="#botfather" id="botfather" name="botfather"><i class="anchor-icon"></i></a>BotFather</h3>
<h3><a class="anchor" name="botfather" href="#botfather"><i class="anchor-icon"></i></a>BotFather</h3>
<p>Below is a detailed guide to using <a href="https://t.me/botfather">@BotFather</a>, Telegrams tool for <strong>creating</strong> and <strong>managing</strong> bots.</p>
<h4><a class="anchor" href="#creating-a-new-bot" id="creating-a-new-bot" name="creating-a-new-bot"><i class="anchor-icon"></i></a>Creating a new bot</h4>
<h4><a class="anchor" name="creating-a-new-bot" href="#creating-a-new-bot"><i class="anchor-icon"></i></a>Creating a new bot</h4>
<p>Use the <code>/newbot</code> command to create a new bot. <a href="https://t.me/botfather">@BotFather</a> will ask you for a name and username, then generate an authentication token for your new bot.</p>
<ul>
<li>
<p>The <strong>name</strong> of your bot is displayed in contact details and elsewhere.</p>
<li><p>The <strong>name</strong> of your bot is displayed in contact details and elsewhere.</p>
</li>
<li>
<p>The <strong>username</strong> is a short name, used in search, mentions and t.me links. Usernames are 5-32 characters long and not case sensitive but may only include Latin characters, numbers, and underscores. Your bot's username must end in 'bot, like 'tetris_bot' or 'TetrisBot'.</p>
<li><p>The <strong>username</strong> is a short name, used in search, mentions and t.me links. Usernames are 5-32 characters long and not case sensitive but may only include Latin characters, numbers, and underscores. Your bot&#39;s username must end in &#39;bot, like &#39;tetris_bot&#39; or &#39;TetrisBot&#39;.</p>
</li>
<li>
<p>The <strong>token</strong> is a string, like <code>110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw</code>, which is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot. </p>
<li><p>The <strong>token</strong> is a string, like <code>110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw</code>, which is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot. </p>
</li>
</ul>
<blockquote>
<p>Unlike the bots name, the username cannot be changed later so choose it carefully.
When sending a request to api.telegram.org, remember to prefix the word bot to your token.</p>
<p>Unlike the bots name, the username cannot be changed later so choose it carefully.<br>When sending a request to api.telegram.org, remember to prefix the word bot to your token.</p>
</blockquote>
<h4><a class="anchor" href="#about-text-description-and-profile-media" id="about-text-description-and-profile-media" name="about-text-description-and-profile-media"><i class="anchor-icon"></i></a>About text, description and profile media</h4>
<p>When new users open your bot, they will be met with a helpful description in a box titled "What can this bot do?".</p>
<h4><a class="anchor" name="about-text-description-and-profile-media" href="#about-text-description-and-profile-media"><i class="anchor-icon"></i></a>About text, description and profile media</h4>
<p>When new users open your bot, they will be met with a helpful description in a box titled “What can this bot do?”.</p>
<p>Properly <a href="#edit-bots">setting this field</a> in <a href="https://t.me/botfather">@BotFather</a> allows everyone to immediately get an idea of what your bot can do your description should be <strong>brief</strong>, <strong>to the point</strong> and <strong>on topic</strong>.</p>
<blockquote>
<p>You can also add a photo or video to this field with <code>Edit Description Picture</code> in <a href="https://t.me/botfather">@BotFather</a>.</p>
</blockquote>
<p>Additionally, just like normal users, bots also come with a <strong>short bio</strong> available on their profile. If you didn't specify this field while first creating your bot, you can set it at any time with the <code>/setabouttext</code> command in <a href="https://t.me/botfather">@BotFather</a>. Users can interact with many bots and they won't have access to their description after starting them having a quick reminder of the bot's purpose can be very useful.</p>
<p>Additionally, just like normal users, bots also come with a <strong>short bio</strong> available on their profile. If you didn&#39;t specify this field while first creating your bot, you can set it at any time with the <code>/setabouttext</code> command in <a href="https://t.me/botfather">@BotFather</a>. Users can interact with many bots and they won&#39;t have access to their description after starting them having a quick reminder of the bot&#39;s purpose can be very useful.</p>
<blockquote>
<p>Note that both the <strong>Description</strong> and the <strong>About text</strong> can be <a href="https://core.telegram.org/bots/api#setmydescription">natively localized</a> each user will automatically see the correct translation for their language.</p>
</blockquote>
@ -513,38 +508,36 @@ When sending a request to api.telegram.org, remember to prefix the word bot
<blockquote>
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot directly from its profile page including setting a custom <strong>profile video</strong>.</p>
</blockquote>
<h4><a class="anchor" href="#generating-an-authentication-token" id="generating-an-authentication-token" name="generating-an-authentication-token"><i class="anchor-icon"></i></a>Generating an authentication token</h4>
<h4><a class="anchor" name="generating-an-authentication-token" href="#generating-an-authentication-token"><i class="anchor-icon"></i></a>Generating an authentication token</h4>
<p>If your existing token is <strong>compromised</strong> or <strong>you lost it</strong> for some reason, use the <code>/token</code> command to generate a new one.</p>
<h4><a class="anchor" href="#transfer-ownership" id="transfer-ownership" name="transfer-ownership"><i class="anchor-icon"></i></a>Transfer ownership</h4>
<p>You can transfer ownership of your bot <strong>to another user</strong>.
To do this, send <code>/mybots</code>, select your bot, then <em>transfer ownership</em>.
You can only transfer a bot to users who have interacted with it at least once.</p>
<h4><a class="anchor" name="transfer-ownership" href="#transfer-ownership"><i class="anchor-icon"></i></a>Transfer ownership</h4>
<p>You can transfer ownership of your bot <strong>to another user</strong>.<br>To do this, send <code>/mybots</code>, select your bot, then <em>transfer ownership</em>.<br>You can only transfer a bot to users who have interacted with it at least once.</p>
<blockquote>
<p>Transferring ownership will give full control of the bot to another user they will be able to access the bots messages and even delete it. The transfer is permanent, so please consider it carefully.</p>
</blockquote>
<h4><a class="anchor" href="#botfather-commands" id="botfather-commands" name="botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4>
<h4><a class="anchor" name="botfather-commands" href="#botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4>
<p>The remaining commands are pretty self-explanatory:</p>
<ul>
<li>/mybots returns a list of your bots with handy controls to edit their settings.</li>
<li>/mygames does the same for your games.</li>
</ul>
<h4><a class="anchor" href="#edit-bots" id="edit-bots" name="edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4>
<h4><a class="anchor" name="edit-bots" href="#edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4>
<p>To edit your bot, you have two options.</p>
<p>You can use the available commands:</p>
<ul>
<li>/setname change your bot's <strong>name</strong>.</li>
<li>/setdescription change the bot's <strong>description</strong> (short text up to 512 characters). Users will see this text at the beginning of the conversation with the bot, titled '<em>What can this bot do?</em>'.</li>
<li>/setabouttext change the bot's <strong>about info</strong>, a shorter text up to 120 characters. Users will see this text on the bot's profile page. When they share your bot with someone, this text is sent together with the link.</li>
<li>/setuserpic change the bot's <strong>profile picture</strong>. </li>
<li>/setname change your bot&#39;s <strong>name</strong>.</li>
<li>/setdescription change the bot&#39;s <strong>description</strong> (short text up to 512 characters). Users will see this text at the beginning of the conversation with the bot, titled &#39;<em>What can this bot do?</em>&#39;.</li>
<li>/setabouttext change the bot&#39;s <strong>about info</strong>, a shorter text up to 120 characters. Users will see this text on the bot&#39;s profile page. When they share your bot with someone, this text is sent together with the link.</li>
<li>/setuserpic change the bot&#39;s <strong>profile picture</strong>. </li>
<li>/setcommands change the list of <strong>commands</strong> supported by your bot. Users will see these commands as suggestions when they type <code>/</code> in the chat with your bot. See <a href="#commands">commands</a> for more info.</li>
<li>/setdomain link a <strong>website domain</strong> to your bot. See the <a href="#login-widget">login widget</a> section.</li>
<li>/deletebot delete your bot and <strong>free its username</strong>. Cannot be undone.</li>
</ul>
<p>Or you can use the <code>/mybots</code> command, tap on your bot and use the modern inline interface to edit it.</p>
<blockquote>
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot's public-facing info directly from its profile page including setting a custom <strong>profile video</strong>.</p>
<p>Starting from April 21, 2023 (<a href="https://telegram.org/blog/shareable-folders-custom-wallpapers">Telegram 9.6</a>), you can edit your bot&#39;s public-facing info directly from its profile page including setting a custom <strong>profile video</strong>.</p>
</blockquote>
<h4><a class="anchor" href="#edit-settings" id="edit-settings" name="edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4>
<h4><a class="anchor" name="edit-settings" href="#edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4>
<ul>
<li>/setinline toggle <strong>inline mode</strong> for your bot.</li>
<li>/setinlinegeo request <strong>location data</strong> to provide location-based inline results.</li>
@ -552,7 +545,7 @@ You can only transfer a bot to users who have interacted with it at least once.<
<li>/setinlinefeedback toggle whether the API should <strong>send updates about the results</strong> chosen by users. See an in-depth explanation <a href="/bots/inline#collecting-feedback">here</a>.</li>
<li>/setprivacy set which messages your bot will receive when added to a group. See <a href="#privacy-mode">privacy-mode</a> for more info.</li>
</ul>
<h4><a class="anchor" href="#manage-games" id="manage-games" name="manage-games"><i class="anchor-icon"></i></a>Manage games</h4>
<h4><a class="anchor" name="manage-games" href="#manage-games"><i class="anchor-icon"></i></a>Manage games</h4>
<ul>
<li>/newgame create a new game.</li>
<li>/listgames see a list of your games.</li>
@ -566,8 +559,9 @@ You can only transfer a bot to users who have interacted with it at least once.<
<p>With this information, you are ready to proceed to our <a href="/bots/api">Full API Reference for Developers</a>.</p>
<ul>
<li>If you have any questions, check out our <a href="/bots/faq">Bot FAQ</a>.</li>
<li>If you're experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li>
</ul></div>
<li>If you&#39;re experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li>
</ul>
</div>
</div>

View file

@ -53,9 +53,9 @@
<h5><a class="anchor" href="#1-client-sends-query-to-server" id="1-client-sends-query-to-server" name="1-client-sends-query-to-server"><i class="anchor-icon"></i></a>1) Client sends query to server</h5>
<!-- start req_pq_multi -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 CC EF 06 00 59 96 9E 64
0010 | 14 00 00 00 F1 8E 7E BE 3B 6C E1 1B ED C3 46 61
0020 | B0 E7 0F 88 33 91 0C 6F</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 54 BC 00 00 FF 9A 9E 64
0010 | 14 00 00 00 F1 8E 7E BE DA 60 3B 0B 6C 74 D6 0E
0020 | C9 4A 04 D8 3A F2 02 7D</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre>
<table class="table">
@ -77,7 +77,7 @@
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>CCEF060059969E64</code></td>
<td><code>54BC0000FF9A9E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -95,7 +95,7 @@
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Random number</td>
</tr>
</tbody>
@ -104,11 +104,11 @@
<h5><a class="anchor" href="#2-server-sends-response-of-the-form" id="2-server-sends-response-of-the-form" name="2-server-sends-response-of-the-form"><i class="anchor-icon"></i></a>2) Server sends response of the form</h5>
<!-- start resPQ -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 EC 6A 62 59 96 9E 64
0010 | 50 00 00 00 63 24 16 05 3B 6C E1 1B ED C3 46 61
0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | 91 06 77 B5 9A 8B DD 7C 08 15 D2 EA 60 D9 E9 F0
0040 | 61 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 64 63 C2 FF 9A 9E 64
0010 | 50 00 00 00 63 24 16 05 DA 60 3B 0B 6C 74 D6 0E
0020 | C9 4A 04 D8 3A F2 02 7D 8C 0C 71 9D 73 8B 75 78
0030 | 66 BA 31 F7 EF 43 97 39 08 1D 03 06 D7 8C 29 2A
0040 | 69 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09
0050 | 35 5F C3 0B 21 6B E8 6C 02 2B B4 C3 85 FD 64 DE
0060 | 85 1D 9D D0</code></pre>
<p>Payload (de)serialization:</p>
@ -132,7 +132,7 @@
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>01EC6A6259969E64</code></td>
<td><code>016463C2FF9A9E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -150,19 +150,19 @@
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Server-generated random number</td>
</tr>
<tr>
<td>pq</td>
<td>56, 12</td>
<td><code>0815D2EA60D9E9F061000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1572576921599471713</td>
<td><code>081D0306D78C292A69000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2090522174869285481</td>
<td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td>
</tr>
<tr>
@ -208,22 +208,22 @@
<h4><a class="anchor" href="#proof-of-work" id="proof-of-work" name="proof-of-work"><i class="anchor-icon"></i></a>Proof of work</h4>
<h5><a class="anchor" href="#3-client-decomposes-pq-into-prime-factors-such-that-p--q" id="3-client-decomposes-pq-into-prime-factors-such-that-p--q" name="3-client-decomposes-pq-into-prime-factors-such-that-p--q"><i class="anchor-icon"></i></a>3) Client decomposes pq into prime factors such that p &lt; q.</h5>
<!-- start pq -->
<pre><code>pq = 1572576921599471713</code></pre>
<p>Decompose into 2 prime cofactors: <code>1572576921599471713 = 1182921973 * 1329400381</code></p>
<pre><code>p = 1182921973
q = 1329400381</code></pre>
<pre><code>pq = 2090522174869285481</code></pre>
<p>Decompose into 2 prime cofactors <code>p &lt; q</code>: <code>2090522174869285481 = 1112973847 * 1878321023</code></p>
<pre><code>p = 1112973847
q = 1878321023</code></pre>
<!-- end pq -->
<h4><a class="anchor" href="#presenting-proof-of-work-server-authentication" id="presenting-proof-of-work-server-authentication" name="presenting-proof-of-work-server-authentication"><i class="anchor-icon"></i></a>Presenting proof of work; Server authentication</h4>
<h5><a class="anchor" href="#4-encrypted-data-payload-generation" id="4-encrypted-data-payload-generation" name="4-encrypted-data-payload-generation"><i class="anchor-icon"></i></a>4) <code>encrypted_data</code> payload generation</h5>
<p>First of all, generate an <code>encrypted_data</code> payload as follows:</p>
<!-- start p_q_inner_data_dc -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 95 5F F5 A9 08 15 D2 EA 60 D9 E9 F0 61 00 00 00
0010 | 04 46 81 F4 F5 00 00 00 04 4F 3D 0A 3D 00 00 00
0020 | 3B 6C E1 1B ED C3 46 61 B0 E7 0F 88 33 91 0C 6F
0030 | 78 D0 02 2E 8C 91 C6 34 91 06 77 B5 9A 8B DD 7C
0040 | ED FD 84 45 50 63 A5 3E AB FB 6D 2E 4B 46 7D 2F
0050 | A7 92 E2 CF 09 22 6E E0 10 74 AD 37 BF A3 61 01
<pre><code>0000 | 95 5F F5 A9 08 1D 03 06 D7 8C 29 2A 69 00 00 00
0010 | 04 42 56 A2 17 00 00 00 04 6F F4 E7 7F 00 00 00
0020 | DA 60 3B 0B 6C 74 D6 0E C9 4A 04 D8 3A F2 02 7D
0030 | 8C 0C 71 9D 73 8B 75 78 66 BA 31 F7 EF 43 97 39
0040 | 0E 63 58 A8 84 41 7C 48 A8 81 CD B2 44 E1 CE 7D
0050 | 3F F7 C4 E4 4E 38 10 39 EF DC E2 57 66 F4 8C E4
0060 | 02 00 00 00</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;</code></pre>
@ -246,37 +246,37 @@ q = 1329400381</code></pre>
<tr>
<td>pq</td>
<td>4, 12</td>
<td><code>0815D2EA60D9E9F061000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1572576921599471713</td>
<td><code>081D0306D78C292A69000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2090522174869285481</td>
<td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>p</td>
<td>16, 8</td>
<td><code>044681F4F5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1182921973</td>
<td><code>044256A217000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1112973847</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>q</td>
<td>24, 8</td>
<td><code>044F3D0A3D000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1329400381</td>
<td><code>046FF4E77F000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1878321023</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>nonce</td>
<td>32, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>48, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>new_nonce</td>
<td>64, 32</td>
<td><code>EDFD84455063A53EABFB6D2E4B467D2F</code> <code>A792E2CF09226EE01074AD37BFA36101</code></td>
<td><code>0E6358A884417C48A881CDB244E1CE7D</code> <code>3FF7C4E44E381039EFDCE25766F48CE4</code></td>
<td>Client-generated random number</td>
</tr>
<tr>
@ -291,39 +291,39 @@ q = 1329400381</code></pre>
<p>The serialization of <em>P_Q_inner_data</em> produces <strong>data</strong>, which is used to generate <strong>encrypted_data</strong> as specified in <a href="/mtproto/auth_key">step 4.1</a>.<br>
These are the inputs to the algorithm specified in <a href="/mtproto/auth_key">step 4.1</a>:</p>
<!-- start p_q_inner_data_input -->
<pre><code>data = 955FF5A90815D2EA60D9E9F061000000044681F4F5000000044F3D0A3D0000003B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7CEDFD84455063A53EABFB6D2E4B467D2FA792E2CF09226EE01074AD37BFA3610102000000
random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F5BA4CE541FA6A770C64721DF54FF65A28D6BBD17EB31520D2E38A2414166F0DDC9504CF67B374297516EA704BC3CDA83CD239D777869EA299EC82F9BDC51E15</code></pre>
<pre><code>data = 955FF5A9081D0306D78C292A69000000044256A217000000046FF4E77F000000DA603B0B6C74D60EC94A04D83AF2027D8C0C719D738B757866BA31F7EF4397390E6358A884417C48A881CDB244E1CE7D3FF7C4E44E381039EFDCE25766F48CE402000000
random_padding_bytes = 6A5F16CE16C2F010CF1F5B1305F4340A22E68A8BC48EC863A7F3FB907CBA6FFDE7C240684F1767F3ABECA72A65B6B737894D25CF280679407F569BD4F5A52BCEB645852B499E9A467DFFD015FC2AA75DE1AB51568B018CEE65999DD3</code></pre>
<!-- end p_q_inner_data_input -->
<p>And this is the output:</p>
<!-- start p_q_inner_data_output -->
<pre><code>encrypted_data = A527714D9BE67624A4B3B7805E93D3D845ECD997A689C7022449909D7444BEF564B361443A949201616ACA30E9FF622C4597A330CDFAF2FFC3185BD9DF83E0D36F35C9921F0653202F696F7AB61BFBF3FA44F8B7D228ED08CDA276B7070F5C0FC6DD87FC8F27D61D63A358ED557CEA2977F2F8474458091F94AA54B46F97BBCB0409F4A999ECC9DC86EE294C608A9558C222B5D7FF4E339306583571F8DD08B6A6FF9D475F93FCB6E7FCF61E8EE1CB394378EBD7DCC86526852BA2FAFD219984FC1BEA7D10EB655AE34E62B0F38301D96160557777DCAD40C1FC311F009D998BB147226A0316A83F4810D6C164755D5AD02F0144BE205F31E5AC778FF3BBAAD7</code></pre>
<pre><code>encrypted_data = 978CD0DA71C89E58D5DD3A369FD23C91CDF29AE8DEF7D7FADC5303F2D7D0BF676E6408C20F9888167525245E891B2884D4894406FD34D0A3739BB89D8BEFC5982F4CE7D899CAD65156931C8048627A86C3549183D914CFFBCB3B39E2B719B1F243CEFBFEEB8E5EBCD0C343772500D27BA8CEB80A46FA4EEBD88435FDF979DF40938AC43C6947D55F7C3130122D5D90BAA23C03CDBD5EEDDF9D1F0D46054856E3A3F4A86E9BE4FF61E80FA5606A9A0D1F797DE334D6DE845B71C48544A5AC2ECEFC92F0194789C66085F6DBC1D81E6674A8CDAC6D1911BAEAE1279133C162A4091E04B85732AEBEC304C17DCD5A8637413EC2CAE8B00A06A2121179D4DBAACBB7</code></pre>
<!-- end p_q_inner_data_output -->
<p>The length of the final string is 256 bytes.</p>
<h5><a class="anchor" href="#5-send-req-dh-params-query-with-generated-encrypted-data" id="5-send-req-dh-params-query-with-generated-encrypted-data" name="5-send-req-dh-params-query-with-generated-encrypted-data"><i class="anchor-icon"></i></a>5) Send req_DH_params query with generated <code>encrypted_data</code></h5>
<!-- start req_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 E4 1A 07 00 59 96 9E 64
0010 | 40 01 00 00 BE E4 12 D7 3B 6C E1 1B ED C3 46 61
0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | 91 06 77 B5 9A 8B DD 7C 04 46 81 F4 F5 00 00 00
0040 | 04 4F 3D 0A 3D 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 A5 27 71 4D 9B E6 76 24 A4 B3 B7 80
0060 | 5E 93 D3 D8 45 EC D9 97 A6 89 C7 02 24 49 90 9D
0070 | 74 44 BE F5 64 B3 61 44 3A 94 92 01 61 6A CA 30
0080 | E9 FF 62 2C 45 97 A3 30 CD FA F2 FF C3 18 5B D9
0090 | DF 83 E0 D3 6F 35 C9 92 1F 06 53 20 2F 69 6F 7A
00A0 | B6 1B FB F3 FA 44 F8 B7 D2 28 ED 08 CD A2 76 B7
00B0 | 07 0F 5C 0F C6 DD 87 FC 8F 27 D6 1D 63 A3 58 ED
00C0 | 55 7C EA 29 77 F2 F8 47 44 58 09 1F 94 AA 54 B4
00D0 | 6F 97 BB CB 04 09 F4 A9 99 EC C9 DC 86 EE 29 4C
00E0 | 60 8A 95 58 C2 22 B5 D7 FF 4E 33 93 06 58 35 71
00F0 | F8 DD 08 B6 A6 FF 9D 47 5F 93 FC B6 E7 FC F6 1E
0100 | 8E E1 CB 39 43 78 EB D7 DC C8 65 26 85 2B A2 FA
0110 | FD 21 99 84 FC 1B EA 7D 10 EB 65 5A E3 4E 62 B0
0120 | F3 83 01 D9 61 60 55 77 77 DC AD 40 C1 FC 31 1F
0130 | 00 9D 99 8B B1 47 22 6A 03 16 A8 3F 48 10 D6 C1
0140 | 64 75 5D 5A D0 2F 01 44 BE 20 5F 31 E5 AC 77 8F
0150 | F3 BB AA D7</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 9C A0 09 00 FF 9A 9E 64
0010 | 40 01 00 00 BE E4 12 D7 DA 60 3B 0B 6C 74 D6 0E
0020 | C9 4A 04 D8 3A F2 02 7D 8C 0C 71 9D 73 8B 75 78
0030 | 66 BA 31 F7 EF 43 97 39 04 42 56 A2 17 00 00 00
0040 | 04 6F F4 E7 7F 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 97 8C D0 DA 71 C8 9E 58 D5 DD 3A 36
0060 | 9F D2 3C 91 CD F2 9A E8 DE F7 D7 FA DC 53 03 F2
0070 | D7 D0 BF 67 6E 64 08 C2 0F 98 88 16 75 25 24 5E
0080 | 89 1B 28 84 D4 89 44 06 FD 34 D0 A3 73 9B B8 9D
0090 | 8B EF C5 98 2F 4C E7 D8 99 CA D6 51 56 93 1C 80
00A0 | 48 62 7A 86 C3 54 91 83 D9 14 CF FB CB 3B 39 E2
00B0 | B7 19 B1 F2 43 CE FB FE EB 8E 5E BC D0 C3 43 77
00C0 | 25 00 D2 7B A8 CE B8 0A 46 FA 4E EB D8 84 35 FD
00D0 | F9 79 DF 40 93 8A C4 3C 69 47 D5 5F 7C 31 30 12
00E0 | 2D 5D 90 BA A2 3C 03 CD BD 5E ED DF 9D 1F 0D 46
00F0 | 05 48 56 E3 A3 F4 A8 6E 9B E4 FF 61 E8 0F A5 60
0100 | 6A 9A 0D 1F 79 7D E3 34 D6 DE 84 5B 71 C4 85 44
0110 | A5 AC 2E CE FC 92 F0 19 47 89 C6 60 85 F6 DB C1
0120 | D8 1E 66 74 A8 CD AC 6D 19 11 BA EA E1 27 91 33
0130 | C1 62 A4 09 1E 04 B8 57 32 AE BE C3 04 C1 7D CD
0140 | 5A 86 37 41 3E C2 CA E8 B0 0A 06 A2 12 11 79 D4
0150 | DB AA CB B7</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;</code></pre>
<table class="table">
@ -345,7 +345,7 @@ random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>E41A070059969E64</code></td>
<td><code>9CA00900FF9A9E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -363,25 +363,25 @@ random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>p</td>
<td>56, 8</td>
<td><code>044681F4F5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1182921973</td>
<td><code>044256A217000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1112973847</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>q</td>
<td>64, 8</td>
<td><code>044F3D0A3D000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1329400381</td>
<td><code>046FF4E77F000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1878321023</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
@ -393,7 +393,7 @@ random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F
<tr>
<td>encrypted_data</td>
<td>80, 260</td>
<td><code>FE000100A527714D9BE67624A4B3B780</code> <code>5E93D3D845ECD997A689C7022449909D</code> <code>7444BEF564B361443A949201616ACA30</code> <code>E9FF622C4597A330CDFAF2FFC3185BD9</code> <code>DF83E0D36F35C9921F0653202F696F7A</code> <code>B61BFBF3FA44F8B7D228ED08CDA276B7</code> <code>070F5C0FC6DD87FC8F27D61D63A358ED</code> <code>557CEA2977F2F8474458091F94AA54B4</code> <code>6F97BBCB0409F4A999ECC9DC86EE294C</code> <code>608A9558C222B5D7FF4E339306583571</code> <code>F8DD08B6A6FF9D475F93FCB6E7FCF61E</code> <code>8EE1CB394378EBD7DCC86526852BA2FA</code> <code>FD219984FC1BEA7D10EB655AE34E62B0</code> <code>F38301D96160557777DCAD40C1FC311F</code> <code>009D998BB147226A0316A83F4810D6C1</code> <code>64755D5AD02F0144BE205F31E5AC778F</code><br> <code>F3BBAAD7</code></td>
<td><code>FE000100978CD0DA71C89E58D5DD3A36</code> <code>9FD23C91CDF29AE8DEF7D7FADC5303F2</code> <code>D7D0BF676E6408C20F9888167525245E</code> <code>891B2884D4894406FD34D0A3739BB89D</code> <code>8BEFC5982F4CE7D899CAD65156931C80</code> <code>48627A86C3549183D914CFFBCB3B39E2</code> <code>B719B1F243CEFBFEEB8E5EBCD0C34377</code> <code>2500D27BA8CEB80A46FA4EEBD88435FD</code> <code>F979DF40938AC43C6947D55F7C313012</code> <code>2D5D90BAA23C03CDBD5EEDDF9D1F0D46</code> <code>054856E3A3F4A86E9BE4FF61E80FA560</code> <code>6A9A0D1F797DE334D6DE845B71C48544</code> <code>A5AC2ECEFC92F0194789C66085F6DBC1</code> <code>D81E6674A8CDAC6D1911BAEAE1279133</code> <code>C162A4091E04B85732AEBEC304C17DCD</code> <code>5A8637413EC2CAE8B00A06A2121179D4</code><br> <code>DBAACBB7</code></td>
<td>Value generated above</td>
</tr>
</tbody>
@ -402,47 +402,47 @@ random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F
<h5><a class="anchor" href="#6-server-responds-with" id="6-server-responds-with" name="6-server-responds-with"><i class="anchor-icon"></i></a>6) Server responds with:</h5>
<!-- start server_DH_params_ok -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 48 D7 03 5A 96 9E 64
0010 | 78 02 00 00 5C 07 E8 D0 3B 6C E1 1B ED C3 46 61
0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | 91 06 77 B5 9A 8B DD 7C FE 50 02 00 83 6A C3 4E
0040 | F2 22 34 FE 19 22 3F 02 F8 1B CB F2 E1 AD 74 F0
0050 | B4 D3 CF B4 E5 0B E3 12 C6 B4 EA 17 8B 8A FC 86
0060 | 26 5D C1 73 AF 33 24 8C C2 89 51 C2 FD 8E 1A 56
0070 | 58 E4 85 AF C6 51 CA AC 1E 2F 31 F8 3D F5 52 2D
0080 | 8B 1D 04 1A C2 CD 1D 4D 02 B0 C8 C3 95 3B 74 65
0090 | 2E 6F 85 A3 FE A2 7D F2 B9 7E 46 66 44 24 3D 06
00A0 | 2D 55 8C DE 6F 96 95 0F F8 EA 2A 3B 4D 83 9E 58
00B0 | DD 73 0C 44 5B 3E 75 00 FF C5 7E 1F A7 7D 12 CB
00C0 | 9E FF 24 DC 8E 6F 8B D2 64 60 EB 32 C6 BC 76 45
00D0 | 44 B0 BC A0 47 0A FA 0E 99 E6 CD DF CB FC 3B 88
00E0 | F4 6A 30 31 4F A0 3F 51 7B 16 FD C6 60 EF 62 96
00F0 | 12 89 C8 03 67 7E DA 9B E5 9E 74 3C AC A4 E5 13
0100 | 55 37 1B 94 CA DC DB 16 26 F8 9C 4F 5D 5D FB FF
0110 | DC BD 4A D7 E7 73 6C 9B 08 AB 6E FB 72 5A 07 2F
0120 | 02 4F 48 F2 64 11 78 3F AA 27 73 87 DA 62 EA EF
0130 | 5D BA 72 F6 80 53 61 CD 09 8D C6 C5 51 A8 7B 8F
0140 | 70 7E 0E 2A F0 49 EA F9 50 4D 6C C1 A8 16 3E 86
0150 | B9 EC 77 CA 94 CB 92 58 51 73 6B 1F 01 EA 46 32
0160 | 7D 2A 1B 7F C1 1F B0 A9 53 C6 9D 32 DB 5E 64 45
0170 | 10 0C 6B 09 96 A6 77 F2 AF E1 E5 04 EE 20 28 87
0180 | AB 15 B2 D7 EF 36 AE 6A B4 22 2F 2B 5D DD F4 3A
0190 | 22 52 D0 17 4B 87 86 96 6B 1D A5 A9 EC 9E 47 20
01A0 | FD 83 0C 70 E6 5E 6B 27 61 80 77 35 8A E2 CC D6
01B0 | 21 2E ED 54 91 12 27 1F 0A C5 B8 83 19 A6 C6 EA
01C0 | CD 8B 43 7B 12 67 C8 85 5B 10 80 B9 85 C8 3D 25
01D0 | 99 1C F3 EA 6D 77 38 F7 10 CE D4 81 19 6B 8E D7
01E0 | E3 33 05 8B 24 31 27 0E E0 AA 90 17 DF D1 40 CF
01F0 | 82 D5 CB 06 E5 D3 17 69 67 04 53 8F 50 42 06 73
0200 | 44 CA D2 22 8D 4B 13 AA 51 10 DD B2 93 62 52 54
0210 | DB 25 22 ED 64 32 69 26 78 BE D3 EB F9 2F C1 C7
0220 | 0B 25 33 BF 6E 04 FB 4C D8 00 F9 B6 78 65 02 C9
0230 | BF 0E FE A8 51 22 04 B7 4A 6E 89 A6 03 24 5B B1
0240 | 57 8F EA A8 C8 7A F7 3E 6D B6 5F B4 B5 75 D5 65
0250 | D1 DD C3 60 EF BF 20 60 87 82 6A 53 75 5B 13 8A
0260 | F9 FC 04 83 E9 7C 32 E1 6B A8 71 03 4D 93 D1 0A
0270 | A0 30 88 F3 8E DD 65 99 00 7F 1F 4F 09 E6 D6 2B
0280 | 6B 14 55 0E 49 B8 1F 28 EB 06 D6 5A</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 98 C2 50 00 9B 9E 64
0010 | 78 02 00 00 5C 07 E8 D0 DA 60 3B 0B 6C 74 D6 0E
0020 | C9 4A 04 D8 3A F2 02 7D 8C 0C 71 9D 73 8B 75 78
0030 | 66 BA 31 F7 EF 43 97 39 FE 50 02 00 A0 35 2C C0
0040 | 87 EA 1E 38 08 20 F7 C9 46 61 88 32 08 B6 F3 9D
0050 | 47 BA DA 5D C7 2B 94 D7 22 F6 F7 C4 19 4B D2 56
0060 | B0 75 4F BD 65 E2 C2 CA 64 28 AB 69 7A 3C D2 25
0070 | 5C 3C 28 96 7A 0B 83 3C 1B 51 C9 D5 73 F2 DE BC
0080 | B9 AE 8E BF 03 F6 C8 63 55 7D 44 02 7F 39 60 8B
0090 | 2C A0 2F C9 8F EF CD 0C 1F 31 54 95 E7 EC C8 B1
00A0 | 7A 33 47 D6 6C FD E0 35 3D E7 EB 42 1F E0 63 B0
00B0 | C2 E4 85 DC 3E F6 EB 7B AE 57 4B 21 DD DB F7 D2
00C0 | 73 BF D0 8B 0A 17 CF B9 34 0D D2 C9 C4 B6 FF F2
00D0 | 4E 02 DE 47 32 22 D0 86 9E D1 A2 2E C6 59 3F 3A
00E0 | 6E B6 55 07 2A CA B4 54 DC 17 33 A8 BA 64 A2 FA
00F0 | FC B9 67 9D 8F 1A 43 20 4C BB F3 59 60 5A FB A7
0100 | 7F 4F 4B 89 86 D8 A8 4B 35 76 83 38 09 78 BB 66
0110 | F7 15 8C 5A 89 ED 75 B1 07 99 8E 89 51 6D D9 33
0120 | DE DE 35 D2 FA 4F 53 DF 49 29 54 1B 45 26 FB 13
0130 | 49 38 1F 96 A8 57 EE FB 9D F2 65 84 FF 51 6F D0
0140 | 6B 23 67 96 0A 4E 38 6D 7D FA 06 7E 60 30 41 DB
0150 | 1A BD 27 48 28 BD 3D 5F B7 43 6D B2 B1 C2 5D 81
0160 | 05 F2 10 8A 48 AE 0B F4 19 65 24 E6 83 EC 10 CC
0170 | 3A B8 CD 58 35 8C 02 AC 41 D9 26 FF 1E CD 4A 5F
0180 | 19 36 98 6B C9 73 21 BD 4C 88 ED 7B 5F 09 4B 1E
0190 | 70 B7 2B 5E FC 1D 86 E9 82 43 05 19 52 35 F0 E0
01A0 | 66 F2 DF A0 BB D2 48 8C C8 8B B5 7A C7 89 59 59
01B0 | CB 1A FE BF B0 36 FB 92 00 E8 44 D2 60 31 A1 4A
01C0 | BB F5 18 B0 89 3A FA 4C 29 D7 B0 6C 69 0D 5A 7F
01D0 | D3 16 CC 92 08 17 D4 5E 7E FE BF EB B5 89 BA 99
01E0 | F4 10 40 93 29 6E 99 99 B0 9E A6 6A 72 67 9A DD
01F0 | BA CE C3 63 D1 50 E1 6D FB 8D 51 C4 6E 19 50 5D
0200 | C1 53 97 32 DD D3 CF F3 51 BD CE B2 8A D3 79 3C
0210 | 0D A3 08 D1 2A 31 3B D7 D2 66 BB BA 88 76 5E 20
0220 | F3 39 22 08 58 43 97 68 07 2F 26 C4 AB EC CE 48
0230 | A5 F8 99 C5 26 E5 26 6F 7A 4A 4E F2 F3 B0 8B 5F
0240 | 53 AB 6B 45 90 F9 E0 DF 8B 44 10 05 C8 0C E4 72
0250 | E2 68 31 F8 64 E0 A9 CE 06 C9 DF FE C4 E6 01 3A
0260 | 26 B8 23 A8 3B A4 64 3D 5F DD B6 DE EA F7 5D A3
0270 | 0C 87 AB FE 29 F4 71 DD 82 7B 39 9C 6E C5 9D 98
0280 | CE EE 1F D4 30 19 63 95 88 5F DB F9</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;</code></pre>
<table class="table">
@ -464,7 +464,7 @@ random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>0148D7035A969E64</code></td>
<td><code>0198C250009B9E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -482,19 +482,19 @@ random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>encrypted_answer</td>
<td>56, 596</td>
<td><code>FE500200836AC34EF22234FE19223F02</code> <code>F81BCBF2E1AD74F0B4D3CFB4E50BE312</code> <code>C6B4EA178B8AFC86265DC173AF33248C</code> <code>C28951C2FD8E1A5658E485AFC651CAAC</code> <code>1E2F31F83DF5522D8B1D041AC2CD1D4D</code> <code>02B0C8C3953B74652E6F85A3FEA27DF2</code> <code>B97E466644243D062D558CDE6F96950F</code> <code>F8EA2A3B4D839E58DD730C445B3E7500</code> <code>FFC57E1FA77D12CB9EFF24DC8E6F8BD2</code> <code>6460EB32C6BC764544B0BCA0470AFA0E</code> <code>99E6CDDFCBFC3B88F46A30314FA03F51</code> <code>7B16FDC660EF62961289C803677EDA9B</code> <code>E59E743CACA4E51355371B94CADCDB16</code> <code>26F89C4F5D5DFBFFDCBD4AD7E7736C9B</code> <code>08AB6EFB725A072F024F48F26411783F</code> <code>AA277387DA62EAEF5DBA72F6805361CD</code> <code>098DC6C551A87B8F707E0E2AF049EAF9</code> <code>504D6CC1A8163E86B9EC77CA94CB9258</code> <code>51736B1F01EA46327D2A1B7FC11FB0A9</code> <code>53C69D32DB5E6445100C6B0996A677F2</code> <code>AFE1E504EE202887AB15B2D7EF36AE6A</code> <code>B4222F2B5DDDF43A2252D0174B878696</code> <code>6B1DA5A9EC9E4720FD830C70E65E6B27</code> <code>618077358AE2CCD6212EED549112271F</code> <code>0AC5B88319A6C6EACD8B437B1267C885</code> <code>5B1080B985C83D25991CF3EA6D7738F7</code> <code>10CED481196B8ED7E333058B2431270E</code> <code>E0AA9017DFD140CF82D5CB06E5D31769</code> <code>6704538F5042067344CAD2228D4B13AA</code> <code>5110DDB293625254DB2522ED64326926</code> <code>78BED3EBF92FC1C70B2533BF6E04FB4C</code> <code>D800F9B6786502C9BF0EFEA8512204B7</code> <code>4A6E89A603245BB1578FEAA8C87AF73E</code> <code>6DB65FB4B575D565D1DDC360EFBF2060</code> <code>87826A53755B138AF9FC0483E97C32E1</code> <code>6BA871034D93D10AA03088F38EDD6599</code> <code>007F1F4F09E6D62B6B14550E49B81F28</code><br> <code>EB06D65A</code></td>
<td><code>FE500200A0352CC087EA1E380820F7C9</code> <code>4661883208B6F39D47BADA5DC72B94D7</code> <code>22F6F7C4194BD256B0754FBD65E2C2CA</code> <code>6428AB697A3CD2255C3C28967A0B833C</code> <code>1B51C9D573F2DEBCB9AE8EBF03F6C863</code> <code>557D44027F39608B2CA02FC98FEFCD0C</code> <code>1F315495E7ECC8B17A3347D66CFDE035</code> <code>3DE7EB421FE063B0C2E485DC3EF6EB7B</code> <code>AE574B21DDDBF7D273BFD08B0A17CFB9</code> <code>340DD2C9C4B6FFF24E02DE473222D086</code> <code>9ED1A22EC6593F3A6EB655072ACAB454</code> <code>DC1733A8BA64A2FAFCB9679D8F1A4320</code> <code>4CBBF359605AFBA77F4F4B8986D8A84B</code> <code>357683380978BB66F7158C5A89ED75B1</code> <code>07998E89516DD933DEDE35D2FA4F53DF</code> <code>4929541B4526FB1349381F96A857EEFB</code> <code>9DF26584FF516FD06B2367960A4E386D</code> <code>7DFA067E603041DB1ABD274828BD3D5F</code> <code>B7436DB2B1C25D8105F2108A48AE0BF4</code> <code>196524E683EC10CC3AB8CD58358C02AC</code> <code>41D926FF1ECD4A5F1936986BC97321BD</code> <code>4C88ED7B5F094B1E70B72B5EFC1D86E9</code> <code>824305195235F0E066F2DFA0BBD2488C</code> <code>C88BB57AC7895959CB1AFEBFB036FB92</code> <code>00E844D26031A14ABBF518B0893AFA4C</code> <code>29D7B06C690D5A7FD316CC920817D45E</code> <code>7EFEBFEBB589BA99F4104093296E9999</code> <code>B09EA66A72679ADDBACEC363D150E16D</code> <code>FB8D51C46E19505DC1539732DDD3CFF3</code> <code>51BDCEB28AD3793C0DA308D12A313BD7</code> <code>D266BBBA88765E20F339220858439768</code> <code>072F26C4ABECCE48A5F899C526E5266F</code> <code>7A4A4EF2F3B08B5F53AB6B4590F9E0DF</code> <code>8B441005C80CE472E26831F864E0A9CE</code> <code>06C9DFFEC4E6013A26B823A83BA4643D</code> <code>5FDDB6DEEAF75DA30C87ABFE29F471DD</code> <code>827B399C6EC59D98CEEE1FD430196395</code><br> <code>885FDBF9</code></td>
<td>See below</td>
</tr>
</tbody>
@ -502,20 +502,20 @@ random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F
<!-- end server_DH_params_ok -->
<p>Decrypt <code>encrypted_answer</code> using the reverse of the process specified in <a href="/mtproto/auth_key#6-server-responds-with">step 6</a>:</p>
<!-- start server_DH_inner_data_input -->
<pre><code>encrypted_answer = 836AC34EF22234FE19223F02F81BCBF2E1AD74F0B4D3CFB4E50BE312C6B4EA178B8AFC86265DC173AF33248CC28951C2FD8E1A5658E485AFC651CAAC1E2F31F83DF5522D8B1D041AC2CD1D4D02B0C8C3953B74652E6F85A3FEA27DF2B97E466644243D062D558CDE6F96950FF8EA2A3B4D839E58DD730C445B3E7500FFC57E1FA77D12CB9EFF24DC8E6F8BD26460EB32C6BC764544B0BCA0470AFA0E99E6CDDFCBFC3B88F46A30314FA03F517B16FDC660EF62961289C803677EDA9BE59E743CACA4E51355371B94CADCDB1626F89C4F5D5DFBFFDCBD4AD7E7736C9B08AB6EFB725A072F024F48F26411783FAA277387DA62EAEF5DBA72F6805361CD098DC6C551A87B8F707E0E2AF049EAF9504D6CC1A8163E86B9EC77CA94CB925851736B1F01EA46327D2A1B7FC11FB0A953C69D32DB5E6445100C6B0996A677F2AFE1E504EE202887AB15B2D7EF36AE6AB4222F2B5DDDF43A2252D0174B8786966B1DA5A9EC9E4720FD830C70E65E6B27618077358AE2CCD6212EED549112271F0AC5B88319A6C6EACD8B437B1267C8855B1080B985C83D25991CF3EA6D7738F710CED481196B8ED7E333058B2431270EE0AA9017DFD140CF82D5CB06E5D317696704538F5042067344CAD2228D4B13AA5110DDB293625254DB2522ED6432692678BED3EBF92FC1C70B2533BF6E04FB4CD800F9B6786502C9BF0EFEA8512204B74A6E89A603245BB1578FEAA8C87AF73E6DB65FB4B575D565D1DDC360EFBF206087826A53755B138AF9FC0483E97C32E16BA871034D93D10AA03088F38EDD6599007F1F4F09E6D62B6B14550E49B81F28EB06D65A
tmp_aes_key = 3956EDA6DB9239D3E00942D65FA2782983547D27A037FC9A3875196482457CF5
tmp_aes_iv = ED25CF95B5053DDCC1F53F4AD1AF7DD0E5A4A21F89ECDFBB2F041BE4EDFD8445</code></pre>
<pre><code>encrypted_answer = A0352CC087EA1E380820F7C94661883208B6F39D47BADA5DC72B94D722F6F7C4194BD256B0754FBD65E2C2CA6428AB697A3CD2255C3C28967A0B833C1B51C9D573F2DEBCB9AE8EBF03F6C863557D44027F39608B2CA02FC98FEFCD0C1F315495E7ECC8B17A3347D66CFDE0353DE7EB421FE063B0C2E485DC3EF6EB7BAE574B21DDDBF7D273BFD08B0A17CFB9340DD2C9C4B6FFF24E02DE473222D0869ED1A22EC6593F3A6EB655072ACAB454DC1733A8BA64A2FAFCB9679D8F1A43204CBBF359605AFBA77F4F4B8986D8A84B357683380978BB66F7158C5A89ED75B107998E89516DD933DEDE35D2FA4F53DF4929541B4526FB1349381F96A857EEFB9DF26584FF516FD06B2367960A4E386D7DFA067E603041DB1ABD274828BD3D5FB7436DB2B1C25D8105F2108A48AE0BF4196524E683EC10CC3AB8CD58358C02AC41D926FF1ECD4A5F1936986BC97321BD4C88ED7B5F094B1E70B72B5EFC1D86E9824305195235F0E066F2DFA0BBD2488CC88BB57AC7895959CB1AFEBFB036FB9200E844D26031A14ABBF518B0893AFA4C29D7B06C690D5A7FD316CC920817D45E7EFEBFEBB589BA99F4104093296E9999B09EA66A72679ADDBACEC363D150E16DFB8D51C46E19505DC1539732DDD3CFF351BDCEB28AD3793C0DA308D12A313BD7D266BBBA88765E20F339220858439768072F26C4ABECCE48A5F899C526E5266F7A4A4EF2F3B08B5F53AB6B4590F9E0DF8B441005C80CE472E26831F864E0A9CE06C9DFFEC4E6013A26B823A83BA4643D5FDDB6DEEAF75DA30C87ABFE29F471DD827B399C6EC59D98CEEE1FD430196395885FDBF9
tmp_aes_key = FD36AB8054D1E2F02F5205DC00729025F859AB708409CE4F32E82FDA951B0D7A
tmp_aes_iv = 049A211296D24BE36D7FFA1E3C30904487A544973922E4930CD594630E6358A8</code></pre>
<!-- end server_DH_inner_data_input -->
<p>Yielding:</p>
<!-- start server_DH_inner_data_output -->
<pre><code>answer_with_hash = 70F677AA69190441C67862FB9CD0C689083BC134BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7C03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001001BEA1C03F21CA802A6E62922E4FEF1FAEC50248AF15A2BBA07A97D3D1FCD3EFCE454F5F51CDB120D8F1DAA89548F9AF41D18A6542B28F9153AA7E48122950F5E002E511DF55F81A6340259CA6DDCB1C19B3FEFF37F382AC719B2A535F76FFD41E14A34EBF7DE44DF8F355893EDA79ED914A9B83C31E6075A1E3F29EE7D682D6DE5A3161D05864E4402E2AF00A331ABD9BF5AFB2FB207DD314459E4AD791F4416C98E51F3FDD9F9210CC24CF14D775C60207950642B2E28B1E1FC0F39102EC590AFD76FB070759C6064E9884AE6F30D7969909A7FF99B1DA6E246DD7612194915BAC36F14139C1728546C0325DFF289D1339AF61772FFFD9C16F7D7AB92267AC85A969E64DAD6000E2A59A52B
answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7C03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001001BEA1C03F21CA802A6E62922E4FEF1FAEC50248AF15A2BBA07A97D3D1FCD3EFCE454F5F51CDB120D8F1DAA89548F9AF41D18A6542B28F9153AA7E48122950F5E002E511DF55F81A6340259CA6DDCB1C19B3FEFF37F382AC719B2A535F76FFD41E14A34EBF7DE44DF8F355893EDA79ED914A9B83C31E6075A1E3F29EE7D682D6DE5A3161D05864E4402E2AF00A331ABD9BF5AFB2FB207DD314459E4AD791F4416C98E51F3FDD9F9210CC24CF14D775C60207950642B2E28B1E1FC0F39102EC590AFD76FB070759C6064E9884AE6F30D7969909A7FF99B1DA6E246DD7612194915BAC36F14139C1728546C0325DFF289D1339AF61772FFFD9C16F7D7AB92267AC85A969E64DAD6000E2A59A52B</code></pre>
<pre><code>answer_with_hash = 46A914334DFF3DF06D9A1E5330BF60A105E40B07BA0D89B5DA603B0B6C74D60EC94A04D83AF2027D8C0C719D738B757866BA31F7EF43973903000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010035D6639175B1FF6E0AC40189370B3067AF8D52CEA7087E49E01707B5E6112CB33327267BD526CDCD1E971B0488E8C93510E86049B25F640170B02BDE609E83050E5FAB0654C03837E7832018152B11928E0F2E4C3327DBE2717E123CC5994EA0A6034CED7EAD34D99CA90D8940B2065897EBF617B9B1662E682053CDC75A31FD6D7B27B1B8FE868C8139752A4848A5493DFC71477009E0653D185051A7D6F6C3A59C2A89EC8B9BCDD87CB849893D709261D690E3843565DEB19B76B21FB8A0A28DE3BEA19869F1D73346909D17666F94778077C599761176248536A8BB944F4F73C366BF70A04D13326D227999E146C830A473FC9B1F3525263FE30B7D82C2B7009B9E644AD2ABF1F215707B
answer = BA0D89B5DA603B0B6C74D60EC94A04D83AF2027D8C0C719D738B757866BA31F7EF43973903000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010035D6639175B1FF6E0AC40189370B3067AF8D52CEA7087E49E01707B5E6112CB33327267BD526CDCD1E971B0488E8C93510E86049B25F640170B02BDE609E83050E5FAB0654C03837E7832018152B11928E0F2E4C3327DBE2717E123CC5994EA0A6034CED7EAD34D99CA90D8940B2065897EBF617B9B1662E682053CDC75A31FD6D7B27B1B8FE868C8139752A4848A5493DFC71477009E0653D185051A7D6F6C3A59C2A89EC8B9BCDD87CB849893D709261D690E3843565DEB19B76B21FB8A0A28DE3BEA19869F1D73346909D17666F94778077C599761176248536A8BB944F4F73C366BF70A04D13326D227999E146C830A473FC9B1F3525263FE30B7D82C2B7009B9E644AD2ABF1F215707B</code></pre>
<!-- end server_DH_inner_data_output -->
<!-- start server_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | BA 0D 89 B5 3B 6C E1 1B ED C3 46 61 B0 E7 0F 88
0010 | 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34 91 06 77 B5
0020 | 9A 8B DD 7C 03 00 00 00 FE 00 01 00 C7 1C AE B9
<pre><code>0000 | BA 0D 89 B5 DA 60 3B 0B 6C 74 D6 0E C9 4A 04 D8
0010 | 3A F2 02 7D 8C 0C 71 9D 73 8B 75 78 66 BA 31 F7
0020 | EF 43 97 39 03 00 00 00 FE 00 01 00 C7 1C AE B9
0030 | C6 B1 C9 04 8E 6C 52 2F 70 F1 3F 73 98 0D 40 23
0040 | 8E 3E 21 C1 49 34 D0 37 56 3D 93 0F 48 19 8A 0A
0050 | A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E
@ -532,23 +532,23 @@ answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7
0100 | F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6
0110 | 35 B1 05 EE 2E 4E 15 D0 4B 24 54 BF 6F 4F AD F0
0120 | 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B FE 00 01 00
0130 | 1B EA 1C 03 F2 1C A8 02 A6 E6 29 22 E4 FE F1 FA
0140 | EC 50 24 8A F1 5A 2B BA 07 A9 7D 3D 1F CD 3E FC
0150 | E4 54 F5 F5 1C DB 12 0D 8F 1D AA 89 54 8F 9A F4
0160 | 1D 18 A6 54 2B 28 F9 15 3A A7 E4 81 22 95 0F 5E
0170 | 00 2E 51 1D F5 5F 81 A6 34 02 59 CA 6D DC B1 C1
0180 | 9B 3F EF F3 7F 38 2A C7 19 B2 A5 35 F7 6F FD 41
0190 | E1 4A 34 EB F7 DE 44 DF 8F 35 58 93 ED A7 9E D9
01A0 | 14 A9 B8 3C 31 E6 07 5A 1E 3F 29 EE 7D 68 2D 6D
01B0 | E5 A3 16 1D 05 86 4E 44 02 E2 AF 00 A3 31 AB D9
01C0 | BF 5A FB 2F B2 07 DD 31 44 59 E4 AD 79 1F 44 16
01D0 | C9 8E 51 F3 FD D9 F9 21 0C C2 4C F1 4D 77 5C 60
01E0 | 20 79 50 64 2B 2E 28 B1 E1 FC 0F 39 10 2E C5 90
01F0 | AF D7 6F B0 70 75 9C 60 64 E9 88 4A E6 F3 0D 79
0200 | 69 90 9A 7F F9 9B 1D A6 E2 46 DD 76 12 19 49 15
0210 | BA C3 6F 14 13 9C 17 28 54 6C 03 25 DF F2 89 D1
0220 | 33 9A F6 17 72 FF FD 9C 16 F7 D7 AB 92 26 7A C8
0230 | 5A 96 9E 64</code></pre>
0130 | 35 D6 63 91 75 B1 FF 6E 0A C4 01 89 37 0B 30 67
0140 | AF 8D 52 CE A7 08 7E 49 E0 17 07 B5 E6 11 2C B3
0150 | 33 27 26 7B D5 26 CD CD 1E 97 1B 04 88 E8 C9 35
0160 | 10 E8 60 49 B2 5F 64 01 70 B0 2B DE 60 9E 83 05
0170 | 0E 5F AB 06 54 C0 38 37 E7 83 20 18 15 2B 11 92
0180 | 8E 0F 2E 4C 33 27 DB E2 71 7E 12 3C C5 99 4E A0
0190 | A6 03 4C ED 7E AD 34 D9 9C A9 0D 89 40 B2 06 58
01A0 | 97 EB F6 17 B9 B1 66 2E 68 20 53 CD C7 5A 31 FD
01B0 | 6D 7B 27 B1 B8 FE 86 8C 81 39 75 2A 48 48 A5 49
01C0 | 3D FC 71 47 70 09 E0 65 3D 18 50 51 A7 D6 F6 C3
01D0 | A5 9C 2A 89 EC 8B 9B CD D8 7C B8 49 89 3D 70 92
01E0 | 61 D6 90 E3 84 35 65 DE B1 9B 76 B2 1F B8 A0 A2
01F0 | 8D E3 BE A1 98 69 F1 D7 33 46 90 9D 17 66 6F 94
0200 | 77 80 77 C5 99 76 11 76 24 85 36 A8 BB 94 4F 4F
0210 | 73 C3 66 BF 70 A0 4D 13 32 6D 22 79 99 E1 46 C8
0220 | 30 A4 73 FC 9B 1F 35 25 26 3F E3 0B 7D 82 C2 B7
0230 | 00 9B 9E 64</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;</code></pre>
<table class="table">
@ -570,13 +570,13 @@ answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7
<tr>
<td>nonce</td>
<td>4, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>20, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
@ -594,13 +594,13 @@ answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7
<tr>
<td>g_a</td>
<td>300, 260</td>
<td><code>FE0001001BEA1C03F21CA802A6E62922</code> <code>E4FEF1FAEC50248AF15A2BBA07A97D3D</code> <code>1FCD3EFCE454F5F51CDB120D8F1DAA89</code> <code>548F9AF41D18A6542B28F9153AA7E481</code> <code>22950F5E002E511DF55F81A6340259CA</code> <code>6DDCB1C19B3FEFF37F382AC719B2A535</code> <code>F76FFD41E14A34EBF7DE44DF8F355893</code> <code>EDA79ED914A9B83C31E6075A1E3F29EE</code> <code>7D682D6DE5A3161D05864E4402E2AF00</code> <code>A331ABD9BF5AFB2FB207DD314459E4AD</code> <code>791F4416C98E51F3FDD9F9210CC24CF1</code> <code>4D775C60207950642B2E28B1E1FC0F39</code> <code>102EC590AFD76FB070759C6064E9884A</code> <code>E6F30D7969909A7FF99B1DA6E246DD76</code> <code>12194915BAC36F14139C1728546C0325</code> <code>DFF289D1339AF61772FFFD9C16F7D7AB</code><br> <code>92267AC8</code></td>
<td><code>FE00010035D6639175B1FF6E0AC40189</code> <code>370B3067AF8D52CEA7087E49E01707B5</code> <code>E6112CB33327267BD526CDCD1E971B04</code> <code>88E8C93510E86049B25F640170B02BDE</code> <code>609E83050E5FAB0654C03837E7832018</code> <code>152B11928E0F2E4C3327DBE2717E123C</code> <code>C5994EA0A6034CED7EAD34D99CA90D89</code> <code>40B2065897EBF617B9B1662E682053CD</code> <code>C75A31FD6D7B27B1B8FE868C8139752A</code> <code>4848A5493DFC71477009E0653D185051</code> <code>A7D6F6C3A59C2A89EC8B9BCDD87CB849</code> <code>893D709261D690E3843565DEB19B76B2</code> <code>1FB8A0A28DE3BEA19869F1D73346909D</code> <code>17666F94778077C599761176248536A8</code> <code>BB944F4F73C366BF70A04D13326D2279</code> <code>99E146C830A473FC9B1F3525263FE30B</code><br> <code>7D82C2B7</code></td>
<td><code>g_a</code> diffie-hellman parameter</td>
</tr>
<tr>
<td>server_time</td>
<td>560, 4</td>
<td><code>5A969E64</code> (1688114778 in decimal)</td>
<td><code>009B9E64</code> (1688115968 in decimal)</td>
<td>Server time</td>
</tr>
</tbody>
@ -609,34 +609,34 @@ answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7
<h5><a class="anchor" href="#7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message" id="7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message" name="7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message"><i class="anchor-icon"></i></a>7) Client computes random 2048-bit number <em>b</em> (using a sufficient amount of entropy) and sends the server a message</h5>
<p>First, generate a secure random 2048-bit number b:</p>
<!-- start b -->
<pre><code>b = 744E93CF8FA7E1510D1FE832C1DCE2AF7B343B0D786CA507D1F34DBABF922AFFB3D0635EDE27ADF1F2B2A5471CC087A69665BB834C98D4CAEC542892AB02A4087734B6F3AE36A78FCF38A78659F15DBE4C416963955486C656A9AFD8AE81A3357B2FA6BEEB37A561356C5188D593D941A711C06A836ECBF684BF37437F033010432227DB935FDF2CA0B0BF0B644DEB64394D1BFB6A5DCAC8E117DB36E46B8EE8C5FE300276997EFA0B5BDA54C6C9F5F7D45B38E93A0FB2F33A2A929252D47BCB71CF0423DEA4E122F63551C3198C07BA84F95C36104761EF23D294F226FDA75AB3321C2F3A2071F52056688B9295C09EBF751E4CC2022BCD2E79BB716B23203D</code></pre>
<pre><code>b = F7C5CD46D4A88DED59C1B412D39FEC78BD86A6DC2BF2C5C5D8AF305204158F14B3244D42FFCF2363DC0D25DC6C48A16A3A0E63813D9E87442CA3C2CF84DF848C540531FCDBAD8290A6B25E021EB9AAEEB702F6FB31DC39C48EF615BB0CBBEDE1958D8BF5DCC205CBED3A9DFCD597115163A131DFD4939E68EB2C6F097A5632A3773D5201783A3B6CDE805794F5CBEEFD9FCB8DEAEAD1C5BCADD6366C8A907FABE99A026E59E8521085CE6130123E80B72DFD5EF3D2C0BC880F52DEEF7404638D8053D464036BF7057A77BE75EDA78D3C82221BB131FE6ECB8C43F77DF1D04935F978BA40F3F59385D6D6C2E7782BFFB040AB60F28459EB68A42A904B55E8088C</code></pre>
<!-- end b -->
<p>Then compute <code>g_b = pow(g, b) mod dh_prime</code></p>
<!-- start g_b -->
<pre><code>g_b = 55F3A678CBBC2D12C34DC41345387B1162E949DCA78F1D7DC02167AB9B983CAC956AE49E50FA0655C45CB7FD439238E6FAB3F4186794602FE44BE4194912B32536619A017A4DFE50D9893FF9C511B5DA8AE5A7598DDFD82BA0122DA7937E22BCE1F3F3C0CE51E6EBEA24FDA496C7365B0CFBC16671E06A10CB45A0749F520401C278E7F8A162BBDDF6973642A5E49E515962328297012984B36EF4D2D35C28C20CB25928B3F3D46BA6FC6FEE832F71F16347744F75085AA22F3677717D8F643F5AF88C394F87B149144CDA035977A08443679DC97E17642AF1C0519095686642E158A0F0D9CFAFE461ACABB41A72A76AE8FC5F39EDAF53DE68DEBE8EDEDFAB9B</code></pre>
<pre><code>g_b = 2545CE89DAD14BDF0F1E2E34F366124474E221B5C2019CF5240612B81798311E9ED33201DE78EA34B59DC0151E4CF820DEEC3850E1B08114B7599A1C99F28A85234ABCF8DC8BE8AB0CD1019EC56AB7BB2E05F07B7656338BE254ABB2F45AD42A86848E602B04A6B9CC9262780D4F87505A8B17191F53E72BDB00AB290B76810EB15C873183D72EC3D2CB411C3F4BDC7944E1CABF5571B152F7FC3CA1DA470977329DC49854BA62A85AE7645FECBD8183B5A4AAD06DFC56D4BA6106F81A45BEF32A9E4F56A213FB2A027B3ACDFDDDE6A6D57E68352C82F7C0D2108FC010725929CB7C88EE737F7B498D86134C7C7F2626F0357067A07813C0D3F2C86876CC1FF1</code></pre>
<!-- end g_b -->
<h6>7.1) generation of encrypted_data</h6>
<!-- start client_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 54 B6 43 66 3B 6C E1 1B ED C3 46 61 B0 E7 0F 88
0010 | 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34 91 06 77 B5
0020 | 9A 8B DD 7C 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | 55 F3 A6 78 CB BC 2D 12 C3 4D C4 13 45 38 7B 11
0040 | 62 E9 49 DC A7 8F 1D 7D C0 21 67 AB 9B 98 3C AC
0050 | 95 6A E4 9E 50 FA 06 55 C4 5C B7 FD 43 92 38 E6
0060 | FA B3 F4 18 67 94 60 2F E4 4B E4 19 49 12 B3 25
0070 | 36 61 9A 01 7A 4D FE 50 D9 89 3F F9 C5 11 B5 DA
0080 | 8A E5 A7 59 8D DF D8 2B A0 12 2D A7 93 7E 22 BC
0090 | E1 F3 F3 C0 CE 51 E6 EB EA 24 FD A4 96 C7 36 5B
00A0 | 0C FB C1 66 71 E0 6A 10 CB 45 A0 74 9F 52 04 01
00B0 | C2 78 E7 F8 A1 62 BB DD F6 97 36 42 A5 E4 9E 51
00C0 | 59 62 32 82 97 01 29 84 B3 6E F4 D2 D3 5C 28 C2
00D0 | 0C B2 59 28 B3 F3 D4 6B A6 FC 6F EE 83 2F 71 F1
00E0 | 63 47 74 4F 75 08 5A A2 2F 36 77 71 7D 8F 64 3F
00F0 | 5A F8 8C 39 4F 87 B1 49 14 4C DA 03 59 77 A0 84
0100 | 43 67 9D C9 7E 17 64 2A F1 C0 51 90 95 68 66 42
0110 | E1 58 A0 F0 D9 CF AF E4 61 AC AB B4 1A 72 A7 6A
0120 | E8 FC 5F 39 ED AF 53 DE 68 DE BE 8E DE DF AB 9B</code></pre>
<pre><code>0000 | 54 B6 43 66 DA 60 3B 0B 6C 74 D6 0E C9 4A 04 D8
0010 | 3A F2 02 7D 8C 0C 71 9D 73 8B 75 78 66 BA 31 F7
0020 | EF 43 97 39 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | 25 45 CE 89 DA D1 4B DF 0F 1E 2E 34 F3 66 12 44
0040 | 74 E2 21 B5 C2 01 9C F5 24 06 12 B8 17 98 31 1E
0050 | 9E D3 32 01 DE 78 EA 34 B5 9D C0 15 1E 4C F8 20
0060 | DE EC 38 50 E1 B0 81 14 B7 59 9A 1C 99 F2 8A 85
0070 | 23 4A BC F8 DC 8B E8 AB 0C D1 01 9E C5 6A B7 BB
0080 | 2E 05 F0 7B 76 56 33 8B E2 54 AB B2 F4 5A D4 2A
0090 | 86 84 8E 60 2B 04 A6 B9 CC 92 62 78 0D 4F 87 50
00A0 | 5A 8B 17 19 1F 53 E7 2B DB 00 AB 29 0B 76 81 0E
00B0 | B1 5C 87 31 83 D7 2E C3 D2 CB 41 1C 3F 4B DC 79
00C0 | 44 E1 CA BF 55 71 B1 52 F7 FC 3C A1 DA 47 09 77
00D0 | 32 9D C4 98 54 BA 62 A8 5A E7 64 5F EC BD 81 83
00E0 | B5 A4 AA D0 6D FC 56 D4 BA 61 06 F8 1A 45 BE F3
00F0 | 2A 9E 4F 56 A2 13 FB 2A 02 7B 3A CD FD DD E6 A6
0100 | D5 7E 68 35 2C 82 F7 C0 D2 10 8F C0 10 72 59 29
0110 | CB 7C 88 EE 73 7F 7B 49 8D 86 13 4C 7C 7F 26 26
0120 | F0 35 70 67 A0 78 13 C0 D3 F2 C8 68 76 CC 1F F1</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;</code></pre>
<table class="table">
@ -658,19 +658,19 @@ answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7
<tr>
<td>nonce</td>
<td>4, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>20, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>g_b</td>
<td>36, 260</td>
<td><code>FE00010055F3A678CBBC2D12C34DC413</code> <code>45387B1162E949DCA78F1D7DC02167AB</code> <code>9B983CAC956AE49E50FA0655C45CB7FD</code> <code>439238E6FAB3F4186794602FE44BE419</code> <code>4912B32536619A017A4DFE50D9893FF9</code> <code>C511B5DA8AE5A7598DDFD82BA0122DA7</code> <code>937E22BCE1F3F3C0CE51E6EBEA24FDA4</code> <code>96C7365B0CFBC16671E06A10CB45A074</code> <code>9F520401C278E7F8A162BBDDF6973642</code> <code>A5E49E515962328297012984B36EF4D2</code> <code>D35C28C20CB25928B3F3D46BA6FC6FEE</code> <code>832F71F16347744F75085AA22F367771</code> <code>7D8F643F5AF88C394F87B149144CDA03</code> <code>5977A08443679DC97E17642AF1C05190</code> <code>95686642E158A0F0D9CFAFE461ACABB4</code> <code>1A72A76AE8FC5F39EDAF53DE68DEBE8E</code><br> <code>DEDFAB9B</code></td>
<td><code>FE0001002545CE89DAD14BDF0F1E2E34</code> <code>F366124474E221B5C2019CF5240612B8</code> <code>1798311E9ED33201DE78EA34B59DC015</code> <code>1E4CF820DEEC3850E1B08114B7599A1C</code> <code>99F28A85234ABCF8DC8BE8AB0CD1019E</code> <code>C56AB7BB2E05F07B7656338BE254ABB2</code> <code>F45AD42A86848E602B04A6B9CC926278</code> <code>0D4F87505A8B17191F53E72BDB00AB29</code> <code>0B76810EB15C873183D72EC3D2CB411C</code> <code>3F4BDC7944E1CABF5571B152F7FC3CA1</code> <code>DA470977329DC49854BA62A85AE7645F</code> <code>ECBD8183B5A4AAD06DFC56D4BA6106F8</code> <code>1A45BEF32A9E4F56A213FB2A027B3ACD</code> <code>FDDDE6A6D57E68352C82F7C0D2108FC0</code> <code>10725929CB7C88EE737F7B498D86134C</code> <code>7C7F2626F0357067A07813C0D3F2C868</code><br> <code>76CC1FF1</code></td>
<td>Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding</td>
</tr>
<tr>
@ -684,47 +684,47 @@ answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7
<!-- end client_DH_inner_data -->
<p>The serialization of <em>Client_DH_Inner_Data</em> produces a string <strong>data</strong>. This is used to generate <strong>encrypted_data</strong> as specified in <a href="#7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message">step 6</a>, using the following inputs:</p>
<!-- start client_DH_inner_data_input -->
<pre><code>data = 54B643663B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7C0000000000000000FE00010055F3A678CBBC2D12C34DC41345387B1162E949DCA78F1D7DC02167AB9B983CAC956AE49E50FA0655C45CB7FD439238E6FAB3F4186794602FE44BE4194912B32536619A017A4DFE50D9893FF9C511B5DA8AE5A7598DDFD82BA0122DA7937E22BCE1F3F3C0CE51E6EBEA24FDA496C7365B0CFBC16671E06A10CB45A0749F520401C278E7F8A162BBDDF6973642A5E49E515962328297012984B36EF4D2D35C28C20CB25928B3F3D46BA6FC6FEE832F71F16347744F75085AA22F3677717D8F643F5AF88C394F87B149144CDA035977A08443679DC97E17642AF1C0519095686642E158A0F0D9CFAFE461ACABB41A72A76AE8FC5F39EDAF53DE68DEBE8EDEDFAB9B
padding = 85AA2A17BC9D581BA4E758F7
tmp_aes_key = 3956EDA6DB9239D3E00942D65FA2782983547D27A037FC9A3875196482457CF5
tmp_aes_iv = ED25CF95B5053DDCC1F53F4AD1AF7DD0E5A4A21F89ECDFBB2F041BE4EDFD8445</code></pre>
<pre><code>data = 54B64366DA603B0B6C74D60EC94A04D83AF2027D8C0C719D738B757866BA31F7EF4397390000000000000000FE0001002545CE89DAD14BDF0F1E2E34F366124474E221B5C2019CF5240612B81798311E9ED33201DE78EA34B59DC0151E4CF820DEEC3850E1B08114B7599A1C99F28A85234ABCF8DC8BE8AB0CD1019EC56AB7BB2E05F07B7656338BE254ABB2F45AD42A86848E602B04A6B9CC9262780D4F87505A8B17191F53E72BDB00AB290B76810EB15C873183D72EC3D2CB411C3F4BDC7944E1CABF5571B152F7FC3CA1DA470977329DC49854BA62A85AE7645FECBD8183B5A4AAD06DFC56D4BA6106F81A45BEF32A9E4F56A213FB2A027B3ACDFDDDE6A6D57E68352C82F7C0D2108FC010725929CB7C88EE737F7B498D86134C7C7F2626F0357067A07813C0D3F2C86876CC1FF1
padding = BD8A6AC82FFB68885A48E0ED
tmp_aes_key = FD36AB8054D1E2F02F5205DC00729025F859AB708409CE4F32E82FDA951B0D7A
tmp_aes_iv = 049A211296D24BE36D7FFA1E3C30904487A544973922E4930CD594630E6358A8</code></pre>
<!-- end client_DH_inner_data_input -->
<p>Process:</p>
<pre><code>data_with_hash := SHA1(data) + data + padding (0-15 random bytes such that total length is divisible by 16)
encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);</code></pre>
<p>Output:</p>
<!-- start client_DH_inner_data_output -->
<pre><code>encrypted_data = C65BD12A8AD2A14AC0343F20F6BF3844DD8D81A18975F0827FEE29DD0CB97F7F1531D3EF781A9777F799EAD72CDBB84BEABCEBEC4C8232D51773493C6C4DB77A39B0BCD4AFED22FCEA12957BDF0FE5880FB8D6C38B12FE1C3F39694D12BFA0A3E124ACA9547F44678F5388561196085DE31F6AD05F30C87B213F0A2CC366DD73126FE3668FA448F84E5C1A2BCE76BE5B4B66001C69E6C124FA731FCF653F92A584DFAECCF247BD41AE10F3633999B0BA842BFFEC4B669BB01645167168DABE5C9EBEEA1B0ED94DAED0C7BA6CE6513A1F6292E9D9B85D8328C2A4D8BA3A43DCE484F2B5BB26FDD3337CA81D835A830EF56F623060DE68F93E21BBA5E893A2C352DA2DD697A6B562DDD677AB92FD748445509CDCCF5954D99D934BD7AC2730A36F096C0E8E57CA39C36EE8EDFDCED80B20C558B75A117944E57E0D89F333E2169ED6CA00C73886CD68CC7B116E2BE156E6</code></pre>
<pre><code>encrypted_data = E3B5716AC2E86342AD2E8C7B75FD17C713CE5C8559659F8301258D63D9101D1DB99EA9C1909315495C8776FD7885CA40AB860F38C8BD946F90CCEC63F3ED2A5A8F06F4E45BFDD0CC4A626AF74C299623B64E8E384BB7A66C36483EA667CE513FB5C2B9C7C635206E824F6BFC45A259CE0692745EBF3FDE3DEE350903FC0E2FF821DAECDF333B23F77866A444E2AC3B1BC8CC2EA38D4C2C3FF375FF70CFAF76E35BE863D54969CF4A887C8D6223874017B4B509CF3DE096E288512FBEF295D4DE4CC3CA6EAEA779B07100D8CC9E2EF7A6B40575CCC5EC93E32E7F8E4FD7332737F3B179573B4BEC13ABD868CC06A725ECFFC29494FE6AFFD3CEF2DE94681D4A3F19DDE0CF9BB0F13974443EA04D6CE173E0655BAFC847B5D55393BE982E00903B557B61FB38F15A88CADA345BC8B7820BB1C051C0A8B13AE70A5479E87D6BCA8A7AA73C306AF0FACD6760C566014DE790</code></pre>
<!-- end client_DH_inner_data_output -->
<p>The length of the final string is 336 bytes.</p>
<h6>7.2) set_client_DH_params query</h6>
<!-- start set_client_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 1C 47 04 00 5A 96 9E 64
0010 | 78 01 00 00 1F 5F 04 F5 3B 6C E1 1B ED C3 46 61
0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | 91 06 77 B5 9A 8B DD 7C FE 50 01 00 C6 5B D1 2A
0040 | 8A D2 A1 4A C0 34 3F 20 F6 BF 38 44 DD 8D 81 A1
0050 | 89 75 F0 82 7F EE 29 DD 0C B9 7F 7F 15 31 D3 EF
0060 | 78 1A 97 77 F7 99 EA D7 2C DB B8 4B EA BC EB EC
0070 | 4C 82 32 D5 17 73 49 3C 6C 4D B7 7A 39 B0 BC D4
0080 | AF ED 22 FC EA 12 95 7B DF 0F E5 88 0F B8 D6 C3
0090 | 8B 12 FE 1C 3F 39 69 4D 12 BF A0 A3 E1 24 AC A9
00A0 | 54 7F 44 67 8F 53 88 56 11 96 08 5D E3 1F 6A D0
00B0 | 5F 30 C8 7B 21 3F 0A 2C C3 66 DD 73 12 6F E3 66
00C0 | 8F A4 48 F8 4E 5C 1A 2B CE 76 BE 5B 4B 66 00 1C
00D0 | 69 E6 C1 24 FA 73 1F CF 65 3F 92 A5 84 DF AE CC
00E0 | F2 47 BD 41 AE 10 F3 63 39 99 B0 BA 84 2B FF EC
00F0 | 4B 66 9B B0 16 45 16 71 68 DA BE 5C 9E BE EA 1B
0100 | 0E D9 4D AE D0 C7 BA 6C E6 51 3A 1F 62 92 E9 D9
0110 | B8 5D 83 28 C2 A4 D8 BA 3A 43 DC E4 84 F2 B5 BB
0120 | 26 FD D3 33 7C A8 1D 83 5A 83 0E F5 6F 62 30 60
0130 | DE 68 F9 3E 21 BB A5 E8 93 A2 C3 52 DA 2D D6 97
0140 | A6 B5 62 DD D6 77 AB 92 FD 74 84 45 50 9C DC CF
0150 | 59 54 D9 9D 93 4B D7 AC 27 30 A3 6F 09 6C 0E 8E
0160 | 57 CA 39 C3 6E E8 ED FD CE D8 0B 20 C5 58 B7 5A
0170 | 11 79 44 E5 7E 0D 89 F3 33 E2 16 9E D6 CA 00 C7
0180 | 38 86 CD 68 CC 7B 11 6E 2B E1 56 E6</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 E8 30 0F 00 00 9B 9E 64
0010 | 78 01 00 00 1F 5F 04 F5 DA 60 3B 0B 6C 74 D6 0E
0020 | C9 4A 04 D8 3A F2 02 7D 8C 0C 71 9D 73 8B 75 78
0030 | 66 BA 31 F7 EF 43 97 39 FE 50 01 00 E3 B5 71 6A
0040 | C2 E8 63 42 AD 2E 8C 7B 75 FD 17 C7 13 CE 5C 85
0050 | 59 65 9F 83 01 25 8D 63 D9 10 1D 1D B9 9E A9 C1
0060 | 90 93 15 49 5C 87 76 FD 78 85 CA 40 AB 86 0F 38
0070 | C8 BD 94 6F 90 CC EC 63 F3 ED 2A 5A 8F 06 F4 E4
0080 | 5B FD D0 CC 4A 62 6A F7 4C 29 96 23 B6 4E 8E 38
0090 | 4B B7 A6 6C 36 48 3E A6 67 CE 51 3F B5 C2 B9 C7
00A0 | C6 35 20 6E 82 4F 6B FC 45 A2 59 CE 06 92 74 5E
00B0 | BF 3F DE 3D EE 35 09 03 FC 0E 2F F8 21 DA EC DF
00C0 | 33 3B 23 F7 78 66 A4 44 E2 AC 3B 1B C8 CC 2E A3
00D0 | 8D 4C 2C 3F F3 75 FF 70 CF AF 76 E3 5B E8 63 D5
00E0 | 49 69 CF 4A 88 7C 8D 62 23 87 40 17 B4 B5 09 CF
00F0 | 3D E0 96 E2 88 51 2F BE F2 95 D4 DE 4C C3 CA 6E
0100 | AE A7 79 B0 71 00 D8 CC 9E 2E F7 A6 B4 05 75 CC
0110 | C5 EC 93 E3 2E 7F 8E 4F D7 33 27 37 F3 B1 79 57
0120 | 3B 4B EC 13 AB D8 68 CC 06 A7 25 EC FF C2 94 94
0130 | FE 6A FF D3 CE F2 DE 94 68 1D 4A 3F 19 DD E0 CF
0140 | 9B B0 F1 39 74 44 3E A0 4D 6C E1 73 E0 65 5B AF
0150 | C8 47 B5 D5 53 93 BE 98 2E 00 90 3B 55 7B 61 FB
0160 | 38 F1 5A 88 CA DA 34 5B C8 B7 82 0B B1 C0 51 C0
0170 | A8 B1 3A E7 0A 54 79 E8 7D 6B CA 8A 7A A7 3C 30
0180 | 6A F0 FA CD 67 60 C5 66 01 4D E7 90</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;</code></pre>
<table class="table">
@ -746,7 +746,7 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>1C4704005A969E64</code></td>
<td><code>E8300F00009B9E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -764,19 +764,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>encrypted_data</td>
<td>56, 340</td>
<td><code>FE500100C65BD12A8AD2A14AC0343F20</code> <code>F6BF3844DD8D81A18975F0827FEE29DD</code> <code>0CB97F7F1531D3EF781A9777F799EAD7</code> <code>2CDBB84BEABCEBEC4C8232D51773493C</code> <code>6C4DB77A39B0BCD4AFED22FCEA12957B</code> <code>DF0FE5880FB8D6C38B12FE1C3F39694D</code> <code>12BFA0A3E124ACA9547F44678F538856</code> <code>1196085DE31F6AD05F30C87B213F0A2C</code> <code>C366DD73126FE3668FA448F84E5C1A2B</code> <code>CE76BE5B4B66001C69E6C124FA731FCF</code> <code>653F92A584DFAECCF247BD41AE10F363</code> <code>3999B0BA842BFFEC4B669BB016451671</code> <code>68DABE5C9EBEEA1B0ED94DAED0C7BA6C</code> <code>E6513A1F6292E9D9B85D8328C2A4D8BA</code> <code>3A43DCE484F2B5BB26FDD3337CA81D83</code> <code>5A830EF56F623060DE68F93E21BBA5E8</code> <code>93A2C352DA2DD697A6B562DDD677AB92</code> <code>FD748445509CDCCF5954D99D934BD7AC</code> <code>2730A36F096C0E8E57CA39C36EE8EDFD</code> <code>CED80B20C558B75A117944E57E0D89F3</code> <code>33E2169ED6CA00C73886CD68CC7B116E</code><br> <code>2BE156E6</code></td>
<td><code>FE500100E3B5716AC2E86342AD2E8C7B</code> <code>75FD17C713CE5C8559659F8301258D63</code> <code>D9101D1DB99EA9C1909315495C8776FD</code> <code>7885CA40AB860F38C8BD946F90CCEC63</code> <code>F3ED2A5A8F06F4E45BFDD0CC4A626AF7</code> <code>4C299623B64E8E384BB7A66C36483EA6</code> <code>67CE513FB5C2B9C7C635206E824F6BFC</code> <code>45A259CE0692745EBF3FDE3DEE350903</code> <code>FC0E2FF821DAECDF333B23F77866A444</code> <code>E2AC3B1BC8CC2EA38D4C2C3FF375FF70</code> <code>CFAF76E35BE863D54969CF4A887C8D62</code> <code>23874017B4B509CF3DE096E288512FBE</code> <code>F295D4DE4CC3CA6EAEA779B07100D8CC</code> <code>9E2EF7A6B40575CCC5EC93E32E7F8E4F</code> <code>D7332737F3B179573B4BEC13ABD868CC</code> <code>06A725ECFFC29494FE6AFFD3CEF2DE94</code> <code>681D4A3F19DDE0CF9BB0F13974443EA0</code> <code>4D6CE173E0655BAFC847B5D55393BE98</code> <code>2E00903B557B61FB38F15A88CADA345B</code> <code>C8B7820BB1C051C0A8B13AE70A5479E8</code> <code>7D6BCA8A7AA73C306AF0FACD6760C566</code><br> <code>014DE790</code></td>
<td>Encrypted client_DH_inner_data generated previously, serialized as a TL byte string</td>
</tr>
</tbody>
@ -785,17 +785,17 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<h5><a class="anchor" href="#8-auth-key-generation" id="8-auth-key-generation" name="8-auth-key-generation"><i class="anchor-icon"></i></a>8) Auth key generation</h5>
<p>The client computes the auth_key using formula <code>g_a^b mod dh_prime</code>:</p>
<!-- start auth_key -->
<pre><code>auth_key = 3527D417E01D4F221CECB78C9B5C29936C3CECC218DF73F86FECBAE6641A78998805CDF21B48558B6B5E51B6F4C639C6007CA58453CFEF33DD6CB6E2FF7FB6DDC9FE801BEC559EBD969B16FD49F6F808B18F8391DD336FB7D2E46D868444EE22B4805E1FDCA0EA115B81B3C23B138503DA4DC02EF639240BB60EB4A897A8A325090E221F4D60B37704D7ED709ABD6AC2C78FF6973B79A5196E8EC6F2814E5BD1A99F716085B03769044F38A8A6683EF8E772C6864C72D01A3EBD83F23C2372AC59CDD9260E104FFF8540A8EE5680BF2885FB385D8F6D759C9C66B355F84EB18CB00C4ADDBB7899AE5A3452C559862C3FC7C1171F5701A4D748830FA90C25F334</code></pre>
<pre><code>auth_key = 48892B997A14A133B6D5B234A7F9B19DCE70CB192B9238372639DD6230B1BCC8D31BBBCCFA7F00BBEF38303BAE50FFF3DC814333123CE6E5980EF4493A74F38AD6B05B6737E296ADF4C97C69C95C5EC840BC22694F4CBFC14598B28F83B5CD79FE881F6AB9615226DF63078688371B3CDD2F6E97B35D17E6710E29469E1476B596C1DE136F05D585290776B306D6946B1C33374A459ECB0E9BFBC5A43D145A6B37C276E94C840EA0950B0B2523744CD538817DBA33CD6C84175AEA8561EBA117D2589EFB30A304B0F7AF29FF141E6B3F6F9FA5CEFF31DF1166937EA07D850427B6D779BBAB5B062526D435206EA25158EABC659DE3DC5E4ABF0D93B87B35E5E7</code></pre>
<!-- end auth_key -->
<h5><a class="anchor" href="#9-final-server-reply" id="9-final-server-reply" name="9-final-server-reply"><i class="anchor-icon"></i></a>9) Final server reply</h5>
<p>The server verifies and confirms that auth_key_hash is unique: since it's unique, it replies with the following:</p>
<!-- start dh_gen_ok -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 98 C9 4C 5A 96 9E 64
0010 | 34 00 00 00 34 F7 CB 3B 3B 6C E1 1B ED C3 46 61
0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | 91 06 77 B5 9A 8B DD 7C 09 8D 03 93 43 E0 FD 46
0040 | 06 5E 7C 90 20 D7 9F 17</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 84 8C 9F 00 9B 9E 64
0010 | 34 00 00 00 34 F7 CB 3B DA 60 3B 0B 6C 74 D6 0E
0020 | C9 4A 04 D8 3A F2 02 7D 8C 0C 71 9D 73 8B 75 78
0030 | 66 BA 31 F7 EF 43 97 39 B0 91 C6 77 C6 99 6C 09
0040 | FF 59 F2 F9 AB 28 16 78</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;</code></pre>
<table class="table">
@ -817,7 +817,7 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>0198C94C5A969E64</code></td>
<td><code>01848C9F009B9E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -835,19 +835,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td><code>DA603B0B6C74D60EC94A04D83AF2027D</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td><code>8C0C719D738B757866BA31F7EF439739</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>new_nonce_hash1</td>
<td>56, 16</td>
<td><code>098D039343E0FD46065E7C9020D79F17</code></td>
<td><code>B091C677C6996C09FF59F2F9AB281678</code></td>
<td>The 128 lower-order bits of SHA1 of the byte string derived from the <code>new_nonce</code> string by adding a single byte with the value of 1, 2, or 3, and followed by another 8 bytes with <code>auth_key_aux_hash</code>. Different values are required to prevent an intruder from changing server response dh_gen_ok into dh_gen_retry.</td>
</tr>
</tbody>