Update content of files

This commit is contained in:
GitHub Action 2023-06-30 08:56:46 +00:00
parent 8df77a6720
commit 24af2caa53
3 changed files with 941 additions and 903 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">A General Bot Platform Overview</a></li>
<li><a href="/bots/api">Full API Reference for Developers</a></li> <li><a href="/bots/api">Full API Reference for Developers</a></li>
</ul> </ul>
<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> <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>
<ul> <ul>
<li><a href="#inputs"><strong>Inputs</strong></a><ul> <li><a href="#inputs"><strong>Inputs</strong></a><ul>
<li><a href="#inputs">Text</a></li> <li><a href="#inputs">Text</a></li>
@ -69,7 +69,7 @@
<li><a href="#payments">Payments</a></li> <li><a href="#payments">Payments</a></li>
<li><a href="#web-login">Web Login</a></li> <li><a href="#web-login">Web Login</a></li>
<li><a href="#html5-games">HTML5 Games</a></li> <li><a href="#html5-games">HTML5 Games</a></li>
<li><a href="#stickers">Stickers</a> </li> <li><a href="#stickers-and-custom-emoji">Stickers</a> </li>
</ul> </ul>
</li> </li>
<li><a href="#language-support"><strong>Language Support</strong></a></li> <li><a href="#language-support"><strong>Language Support</strong></a></li>
@ -83,22 +83,21 @@
<li><a href="#botfather"><strong>BotFather, creating and managing bots</strong></a></li> <li><a href="#botfather"><strong>BotFather, creating and managing bots</strong></a></li>
</ul> </ul>
<hr> <hr>
<h3><a class="anchor" name="inputs" href="#inputs"><i class="anchor-icon"></i></a>Inputs</h3> <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&#39;re feeling lucky. However, Telegram bots offer many other tools for building flexible interfaces tailored to your specific needs:</p> <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>
<ul> <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="#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&#39;s keyboard with predefined answer options.</li> <li><a href="#keyboards">Keyboards</a> that replace the user's keyboard with predefined answer options.</li>
<li><a href="#inline-keyboards">Buttons</a> that are shown next to messages from the bot.</li> <li><a href="#inline-keyboards">Buttons</a> that are shown next to messages from the bot.</li>
</ul> </ul>
<p>For even more flexibility, <a href="#web-apps">Web Apps</a> support 100% custom interfaces with JavaScript. </p> <p>For even more flexibility, <a href="#web-apps">Web Apps</a> support 100% custom interfaces with JavaScript. </p>
<div> <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> </div>
<blockquote> <blockquote>
<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> <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>
</blockquote> </blockquote>
<h4><a class="anchor" name="commands" href="#commands"><i class="anchor-icon"></i></a>Commands</h4> <h4><a class="anchor" href="#commands" id="commands" name="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> <p>A command is a simple <code>/keyword</code> that tells the bot what to do. Telegram apps will:</p>
<ul> <ul>
<li><strong>Highlight</strong> commands in messages. When the user taps a highlighted command, that command is immediately sent again.</li> <li><strong>Highlight</strong> commands in messages. When the user taps a highlighted command, that command is immediately sent again.</li>
@ -113,61 +112,58 @@
<li>/newlocation </li> <li>/newlocation </li>
<li>/newrule </li> <li>/newrule </li>
</ul> </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 &quot;<em>location</em>“ or ”<em>rule</em>&quot;.</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 "<em>location</em>" or "<em>rule</em>".</p>
<div> <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" <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>
width=44% /></a>
</div> </div>
<blockquote> <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> <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> </blockquote>
<h5><a class="anchor" name="command-scopes" href="#command-scopes"><i class="anchor-icon"></i></a>Command Scopes</h5> <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> <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> <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> <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> <p>Bots with privacy mode enabled will only receive commands in groups under special conditions, <a href="#privacy-mode">see here</a>.</p>
</blockquote> </blockquote>
<h4><a class="anchor" name="keyboards" href="#keyboards"><i class="anchor-icon"></i></a>Keyboards</h4> <h4><a class="anchor" href="#keyboards" id="keyboards" name="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>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> <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> <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> </div>
<blockquote> <blockquote>
<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> <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>
</blockquote> </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> <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" name="inline-keyboards" href="#inline-keyboards"><i class="anchor-icon"></i></a>Inline Keyboards</h4> <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&#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>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&#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> <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>
<div> <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> </div>
<blockquote> <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> <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> </blockquote>
<h4><a class="anchor" name="menu-button" href="#menu-button"><i class="anchor-icon"></i></a>Menu Button</h4> <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&#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>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>
<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> <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;"> <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"> <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 src="/file/464001555/10fbd/jvTuV2Ke7WQ.1916669.mp4/a056de323645db409d" type="video/mp4">
</video> </source></video>
</div> </div>
<p>The <strong>menu button</strong> can alternatively be used to launch a <a href="#web-apps">Web App</a>.</p> <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" name="global-commands" href="#global-commands"><i class="anchor-icon"></i></a>Global Commands</h4> <h4><a class="anchor" href="#global-commands" id="global-commands" name="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> <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> <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>/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>/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&#39;s settings for this user and suggests commands to edit them.</li> <li>/settings - (if applicable) shows the bot's settings for this user and suggests commands to edit them.</li>
</ul> </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&#39;s profile page if you add them in <a href="https://t.me/botfather">@BotFather</a>.</p> <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" name="chat-and-user-selection" href="#chat-and-user-selection"><i class="anchor-icon"></i></a>Chat and User Selection</h3> <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>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>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>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> <p>Here is a <strong>quick start guide</strong> to use this feature:</p>
@ -175,75 +171,74 @@ width=44% /></a>
<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>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>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>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&#39;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'll receive its identifier in a <code>chat_shared</code> or <code>user_shared</code> service message.</li>
</ul> </ul>
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;"> <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"> <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 src="/file/464001095/11121/M6HpBwtivTE.1913043.mp4/0514a29affa78a6dca" type="video/mp4">
</video> </source></video>
</div> </div>
<blockquote> <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> <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> </blockquote>
<hr> <hr>
<h3><a class="anchor" name="interactions" href="#interactions"><i class="anchor-icon"></i></a>Interactions</h3> <h3><a class="anchor" href="#interactions" id="interactions" name="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> <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> <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="#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="#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> <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> </ul>
<h4><a class="anchor" name="inline-requests" href="#inline-requests"><i class="anchor-icon"></i></a>Inline Requests</h4> <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&#39;s <em>@username</em> and enter a keyword.</p> <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>
<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>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> <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> <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> </div>
<blockquote> <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> <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> </blockquote>
<h4><a class="anchor" name="deep-linking" href="#deep-linking"><i class="anchor-icon"></i></a>Deep Linking</h4> <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&#39;s Telegram account to their account on another platform.</p> <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>
<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> <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> <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> <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> </blockquote>
<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> <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>
<pre><code>https://t.me/your_bot?start=airplane</code></pre> <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> <p>When someone opens a chat with your bot via this link, you will receive:</p>
<pre><code>/start airplane</code></pre> <pre><code>/start airplane</code></pre>
<p><strong>Groups</strong><br>In groups, you can add the parameter <code>startgroup</code> to this link. For example:</p> <p><strong>Groups</strong>
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> <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> <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> <pre><code>/start@your_bot spaceship</code></pre>
<blockquote> <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> <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> </blockquote>
<h4><a class="anchor" name="attachment-menu" href="#attachment-menu"><i class="anchor-icon"></i></a>Attachment Menu</h4> <h4><a class="anchor" href="#attachment-menu" id="attachment-menu" name="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> <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;"> <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"> <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 src="/file/464001177/11b03/ruSbBLQiLJ8.928268.mp4/d9ad95048d23f3cc3f" type="video/mp4">
</video> </source></video>
</div> </div>
<blockquote> <blockquote>
<p>Try adding <a href="https://t.me/durgerkingbot?startattach">@DurgerKingBot</a> to your attachment menu.</p> <p>Try adding <a href="https://t.me/durgerkingbot?startattach">@DurgerKingBot</a> to your attachment menu.</p>
</blockquote> </blockquote>
<hr> <hr>
<h3><a class="anchor" name="integration" href="#integration"><i class="anchor-icon"></i></a>Integration</h3> <h3><a class="anchor" href="#integration" id="integration" name="integration"><i class="anchor-icon"></i></a>Integration</h3>
<p>There are various ways of futher integrating bots with Telegram and other services.</p> <p>There are various ways of futher integrating bots with Telegram and other services.</p>
<ul> <ul>
<li>Use <a href="#web-apps">Web Apps</a> to replace any website.</li> <li>Use <a href="#web-apps">Web Apps</a> to replace any website.</li>
<li>Accept <a href="#payments">Payments</a> via dozens of integrated third-party payment providers.</li> <li>Accept <a href="#payments">Payments</a> via dozens of integrated third-party payment providers.</li>
<li>Connect to Telegram using the <a href="#web-login">Web Login</a> functionality.</li> <li>Connect to Telegram using the <a href="#web-login">Web Login</a> functionality.</li>
<li>Create gaming bots by integrating <a href="#html5-games">HTML5 Games</a>.</li> <li>Create gaming bots by integrating <a href="#html5-games">HTML5 Games</a>.</li>
<li>Help users create and manage <a href="#stickers">Telegram Stickers</a>.</li> <li>Help users create and manage <a href="#stickers-and-custom-emoji">Telegram Stickers</a>.</li>
</ul> </ul>
<h3><a class="anchor" name="web-apps" href="#web-apps"><i class="anchor-icon"></i></a>Web Apps</h3> <h3><a class="anchor" href="#web-apps" id="web-apps" name="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> <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> <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> <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>
@ -251,15 +246,14 @@ width=44% /></a>
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;"> <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"> <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 src="/file/464001679/11aa9/KQx_BlPVXRo.4922145.mp4/c65433c8ac11a347a8" type="video/mp4">
</video> </source></video>
</div> </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>
<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" href="#payments" id="payments" name="payments"><i class="anchor-icon"></i></a>Payments</h3>
<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'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>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> <p>Here is a <strong>quick start guide</strong> to implement payments:</p>
<ul> <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 &quot;<strong>Stripe TEST MODE</strong>&quot; 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 "<strong>Stripe TEST MODE</strong>" provider.</li>
<li>Implement payments via the <a href="/bots/api#payments">appropriate API methods</a>.</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> <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> </ul>
@ -272,38 +266,37 @@ width=44% /></a>
</ul> </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> <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> <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> </div>
<blockquote> <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.<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> <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>
</blockquote> </blockquote>
<h3><a class="anchor" name="web-login" href="#web-login"><i class="anchor-icon"></i></a>Web Login</h3> <h3><a class="anchor" href="#web-login" id="web-login" name="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> <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" name="widgets" href="#widgets"><i class="anchor-icon"></i></a>Widgets</h4> <h4><a class="anchor" href="#widgets" id="widgets" name="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> <p>The Telegram login widget is a <strong>simple and secure way to authorize users</strong> on your website.</p>
<ol> <ol>
<li>Choose a bot ideally its name and profile pic <strong>should match</strong> the website title and logo.</li> <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>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> <li>Configure your widget using <a href="/widgets/login#widget-configuration">our dedicated tool</a> and embed it on your website.</li>
</ol> </ol>
<h4><a class="anchor" name="inline-login" href="#inline-login"><i class="anchor-icon"></i></a>Inline Login</h4> <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&#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> <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>
<div> <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> </div>
<blockquote> <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> <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> </blockquote>
<h3><a class="anchor" name="html5-games" href="#html5-games"><i class="anchor-icon"></i></a>HTML5 Games</h3> <h3><a class="anchor" href="#html5-games" id="html5-games" name="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>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> <p>To get started, follow these simple steps:</p>
<ul> <ul>
<li>Send the <code>/newgame</code> command to <a href="https://t.me/botfather">@BotFather</a></li> <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>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>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&#39;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'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> <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> </ul>
<p>Then, to handle <strong>highscores</strong>:</p> <p>Then, to handle <strong>highscores</strong>:</p>
@ -317,49 +310,50 @@ width=44% /></a>
<li><a href="/bots/api#games">HTML5 Games Bot API Docs</a></li> <li><a href="/bots/api#games">HTML5 Games Bot API Docs</a></li>
</ul> </ul>
<div> <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> </div>
<blockquote> <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> <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> </blockquote>
<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> <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>
<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><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&#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>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><br>To create a <strong>new pack</strong>, simply:</p> <p><strong>Creating a new pack</strong>
To create a <strong>new pack</strong>, simply:</p>
<ul> <ul>
<li><strong>Prepare</strong> your artwork following our <a href="https://core.telegram.org/stickers">technical requirements</a>.</li> <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><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> <li>You can use <a href="api#addstickertoset">addStickerToSet</a> to add stickers or emoji later on.</li>
</ul> </ul>
<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><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>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>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&#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> <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>
<blockquote> <blockquote>
<p>Note that these methods will only work on packs <strong>created by the bot that is calling them</strong>.</p> <p>Note that these methods will only work on packs <strong>created by the bot that is calling them</strong>.</p>
</blockquote> </blockquote>
<h3><a class="anchor" name="language-support" href="#language-support"><i class="anchor-icon"></i></a>Language Support</h3> <h3><a class="anchor" href="#language-support" id="language-support" name="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>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> <p>We recommend that you follow our guidelines to provide <strong>the best user experience</strong>.</p>
<ul> <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>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&#39;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's <em>language_code</em> your HTML page should account for it.</li>
<li><a href="/bots/html5-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><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&#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>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>Command lists can also be specified for individual languages more on this <a href="#commands">here</a>.</li> <li>Command lists can also be specified for individual languages more on this <a href="#commands">here</a>.</li>
</ul> </ul>
<div class="blog_video_player_wrap" style="max-width: 400px; margin: 20px auto 20px;"> <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"> <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 src="/file/464001083/105cd/NF4ViAHfTJc.3601652.mp4/0fd787953c11a6371d" type="video/mp4">
</video> </source></video>
</div> </div>
<blockquote> <blockquote>
<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> <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>
</blockquote> </blockquote>
<hr> <hr>
<h3><a class="anchor" name="bot-management" href="#bot-management"><i class="anchor-icon"></i></a>Bot Management</h3> <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" name="privacy-mode" href="#privacy-mode"><i class="anchor-icon"></i></a>Privacy Mode</h4> <h4><a class="anchor" href="#privacy-mode" id="privacy-mode" name="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> <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> <ul>
<li>Commands explicitly meant for them (e.g., <code>/command@this_bot</code>).</li> <li>Commands explicitly meant for them (e.g., <code>/command@this_bot</code>).</li>
@ -373,21 +367,20 @@ width=44% /></a>
<li>All messages from private chats.</li> <li>All messages from private chats.</li>
<li>All messages from channels where they are a member.</li> <li>All messages from channels where they are a member.</li>
</ul> </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&#39;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's messages should be more than enough.</p>
<div> <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> </div>
<blockquote> <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> <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> </blockquote>
<h3><a class="anchor" name="testing-your-bot" href="#testing-your-bot"><i class="anchor-icon"></i></a>Testing your bot</h3> <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>
<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>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> <p>All further testing and debugging can happen privately on the new bot, without affecting the original instance.</p>
<blockquote> <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> <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> </blockquote>
<h4><a class="anchor" name="dedicated-test-environment" href="#dedicated-test-environment"><i class="anchor-icon"></i></a>Dedicated test environment</h4> <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>
<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> <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> <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> <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>
@ -396,55 +389,62 @@ width=44% /></a>
<blockquote> <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> <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> </blockquote>
<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> <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>
<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>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> <p>To create an account and log in, use either of the following:</p>
<ul> <ul>
<li><strong>iOS</strong>: tap 10 times on the Settings icon &gt; Accounts &gt; Login to another account &gt; Test.</li> <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 &#39;Add Account&#39; and select &#39;Test Server&#39;.</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 &#39;Add Account&#39; and log in via phone number.</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>
</ul> </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> <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> <pre><code>https://api.telegram.org/bot&lt;token&gt;/test/METHOD_NAME</code></pre>
<blockquote> <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> <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> </blockquote>
<h4><a class="anchor" name="status-alerts" href="#status-alerts"><i class="anchor-icon"></i></a>Status alerts</h4> <h4><a class="anchor" href="#status-alerts" id="status-alerts" name="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>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> <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" name="responding-to-alerts" href="#responding-to-alerts"><i class="anchor-icon"></i></a>Responding to alerts</h5> <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>
<p>By default, <strong>you will only get one alert per bot per hour</strong>. </p> <p>By default, <strong>you will only get one alert per bot per hour</strong>. </p>
<p>Each alert has the following buttons:</p> <p>Each alert has the following buttons:</p>
<ul> <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>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&#39;t see any issues with your bot or if you think the problem is on our side.</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&#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> <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>
</ul> </ul>
<h5><a class="anchor" name="monitored-issues" href="#monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5> <h5><a class="anchor" href="#monitored-issues" id="monitored-issues" name="monitored-issues"><i class="anchor-icon"></i></a>Monitored issues</h5>
<p>We currently notify you about the following issues:</p> <p>We currently notify you about the following issues:</p>
<ul> <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>
<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> </li>
</ul> </ul>
<blockquote> <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> <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> </blockquote>
<ul> <ul>
<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> <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>
</ul> </ul>
<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>
<li><strong>Too few answers to callback queries</strong>. Conversion rate: <strong>{value}</strong></li> <p>You can host and work with <strong>your own instance</strong> of our open-source <a href="/bots/api">Bot API</a>.
<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> 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>
<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> <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> <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> <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> </blockquote>
<p>By hosting our API locally you&#39;ll gain access to <strong>some upgrades</strong>, including:</p> <p>By hosting our API locally you'll gain access to <strong>some upgrades</strong>, including:</p>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -476,31 +476,36 @@ width=44% /></a>
</tbody> </tbody>
</table> </table>
<blockquote> <blockquote>
<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> <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>
</blockquote> </blockquote>
<hr> <hr>
<h3><a class="anchor" name="botfather" href="#botfather"><i class="anchor-icon"></i></a>BotFather</h3> <h3><a class="anchor" href="#botfather" id="botfather" name="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> <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" name="creating-a-new-bot" href="#creating-a-new-bot"><i class="anchor-icon"></i></a>Creating a new bot</h4> <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>
<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> <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> <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>
<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>
<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> </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> </li>
</ul> </ul>
<blockquote> <blockquote>
<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> <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>
</blockquote> </blockquote>
<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> <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> <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> <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> <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> <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> </blockquote>
<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> <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>
<blockquote> <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> <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> </blockquote>
@ -508,36 +513,38 @@ width=44% /></a>
<blockquote> <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> <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> </blockquote>
<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> <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>
<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> <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" name="transfer-ownership" href="#transfer-ownership"><i class="anchor-icon"></i></a>Transfer ownership</h4> <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>.<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> <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>
<blockquote> <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> <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> </blockquote>
<h4><a class="anchor" name="botfather-commands" href="#botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4> <h4><a class="anchor" href="#botfather-commands" id="botfather-commands" name="botfather-commands"><i class="anchor-icon"></i></a>BotFather commands</h4>
<p>The remaining commands are pretty self-explanatory:</p> <p>The remaining commands are pretty self-explanatory:</p>
<ul> <ul>
<li>/mybots returns a list of your bots with handy controls to edit their settings.</li> <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> <li>/mygames does the same for your games.</li>
</ul> </ul>
<h4><a class="anchor" name="edit-bots" href="#edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4> <h4><a class="anchor" href="#edit-bots" id="edit-bots" name="edit-bots"><i class="anchor-icon"></i></a>Edit bots</h4>
<p>To edit your bot, you have two options.</p> <p>To edit your bot, you have two options.</p>
<p>You can use the available commands:</p> <p>You can use the available commands:</p>
<ul> <ul>
<li>/setname change your bot&#39;s <strong>name</strong>.</li> <li>/setname change your bot'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>/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&#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>/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&#39;s <strong>profile picture</strong>. </li> <li>/setuserpic change the bot'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>/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>/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> <li>/deletebot delete your bot and <strong>free its username</strong>. Cannot be undone.</li>
</ul> </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> <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> <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&#39;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's public-facing info directly from its profile page including setting a custom <strong>profile video</strong>.</p>
</blockquote> </blockquote>
<h4><a class="anchor" name="edit-settings" href="#edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4> <h4><a class="anchor" href="#edit-settings" id="edit-settings" name="edit-settings"><i class="anchor-icon"></i></a>Edit settings</h4>
<ul> <ul>
<li>/setinline toggle <strong>inline mode</strong> for your bot.</li> <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> <li>/setinlinegeo request <strong>location data</strong> to provide location-based inline results.</li>
@ -545,7 +552,7 @@ width=44% /></a>
<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>/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> <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> </ul>
<h4><a class="anchor" name="manage-games" href="#manage-games"><i class="anchor-icon"></i></a>Manage games</h4> <h4><a class="anchor" href="#manage-games" id="manage-games" name="manage-games"><i class="anchor-icon"></i></a>Manage games</h4>
<ul> <ul>
<li>/newgame create a new game.</li> <li>/newgame create a new game.</li>
<li>/listgames see a list of your games.</li> <li>/listgames see a list of your games.</li>
@ -559,9 +566,8 @@ width=44% /></a>
<p>With this information, you are ready to proceed to our <a href="/bots/api">Full API Reference for Developers</a>.</p> <p>With this information, you are ready to proceed to our <a href="/bots/api">Full API Reference for Developers</a>.</p>
<ul> <ul>
<li>If you have any questions, check out our <a href="/bots/faq">Bot FAQ</a>.</li> <li>If you have any questions, check out our <a href="/bots/faq">Bot FAQ</a>.</li>
<li>If you&#39;re experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li> <li>If you're experiencing issues with our API, please contact <a href="https://t.me/botsupport">@BotSupport</a> on Telegram.</li>
</ul> </ul></div>
</div>
</div> </div>

View file

@ -44,7 +44,6 @@
<div id="dev_page_content"><!-- scroll_nav --> <div id="dev_page_content"><!-- scroll_nav -->
<h1><a class="anchor" href="#" id="" name=""><i class="anchor-icon"></i></a></h1>
<p>In the examples below, the <a href="/mtproto#transport">transport</a> headers are omitted:</p> <p>In the examples below, the <a href="/mtproto#transport">transport</a> headers are omitted:</p>
<blockquote> <blockquote>
<p>For example, for the <a href="/mtproto/mtproto-transports#abridged">abridged version of the transport »</a>, the client sends <code>0xef</code> as the first byte (<strong>important:</strong> only prior to the very first data packet), then the packet length is encoded with a single byte (<code>0x01-0x7e</code> = data length divided by 4; or <code>0x7f</code> followed by 3 bytes (little endian) divided by 4) followed by the data itself. In this case, server responses have the same structure (although the server does not send <code>0xef</code>as the first byte).</p> <p>For example, for the <a href="/mtproto/mtproto-transports#abridged">abridged version of the transport »</a>, the client sends <code>0xef</code> as the first byte (<strong>important:</strong> only prior to the very first data packet), then the packet length is encoded with a single byte (<code>0x01-0x7e</code> = data length divided by 4; or <code>0x7f</code> followed by 3 bytes (little endian) divided by 4) followed by the data itself. In this case, server responses have the same structure (although the server does not send <code>0xef</code>as the first byte).</p>
@ -54,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> <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 --> <!-- start req_pq_multi -->
<p>Sent payload (excluding transport headers/trailers):</p> <p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 84 8C 00 00 B1 AF 9C 64 <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 B0 BB 83 C2 68 49 38 B7 0010 | 14 00 00 00 F1 8E 7E BE 3B 6C E1 1B ED C3 46 61
0020 | 6A C4 92 3A A5 45 C8 F0</code></pre> 0020 | B0 E7 0F 88 33 91 0C 6F</code></pre>
<p>Payload (de)serialization:</p> <p>Payload (de)serialization:</p>
<pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre> <pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre>
<table class="table"> <table class="table">
@ -78,8 +77,8 @@
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>848C0000B1AF9C64</code></td> <td><code>CCEF060059969E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a></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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
@ -96,7 +95,7 @@
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Random number</td> <td>Random number</td>
</tr> </tr>
</tbody> </tbody>
@ -105,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> <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 --> <!-- start resPQ -->
<p>Received payload (excluding transport headers/trailers):</p> <p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 9C 04 77 B1 AF 9C 64 <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 B0 BB 83 C2 68 49 38 B7 0010 | 50 00 00 00 63 24 16 05 3B 6C E1 1B ED C3 46 61
0020 | 6A C4 92 3A A5 45 C8 F0 59 2E 37 C5 BF 99 B8 DD 0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | AE 33 E6 EE 39 4B 47 42 08 2E 07 1E 8F 6E F5 45 0030 | 91 06 77 B5 9A 8B DD 7C 08 15 D2 EA 60 D9 E9 F0
0040 | 63 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09 0040 | 61 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 0050 | 35 5F C3 0B 21 6B E8 6C 02 2B B4 C3 85 FD 64 DE
0060 | 85 1D 9D D0</code></pre> 0060 | 85 1D 9D D0</code></pre>
<p>Payload (de)serialization:</p> <p>Payload (de)serialization:</p>
@ -133,8 +132,8 @@
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>019C0477B1AF9C64</code></td> <td><code>01EC6A6259969E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a></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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
@ -151,19 +150,19 @@
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Server-generated random number</td> <td>Server-generated random number</td>
</tr> </tr>
<tr> <tr>
<td>pq</td> <td>pq</td>
<td>56, 12</td> <td>56, 12</td>
<td><code>082E071E8F6EF54563000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 3316653251972384099</td> <td><code>0815D2EA60D9E9F061000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1572576921599471713</td>
<td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td> <td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
@ -209,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> <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> <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 --> <!-- start pq -->
<pre><code>pq = 3316653251972384099</code></pre> <pre><code>pq = 1572576921599471713</code></pre>
<p>Decompose into 2 prime cofactors: <code>3316653251972384099 = 1704206131 * 1946157329</code></p> <p>Decompose into 2 prime cofactors: <code>1572576921599471713 = 1182921973 * 1329400381</code></p>
<pre><code>p = 1704206131 <pre><code>p = 1182921973
q = 1946157329</code></pre> q = 1329400381</code></pre>
<!-- end pq --> <!-- 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> <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> <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> <p>First of all, generate an <code>encrypted_data</code> payload as follows:</p>
<!-- start p_q_inner_data_dc --> <!-- start p_q_inner_data_dc -->
<p>Generated payload (excluding transport headers/trailers):</p> <p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 95 5F F5 A9 08 2E 07 1E 8F 6E F5 45 63 00 00 00 <pre><code>0000 | 95 5F F5 A9 08 15 D2 EA 60 D9 E9 F0 61 00 00 00
0010 | 04 65 94 1F 33 00 00 00 04 74 00 01 11 00 00 00 0010 | 04 46 81 F4 F5 00 00 00 04 4F 3D 0A 3D 00 00 00
0020 | B0 BB 83 C2 68 49 38 B7 6A C4 92 3A A5 45 C8 F0 0020 | 3B 6C E1 1B ED C3 46 61 B0 E7 0F 88 33 91 0C 6F
0030 | 59 2E 37 C5 BF 99 B8 DD AE 33 E6 EE 39 4B 47 42 0030 | 78 D0 02 2E 8C 91 C6 34 91 06 77 B5 9A 8B DD 7C
0040 | FA 05 D4 1E 4C C4 D7 94 58 F8 26 B2 33 4B 26 67 0040 | ED FD 84 45 50 63 A5 3E AB FB 6D 2E 4B 46 7D 2F
0050 | 5C C6 64 8E 23 E7 62 6B 75 A1 B9 09 98 1A C9 55 0050 | A7 92 E2 CF 09 22 6E E0 10 74 AD 37 BF A3 61 01
0060 | 02 00 00 00</code></pre> 0060 | 02 00 00 00</code></pre>
<p>Payload (de)serialization:</p> <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> <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>
@ -247,37 +246,37 @@ q = 1946157329</code></pre>
<tr> <tr>
<td>pq</td> <td>pq</td>
<td>4, 12</td> <td>4, 12</td>
<td><code>082E071E8F6EF54563000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 3316653251972384099</td> <td><code>0815D2EA60D9E9F061000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1572576921599471713</td>
<td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td> <td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>p</td> <td>p</td>
<td>16, 8</td> <td>16, 8</td>
<td><code>0465941F33000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1704206131</td> <td><code>044681F4F5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1182921973</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>q</td> <td>q</td>
<td>24, 8</td> <td>24, 8</td>
<td><code>0474000111000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1946157329</td> <td><code>044F3D0A3D000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1329400381</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>32, 16</td> <td>32, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>48, 16</td> <td>48, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>new_nonce</td> <td>new_nonce</td>
<td>64, 32</td> <td>64, 32</td>
<td><code>FA05D41E4CC4D79458F826B2334B2667</code> <code>5CC6648E23E7626B75A1B909981AC955</code></td> <td><code>EDFD84455063A53EABFB6D2E4B467D2F</code> <code>A792E2CF09226EE01074AD37BFA36101</code></td>
<td>Client-generated random number</td> <td>Client-generated random number</td>
</tr> </tr>
<tr> <tr>
@ -292,39 +291,39 @@ q = 1946157329</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> <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> 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 --> <!-- start p_q_inner_data_input -->
<pre><code>data = 955FF5A9082E071E8F6EF545630000000465941F330000000474000111000000B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B4742FA05D41E4CC4D79458F826B2334B26675CC6648E23E7626B75A1B909981AC95502000000 <pre><code>data = 955FF5A90815D2EA60D9E9F061000000044681F4F5000000044F3D0A3D0000003B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7CEDFD84455063A53EABFB6D2E4B467D2FA792E2CF09226EE01074AD37BFA3610102000000
random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D9118B8AB14EB6A100AA469AACCB3B9961D5E588C19A4E0C17F8C5CEDC003442FD0AECC129BFD6EEA4AD293FF753A0B194AB005F24E74FA78A98E10EAA2F16AD98</code></pre> random_padding_bytes = D7BE719CB22BA6AF3DE51EADA87C69C52899A766A1060020D8F78E99F5BA4CE541FA6A770C64721DF54FF65A28D6BBD17EB31520D2E38A2414166F0DDC9504CF67B374297516EA704BC3CDA83CD239D777869EA299EC82F9BDC51E15</code></pre>
<!-- end p_q_inner_data_input --> <!-- end p_q_inner_data_input -->
<p>And this is the output:</p> <p>And this is the output:</p>
<!-- start p_q_inner_data_output --> <!-- start p_q_inner_data_output -->
<pre><code>encrypted_data = DF92287F32BBAE22049A7DF88007F9FBE0103D8DF533E4ED59C0A25B6D99FA0A9F2C83A8E45C28B2C7AB6D541B38C6254FDE09B773B38ECDB94B660D71415CDFD4B8BAD8B91DC60B837BF4205A781AB77885D8E0EF71E329D4B9356302C4D2BE16E34A6A939559BE65EC2F0EFE2CD561E9B058A13B5C8EEEB6907DF897AA7E48BE7F7DE1D13058476C8EDF60A79330D0A9178E3FA064EF069063BC37AAA3CC1B5E0E347290E5C1197A10C01986035E20C0B106074C857906131ACE5F75900037E16F66FC0D0D62383412CE7D7A9DCC45AFC3025AD9976268664F4162581175139A2F0910C69CDFBE9DA93CAC8C3CA67A4278E2CD2A67EF9D9FF5D7F866E24596</code></pre> <pre><code>encrypted_data = A527714D9BE67624A4B3B7805E93D3D845ECD997A689C7022449909D7444BEF564B361443A949201616ACA30E9FF622C4597A330CDFAF2FFC3185BD9DF83E0D36F35C9921F0653202F696F7AB61BFBF3FA44F8B7D228ED08CDA276B7070F5C0FC6DD87FC8F27D61D63A358ED557CEA2977F2F8474458091F94AA54B46F97BBCB0409F4A999ECC9DC86EE294C608A9558C222B5D7FF4E339306583571F8DD08B6A6FF9D475F93FCB6E7FCF61E8EE1CB394378EBD7DCC86526852BA2FAFD219984FC1BEA7D10EB655AE34E62B0F38301D96160557777DCAD40C1FC311F009D998BB147226A0316A83F4810D6C164755D5AD02F0144BE205F31E5AC778FF3BBAAD7</code></pre>
<!-- end p_q_inner_data_output --> <!-- end p_q_inner_data_output -->
<p>The length of the final string is 256 bytes.</p> <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> <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 --> <!-- start req_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p> <p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 74 07 01 00 B1 AF 9C 64 <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 B0 BB 83 C2 68 49 38 B7 0010 | 40 01 00 00 BE E4 12 D7 3B 6C E1 1B ED C3 46 61
0020 | 6A C4 92 3A A5 45 C8 F0 59 2E 37 C5 BF 99 B8 DD 0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | AE 33 E6 EE 39 4B 47 42 04 65 94 1F 33 00 00 00 0030 | 91 06 77 B5 9A 8B DD 7C 04 46 81 F4 F5 00 00 00
0040 | 04 74 00 01 11 00 00 00 85 FD 64 DE 85 1D 9D D0 0040 | 04 4F 3D 0A 3D 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 DF 92 28 7F 32 BB AE 22 04 9A 7D F8 0050 | FE 00 01 00 A5 27 71 4D 9B E6 76 24 A4 B3 B7 80
0060 | 80 07 F9 FB E0 10 3D 8D F5 33 E4 ED 59 C0 A2 5B 0060 | 5E 93 D3 D8 45 EC D9 97 A6 89 C7 02 24 49 90 9D
0070 | 6D 99 FA 0A 9F 2C 83 A8 E4 5C 28 B2 C7 AB 6D 54 0070 | 74 44 BE F5 64 B3 61 44 3A 94 92 01 61 6A CA 30
0080 | 1B 38 C6 25 4F DE 09 B7 73 B3 8E CD B9 4B 66 0D 0080 | E9 FF 62 2C 45 97 A3 30 CD FA F2 FF C3 18 5B D9
0090 | 71 41 5C DF D4 B8 BA D8 B9 1D C6 0B 83 7B F4 20 0090 | DF 83 E0 D3 6F 35 C9 92 1F 06 53 20 2F 69 6F 7A
00A0 | 5A 78 1A B7 78 85 D8 E0 EF 71 E3 29 D4 B9 35 63 00A0 | B6 1B FB F3 FA 44 F8 B7 D2 28 ED 08 CD A2 76 B7
00B0 | 02 C4 D2 BE 16 E3 4A 6A 93 95 59 BE 65 EC 2F 0E 00B0 | 07 0F 5C 0F C6 DD 87 FC 8F 27 D6 1D 63 A3 58 ED
00C0 | FE 2C D5 61 E9 B0 58 A1 3B 5C 8E EE B6 90 7D F8 00C0 | 55 7C EA 29 77 F2 F8 47 44 58 09 1F 94 AA 54 B4
00D0 | 97 AA 7E 48 BE 7F 7D E1 D1 30 58 47 6C 8E DF 60 00D0 | 6F 97 BB CB 04 09 F4 A9 99 EC C9 DC 86 EE 29 4C
00E0 | A7 93 30 D0 A9 17 8E 3F A0 64 EF 06 90 63 BC 37 00E0 | 60 8A 95 58 C2 22 B5 D7 FF 4E 33 93 06 58 35 71
00F0 | AA A3 CC 1B 5E 0E 34 72 90 E5 C1 19 7A 10 C0 19 00F0 | F8 DD 08 B6 A6 FF 9D 47 5F 93 FC B6 E7 FC F6 1E
0100 | 86 03 5E 20 C0 B1 06 07 4C 85 79 06 13 1A CE 5F 0100 | 8E E1 CB 39 43 78 EB D7 DC C8 65 26 85 2B A2 FA
0110 | 75 90 00 37 E1 6F 66 FC 0D 0D 62 38 34 12 CE 7D 0110 | FD 21 99 84 FC 1B EA 7D 10 EB 65 5A E3 4E 62 B0
0120 | 7A 9D CC 45 AF C3 02 5A D9 97 62 68 66 4F 41 62 0120 | F3 83 01 D9 61 60 55 77 77 DC AD 40 C1 FC 31 1F
0130 | 58 11 75 13 9A 2F 09 10 C6 9C DF BE 9D A9 3C AC 0130 | 00 9D 99 8B B1 47 22 6A 03 16 A8 3F 48 10 D6 C1
0140 | 8C 3C A6 7A 42 78 E2 CD 2A 67 EF 9D 9F F5 D7 F8 0140 | 64 75 5D 5A D0 2F 01 44 BE 20 5F 31 E5 AC 77 8F
0150 | 66 E2 45 96</code></pre> 0150 | F3 BB AA D7</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -346,8 +345,8 @@ random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D91
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>74070100B1AF9C64</code></td> <td><code>E41A070059969E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a></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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
@ -364,25 +363,25 @@ random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D91
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>p</td> <td>p</td>
<td>56, 8</td> <td>56, 8</td>
<td><code>0465941F33000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1704206131</td> <td><code>044681F4F5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1182921973</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>q</td> <td>q</td>
<td>64, 8</td> <td>64, 8</td>
<td><code>0474000111000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1946157329</td> <td><code>044F3D0A3D000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1329400381</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
@ -394,7 +393,7 @@ random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D91
<tr> <tr>
<td>encrypted_data</td> <td>encrypted_data</td>
<td>80, 260</td> <td>80, 260</td>
<td><code>FE000100DF92287F32BBAE22049A7DF8</code> <code>8007F9FBE0103D8DF533E4ED59C0A25B</code> <code>6D99FA0A9F2C83A8E45C28B2C7AB6D54</code> <code>1B38C6254FDE09B773B38ECDB94B660D</code> <code>71415CDFD4B8BAD8B91DC60B837BF420</code> <code>5A781AB77885D8E0EF71E329D4B93563</code> <code>02C4D2BE16E34A6A939559BE65EC2F0E</code> <code>FE2CD561E9B058A13B5C8EEEB6907DF8</code> <code>97AA7E48BE7F7DE1D13058476C8EDF60</code> <code>A79330D0A9178E3FA064EF069063BC37</code> <code>AAA3CC1B5E0E347290E5C1197A10C019</code> <code>86035E20C0B106074C857906131ACE5F</code> <code>75900037E16F66FC0D0D62383412CE7D</code> <code>7A9DCC45AFC3025AD9976268664F4162</code> <code>581175139A2F0910C69CDFBE9DA93CAC</code> <code>8C3CA67A4278E2CD2A67EF9D9FF5D7F8</code><br> <code>66E24596</code></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>Value generated above</td> <td>Value generated above</td>
</tr> </tr>
</tbody> </tbody>
@ -403,47 +402,47 @@ random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D91
<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> <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 --> <!-- start server_DH_params_ok -->
<p>Received payload (excluding transport headers/trailers):</p> <p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 30 87 1E B2 AF 9C 64 <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 B0 BB 83 C2 68 49 38 B7 0010 | 78 02 00 00 5C 07 E8 D0 3B 6C E1 1B ED C3 46 61
0020 | 6A C4 92 3A A5 45 C8 F0 59 2E 37 C5 BF 99 B8 DD 0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | AE 33 E6 EE 39 4B 47 42 FE 50 02 00 07 3F F0 CE 0030 | 91 06 77 B5 9A 8B DD 7C FE 50 02 00 83 6A C3 4E
0040 | BA 1A 9E F8 80 F8 85 E4 D0 E9 C1 EF 93 F6 1A 18 0040 | F2 22 34 FE 19 22 3F 02 F8 1B CB F2 E1 AD 74 F0
0050 | BD 1B B7 8D 7A 36 D3 BF 1B 76 6E 28 13 91 02 C4 0050 | B4 D3 CF B4 E5 0B E3 12 C6 B4 EA 17 8B 8A FC 86
0060 | 85 BA 0D 47 D3 83 C8 E6 03 9D BB D3 78 BA A6 4D 0060 | 26 5D C1 73 AF 33 24 8C C2 89 51 C2 FD 8E 1A 56
0070 | C0 67 F1 60 43 96 DA A0 4D 72 1E 11 0D 23 08 F4 0070 | 58 E4 85 AF C6 51 CA AC 1E 2F 31 F8 3D F5 52 2D
0080 | 95 A5 34 DE 44 30 06 DE 91 76 B4 B8 D9 27 24 84 0080 | 8B 1D 04 1A C2 CD 1D 4D 02 B0 C8 C3 95 3B 74 65
0090 | 02 E1 6D 69 FC 8F 73 48 54 BA FB F8 06 00 4E 43 0090 | 2E 6F 85 A3 FE A2 7D F2 B9 7E 46 66 44 24 3D 06
00A0 | 26 9C A8 C8 72 91 D4 F8 F4 36 84 3A 0C B3 FD 63 00A0 | 2D 55 8C DE 6F 96 95 0F F8 EA 2A 3B 4D 83 9E 58
00B0 | 1F E4 D7 F4 1E 8F AC 2E 34 EF 84 0B DA C0 33 14 00B0 | DD 73 0C 44 5B 3E 75 00 FF C5 7E 1F A7 7D 12 CB
00C0 | 24 8A 4A F6 91 AD AB 7A 0C 6B DC CA 3D 85 FD 49 00C0 | 9E FF 24 DC 8E 6F 8B D2 64 60 EB 32 C6 BC 76 45
00D0 | E4 9A E6 E5 18 AF 6D DA 95 CF 03 4F 90 EB 1B 42 00D0 | 44 B0 BC A0 47 0A FA 0E 99 E6 CD DF CB FC 3B 88
00E0 | 50 CD F6 03 F5 81 21 BC 3C 48 89 E0 C6 73 0C 89 00E0 | F4 6A 30 31 4F A0 3F 51 7B 16 FD C6 60 EF 62 96
00F0 | 77 3A 8D 77 C9 FC 7A F3 05 C9 F9 3B D8 35 10 FB 00F0 | 12 89 C8 03 67 7E DA 9B E5 9E 74 3C AC A4 E5 13
0100 | F1 B9 8E D7 08 49 61 5A D2 C9 49 7F 9C 8A 94 4C 0100 | 55 37 1B 94 CA DC DB 16 26 F8 9C 4F 5D 5D FB FF
0110 | B1 D3 A5 1A D1 01 44 B7 77 7A 4A 5E D9 59 FF E0 0110 | DC BD 4A D7 E7 73 6C 9B 08 AB 6E FB 72 5A 07 2F
0120 | 3B 87 3D 4C F0 10 B3 61 C6 2F 7B 42 3E EC 02 CA 0120 | 02 4F 48 F2 64 11 78 3F AA 27 73 87 DA 62 EA EF
0130 | CE 0D 28 0A 6E 34 1E A5 BD AE 28 EF BA 69 D0 50 0130 | 5D BA 72 F6 80 53 61 CD 09 8D C6 C5 51 A8 7B 8F
0140 | 58 10 56 35 6B 7B 6F 66 D9 A9 51 44 16 57 88 42 0140 | 70 7E 0E 2A F0 49 EA F9 50 4D 6C C1 A8 16 3E 86
0150 | 24 0B ED 86 33 38 1F 0C 4A B0 06 C5 4B 60 29 E5 0150 | B9 EC 77 CA 94 CB 92 58 51 73 6B 1F 01 EA 46 32
0160 | 8E AF A3 6F 87 2E E7 C9 5B 5D F5 91 C7 C2 68 6A 0160 | 7D 2A 1B 7F C1 1F B0 A9 53 C6 9D 32 DB 5E 64 45
0170 | 3E 61 48 9F FB 06 F9 10 AC 03 C5 F4 56 B9 A3 C3 0170 | 10 0C 6B 09 96 A6 77 F2 AF E1 E5 04 EE 20 28 87
0180 | 4A 5C CA CE 67 6E 87 5C F3 E7 67 91 C4 AD 88 C3 0180 | AB 15 B2 D7 EF 36 AE 6A B4 22 2F 2B 5D DD F4 3A
0190 | 1F 9D 6F 43 EF 4E 9E F4 8E 0D BC 30 1E F2 9D 2E 0190 | 22 52 D0 17 4B 87 86 96 6B 1D A5 A9 EC 9E 47 20
01A0 | B3 80 30 70 5E 1A 0F 25 F2 00 7D 54 12 96 66 38 01A0 | FD 83 0C 70 E6 5E 6B 27 61 80 77 35 8A E2 CC D6
01B0 | DC 51 14 37 1A 63 08 2C 81 46 2C 3B 70 0E A5 35 01B0 | 21 2E ED 54 91 12 27 1F 0A C5 B8 83 19 A6 C6 EA
01C0 | 6E 28 92 3F 50 87 AF 05 1C FD 81 59 B6 4B 2A DC 01C0 | CD 8B 43 7B 12 67 C8 85 5B 10 80 B9 85 C8 3D 25
01D0 | 80 4E 66 CB 70 F6 AD 25 17 21 C6 B8 CA 2F 21 68 01D0 | 99 1C F3 EA 6D 77 38 F7 10 CE D4 81 19 6B 8E D7
01E0 | 73 14 32 C9 67 BC 8B AE AD 02 96 40 E8 0C 2D C2 01E0 | E3 33 05 8B 24 31 27 0E E0 AA 90 17 DF D1 40 CF
01F0 | 7A E0 3C FC 5F C1 17 39 65 F9 CD F8 C2 93 1B 6E 01F0 | 82 D5 CB 06 E5 D3 17 69 67 04 53 8F 50 42 06 73
0200 | C5 D4 63 51 D7 E7 9D 33 AF BE 6C 58 66 3F 3E AD 0200 | 44 CA D2 22 8D 4B 13 AA 51 10 DD B2 93 62 52 54
0210 | A5 B2 A4 9D F6 CD E1 C9 90 78 61 08 11 65 11 DD 0210 | DB 25 22 ED 64 32 69 26 78 BE D3 EB F9 2F C1 C7
0220 | 9F C6 73 E0 55 9D 84 A5 51 36 C0 01 83 0F E6 2C 0220 | 0B 25 33 BF 6E 04 FB 4C D8 00 F9 B6 78 65 02 C9
0230 | 49 5C 90 39 8E 96 05 49 4E 24 10 7C 02 67 BD A1 0230 | BF 0E FE A8 51 22 04 B7 4A 6E 89 A6 03 24 5B B1
0240 | 29 79 7B 7B 1A CF 86 1C 04 F0 7D 6B BA 8B 11 1F 0240 | 57 8F EA A8 C8 7A F7 3E 6D B6 5F B4 B5 75 D5 65
0250 | 88 86 11 E5 63 1E FF 97 16 C4 06 A7 AE 8B E2 DD 0250 | D1 DD C3 60 EF BF 20 60 87 82 6A 53 75 5B 13 8A
0260 | E1 D8 73 FB 57 1C 82 08 8A BD 18 FE 05 1F 6E 4A 0260 | F9 FC 04 83 E9 7C 32 E1 6B A8 71 03 4D 93 D1 0A
0270 | EE 9B 90 94 C6 3F AC 38 CA 68 B4 EA 46 F1 2C D7 0270 | A0 30 88 F3 8E DD 65 99 00 7F 1F 4F 09 E6 D6 2B
0280 | 09 DF DA C9 44 ED 46 AF 79 2F DB A2</code></pre> 0280 | 6B 14 55 0E 49 B8 1F 28 EB 06 D6 5A</code></pre>
<p>Payload (de)serialization:</p> <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> <pre><code>server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;</code></pre>
<table class="table"> <table class="table">
@ -465,8 +464,8 @@ random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D91
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>0130871EB2AF9C64</code></td> <td><code>0148D7035A969E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a></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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
@ -483,19 +482,19 @@ random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D91
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>encrypted_answer</td> <td>encrypted_answer</td>
<td>56, 596</td> <td>56, 596</td>
<td><code>FE500200073FF0CEBA1A9EF880F885E4</code> <code>D0E9C1EF93F61A18BD1BB78D7A36D3BF</code> <code>1B766E28139102C485BA0D47D383C8E6</code> <code>039DBBD378BAA64DC067F1604396DAA0</code> <code>4D721E110D2308F495A534DE443006DE</code> <code>9176B4B8D927248402E16D69FC8F7348</code> <code>54BAFBF806004E43269CA8C87291D4F8</code> <code>F436843A0CB3FD631FE4D7F41E8FAC2E</code> <code>34EF840BDAC03314248A4AF691ADAB7A</code> <code>0C6BDCCA3D85FD49E49AE6E518AF6DDA</code> <code>95CF034F90EB1B4250CDF603F58121BC</code> <code>3C4889E0C6730C89773A8D77C9FC7AF3</code> <code>05C9F93BD83510FBF1B98ED70849615A</code> <code>D2C9497F9C8A944CB1D3A51AD10144B7</code> <code>777A4A5ED959FFE03B873D4CF010B361</code> <code>C62F7B423EEC02CACE0D280A6E341EA5</code> <code>BDAE28EFBA69D050581056356B7B6F66</code> <code>D9A9514416578842240BED8633381F0C</code> <code>4AB006C54B6029E58EAFA36F872EE7C9</code> <code>5B5DF591C7C2686A3E61489FFB06F910</code> <code>AC03C5F456B9A3C34A5CCACE676E875C</code> <code>F3E76791C4AD88C31F9D6F43EF4E9EF4</code> <code>8E0DBC301EF29D2EB38030705E1A0F25</code> <code>F2007D5412966638DC5114371A63082C</code> <code>81462C3B700EA5356E28923F5087AF05</code> <code>1CFD8159B64B2ADC804E66CB70F6AD25</code> <code>1721C6B8CA2F2168731432C967BC8BAE</code> <code>AD029640E80C2DC27AE03CFC5FC11739</code> <code>65F9CDF8C2931B6EC5D46351D7E79D33</code> <code>AFBE6C58663F3EADA5B2A49DF6CDE1C9</code> <code>90786108116511DD9FC673E0559D84A5</code> <code>5136C001830FE62C495C90398E960549</code> <code>4E24107C0267BDA129797B7B1ACF861C</code> <code>04F07D6BBA8B111F888611E5631EFF97</code> <code>16C406A7AE8BE2DDE1D873FB571C8208</code> <code>8ABD18FE051F6E4AEE9B9094C63FAC38</code> <code>CA68B4EA46F12CD709DFDAC944ED46AF</code><br> <code>792FDBA2</code></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>See below</td> <td>See below</td>
</tr> </tr>
</tbody> </tbody>
@ -503,20 +502,20 @@ random_padding_bytes = 2F9E22AC78033569C4B3F7035D5FFAFC3EBF28ECD70A65926B2E64D91
<!-- end server_DH_params_ok --> <!-- 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> <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 --> <!-- start server_DH_inner_data_input -->
<pre><code>encrypted_answer = 073FF0CEBA1A9EF880F885E4D0E9C1EF93F61A18BD1BB78D7A36D3BF1B766E28139102C485BA0D47D383C8E6039DBBD378BAA64DC067F1604396DAA04D721E110D2308F495A534DE443006DE9176B4B8D927248402E16D69FC8F734854BAFBF806004E43269CA8C87291D4F8F436843A0CB3FD631FE4D7F41E8FAC2E34EF840BDAC03314248A4AF691ADAB7A0C6BDCCA3D85FD49E49AE6E518AF6DDA95CF034F90EB1B4250CDF603F58121BC3C4889E0C6730C89773A8D77C9FC7AF305C9F93BD83510FBF1B98ED70849615AD2C9497F9C8A944CB1D3A51AD10144B7777A4A5ED959FFE03B873D4CF010B361C62F7B423EEC02CACE0D280A6E341EA5BDAE28EFBA69D050581056356B7B6F66D9A9514416578842240BED8633381F0C4AB006C54B6029E58EAFA36F872EE7C95B5DF591C7C2686A3E61489FFB06F910AC03C5F456B9A3C34A5CCACE676E875CF3E76791C4AD88C31F9D6F43EF4E9EF48E0DBC301EF29D2EB38030705E1A0F25F2007D5412966638DC5114371A63082C81462C3B700EA5356E28923F5087AF051CFD8159B64B2ADC804E66CB70F6AD251721C6B8CA2F2168731432C967BC8BAEAD029640E80C2DC27AE03CFC5FC1173965F9CDF8C2931B6EC5D46351D7E79D33AFBE6C58663F3EADA5B2A49DF6CDE1C990786108116511DD9FC673E0559D84A55136C001830FE62C495C90398E9605494E24107C0267BDA129797B7B1ACF861C04F07D6BBA8B111F888611E5631EFF9716C406A7AE8BE2DDE1D873FB571C82088ABD18FE051F6E4AEE9B9094C63FAC38CA68B4EA46F12CD709DFDAC944ED46AF792FDBA2 <pre><code>encrypted_answer = 836AC34EF22234FE19223F02F81BCBF2E1AD74F0B4D3CFB4E50BE312C6B4EA178B8AFC86265DC173AF33248CC28951C2FD8E1A5658E485AFC651CAAC1E2F31F83DF5522D8B1D041AC2CD1D4D02B0C8C3953B74652E6F85A3FEA27DF2B97E466644243D062D558CDE6F96950FF8EA2A3B4D839E58DD730C445B3E7500FFC57E1FA77D12CB9EFF24DC8E6F8BD26460EB32C6BC764544B0BCA0470AFA0E99E6CDDFCBFC3B88F46A30314FA03F517B16FDC660EF62961289C803677EDA9BE59E743CACA4E51355371B94CADCDB1626F89C4F5D5DFBFFDCBD4AD7E7736C9B08AB6EFB725A072F024F48F26411783FAA277387DA62EAEF5DBA72F6805361CD098DC6C551A87B8F707E0E2AF049EAF9504D6CC1A8163E86B9EC77CA94CB925851736B1F01EA46327D2A1B7FC11FB0A953C69D32DB5E6445100C6B0996A677F2AFE1E504EE202887AB15B2D7EF36AE6AB4222F2B5DDDF43A2252D0174B8786966B1DA5A9EC9E4720FD830C70E65E6B27618077358AE2CCD6212EED549112271F0AC5B88319A6C6EACD8B437B1267C8855B1080B985C83D25991CF3EA6D7738F710CED481196B8ED7E333058B2431270EE0AA9017DFD140CF82D5CB06E5D317696704538F5042067344CAD2228D4B13AA5110DDB293625254DB2522ED6432692678BED3EBF92FC1C70B2533BF6E04FB4CD800F9B6786502C9BF0EFEA8512204B74A6E89A603245BB1578FEAA8C87AF73E6DB65FB4B575D565D1DDC360EFBF206087826A53755B138AF9FC0483E97C32E16BA871034D93D10AA03088F38EDD6599007F1F4F09E6D62B6B14550E49B81F28EB06D65A
tmp_aes_key = 3826079A7BBD2CC9B9AE0E9D1BEEDA1A663CE630DC446D259DE256A1C953E8FA tmp_aes_key = 3956EDA6DB9239D3E00942D65FA2782983547D27A037FC9A3875196482457CF5
tmp_aes_iv = 7A6748BA29AAC95EF75BD4588351617832FD34568EF1C4018F04F871FA05D41E</code></pre> tmp_aes_iv = ED25CF95B5053DDCC1F53F4AD1AF7DD0E5A4A21F89ECDFBB2F041BE4EDFD8445</code></pre>
<!-- end server_DH_inner_data_input --> <!-- end server_DH_inner_data_input -->
<p>Yielding:</p> <p>Yielding:</p>
<!-- start server_DH_inner_data_output --> <!-- start server_DH_inner_data_output -->
<pre><code>answer_with_hash = 3C9D681E6DB06E8B9F3D3CA74BC92D7E67D227D0BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474203000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001002FDAB5904B04F687AFF2E819845CF3BE57A147004CFFEF1C5DEA2574EB87C7A1462EAF356CBAD7B11BC1AAF4C64924555834B4E0FECB94118F21958824D8E0EB78FD33BA711806508E1EFA3BDB4520DBD4459CA6BAD3A8CD59874AE8295DBD0B6EC31C2A381406FCFBCA4031EDB433CDCF43551BEDAC54CBF8209542C22BC0D564FC8585945869AF496994DEE5E9B1E59C96020713B4B3AE90ED7DC68FD1DB5B81C2411E7C0E70893BC1A5804563D424AE95A453419AFFEB3B8A8AF7C9995041DDBB3117F105397B250C2FF1F565926000CC06E175B9A7078ABFA6383D0771822291D83BC82DCD16E991B4ACF7F9C17814F6715D3517F4E66401863418F16AABB2AF9C641C1005E08D6EEDB1 <pre><code>answer_with_hash = 70F677AA69190441C67862FB9CD0C689083BC134BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7C03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001001BEA1C03F21CA802A6E62922E4FEF1FAEC50248AF15A2BBA07A97D3D1FCD3EFCE454F5F51CDB120D8F1DAA89548F9AF41D18A6542B28F9153AA7E48122950F5E002E511DF55F81A6340259CA6DDCB1C19B3FEFF37F382AC719B2A535F76FFD41E14A34EBF7DE44DF8F355893EDA79ED914A9B83C31E6075A1E3F29EE7D682D6DE5A3161D05864E4402E2AF00A331ABD9BF5AFB2FB207DD314459E4AD791F4416C98E51F3FDD9F9210CC24CF14D775C60207950642B2E28B1E1FC0F39102EC590AFD76FB070759C6064E9884AE6F30D7969909A7FF99B1DA6E246DD7612194915BAC36F14139C1728546C0325DFF289D1339AF61772FFFD9C16F7D7AB92267AC85A969E64DAD6000E2A59A52B
answer = BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474203000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001002FDAB5904B04F687AFF2E819845CF3BE57A147004CFFEF1C5DEA2574EB87C7A1462EAF356CBAD7B11BC1AAF4C64924555834B4E0FECB94118F21958824D8E0EB78FD33BA711806508E1EFA3BDB4520DBD4459CA6BAD3A8CD59874AE8295DBD0B6EC31C2A381406FCFBCA4031EDB433CDCF43551BEDAC54CBF8209542C22BC0D564FC8585945869AF496994DEE5E9B1E59C96020713B4B3AE90ED7DC68FD1DB5B81C2411E7C0E70893BC1A5804563D424AE95A453419AFFEB3B8A8AF7C9995041DDBB3117F105397B250C2FF1F565926000CC06E175B9A7078ABFA6383D0771822291D83BC82DCD16E991B4ACF7F9C17814F6715D3517F4E66401863418F16AABB2AF9C641C1005E08D6EEDB1</code></pre> answer = BA0D89B53B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7C03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001001BEA1C03F21CA802A6E62922E4FEF1FAEC50248AF15A2BBA07A97D3D1FCD3EFCE454F5F51CDB120D8F1DAA89548F9AF41D18A6542B28F9153AA7E48122950F5E002E511DF55F81A6340259CA6DDCB1C19B3FEFF37F382AC719B2A535F76FFD41E14A34EBF7DE44DF8F355893EDA79ED914A9B83C31E6075A1E3F29EE7D682D6DE5A3161D05864E4402E2AF00A331ABD9BF5AFB2FB207DD314459E4AD791F4416C98E51F3FDD9F9210CC24CF14D775C60207950642B2E28B1E1FC0F39102EC590AFD76FB070759C6064E9884AE6F30D7969909A7FF99B1DA6E246DD7612194915BAC36F14139C1728546C0325DFF289D1339AF61772FFFD9C16F7D7AB92267AC85A969E64DAD6000E2A59A52B</code></pre>
<!-- end server_DH_inner_data_output --> <!-- end server_DH_inner_data_output -->
<!-- start server_DH_inner_data --> <!-- start server_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p> <p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | BA 0D 89 B5 B0 BB 83 C2 68 49 38 B7 6A C4 92 3A <pre><code>0000 | BA 0D 89 B5 3B 6C E1 1B ED C3 46 61 B0 E7 0F 88
0010 | A5 45 C8 F0 59 2E 37 C5 BF 99 B8 DD AE 33 E6 EE 0010 | 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34 91 06 77 B5
0020 | 39 4B 47 42 03 00 00 00 FE 00 01 00 C7 1C AE B9 0020 | 9A 8B DD 7C 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 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 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 0050 | A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E
@ -533,23 +532,23 @@ answer = BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474
0100 | F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6 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 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 0120 | 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B FE 00 01 00
0130 | 2F DA B5 90 4B 04 F6 87 AF F2 E8 19 84 5C F3 BE 0130 | 1B EA 1C 03 F2 1C A8 02 A6 E6 29 22 E4 FE F1 FA
0140 | 57 A1 47 00 4C FF EF 1C 5D EA 25 74 EB 87 C7 A1 0140 | EC 50 24 8A F1 5A 2B BA 07 A9 7D 3D 1F CD 3E FC
0150 | 46 2E AF 35 6C BA D7 B1 1B C1 AA F4 C6 49 24 55 0150 | E4 54 F5 F5 1C DB 12 0D 8F 1D AA 89 54 8F 9A F4
0160 | 58 34 B4 E0 FE CB 94 11 8F 21 95 88 24 D8 E0 EB 0160 | 1D 18 A6 54 2B 28 F9 15 3A A7 E4 81 22 95 0F 5E
0170 | 78 FD 33 BA 71 18 06 50 8E 1E FA 3B DB 45 20 DB 0170 | 00 2E 51 1D F5 5F 81 A6 34 02 59 CA 6D DC B1 C1
0180 | D4 45 9C A6 BA D3 A8 CD 59 87 4A E8 29 5D BD 0B 0180 | 9B 3F EF F3 7F 38 2A C7 19 B2 A5 35 F7 6F FD 41
0190 | 6E C3 1C 2A 38 14 06 FC FB CA 40 31 ED B4 33 CD 0190 | E1 4A 34 EB F7 DE 44 DF 8F 35 58 93 ED A7 9E D9
01A0 | CF 43 55 1B ED AC 54 CB F8 20 95 42 C2 2B C0 D5 01A0 | 14 A9 B8 3C 31 E6 07 5A 1E 3F 29 EE 7D 68 2D 6D
01B0 | 64 FC 85 85 94 58 69 AF 49 69 94 DE E5 E9 B1 E5 01B0 | E5 A3 16 1D 05 86 4E 44 02 E2 AF 00 A3 31 AB D9
01C0 | 9C 96 02 07 13 B4 B3 AE 90 ED 7D C6 8F D1 DB 5B 01C0 | BF 5A FB 2F B2 07 DD 31 44 59 E4 AD 79 1F 44 16
01D0 | 81 C2 41 1E 7C 0E 70 89 3B C1 A5 80 45 63 D4 24 01D0 | C9 8E 51 F3 FD D9 F9 21 0C C2 4C F1 4D 77 5C 60
01E0 | AE 95 A4 53 41 9A FF EB 3B 8A 8A F7 C9 99 50 41 01E0 | 20 79 50 64 2B 2E 28 B1 E1 FC 0F 39 10 2E C5 90
01F0 | DD BB 31 17 F1 05 39 7B 25 0C 2F F1 F5 65 92 60 01F0 | AF D7 6F B0 70 75 9C 60 64 E9 88 4A E6 F3 0D 79
0200 | 00 CC 06 E1 75 B9 A7 07 8A BF A6 38 3D 07 71 82 0200 | 69 90 9A 7F F9 9B 1D A6 E2 46 DD 76 12 19 49 15
0210 | 22 91 D8 3B C8 2D CD 16 E9 91 B4 AC F7 F9 C1 78 0210 | BA C3 6F 14 13 9C 17 28 54 6C 03 25 DF F2 89 D1
0220 | 14 F6 71 5D 35 17 F4 E6 64 01 86 34 18 F1 6A AB 0220 | 33 9A F6 17 72 FF FD 9C 16 F7 D7 AB 92 26 7A C8
0230 | B2 AF 9C 64</code></pre> 0230 | 5A 96 9E 64</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -571,13 +570,13 @@ answer = BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>4, 16</td> <td>4, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>20, 16</td> <td>20, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
@ -595,13 +594,13 @@ answer = BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474
<tr> <tr>
<td>g_a</td> <td>g_a</td>
<td>300, 260</td> <td>300, 260</td>
<td><code>FE0001002FDAB5904B04F687AFF2E819</code> <code>845CF3BE57A147004CFFEF1C5DEA2574</code> <code>EB87C7A1462EAF356CBAD7B11BC1AAF4</code> <code>C64924555834B4E0FECB94118F219588</code> <code>24D8E0EB78FD33BA711806508E1EFA3B</code> <code>DB4520DBD4459CA6BAD3A8CD59874AE8</code> <code>295DBD0B6EC31C2A381406FCFBCA4031</code> <code>EDB433CDCF43551BEDAC54CBF8209542</code> <code>C22BC0D564FC8585945869AF496994DE</code> <code>E5E9B1E59C96020713B4B3AE90ED7DC6</code> <code>8FD1DB5B81C2411E7C0E70893BC1A580</code> <code>4563D424AE95A453419AFFEB3B8A8AF7</code> <code>C9995041DDBB3117F105397B250C2FF1</code> <code>F565926000CC06E175B9A7078ABFA638</code> <code>3D0771822291D83BC82DCD16E991B4AC</code> <code>F7F9C17814F6715D3517F4E664018634</code><br> <code>18F16AAB</code></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>g_a</code> diffie-hellman parameter</td> <td><code>g_a</code> diffie-hellman parameter</td>
</tr> </tr>
<tr> <tr>
<td>server_time</td> <td>server_time</td>
<td>560, 4</td> <td>560, 4</td>
<td><code>B2AF9C64</code> (1687990194 in decimal)</td> <td><code>5A969E64</code> (1688114778 in decimal)</td>
<td>Server time</td> <td>Server time</td>
</tr> </tr>
</tbody> </tbody>
@ -610,34 +609,34 @@ answer = BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474
<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> <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> <p>First, generate a secure random 2048-bit number b:</p>
<!-- start b --> <!-- start b -->
<pre><code>b = 29F2FD3102D844146B82E7C115C554A80961BC260BCA739BB670787AF0A72A512BA2E47AD58D0C478415251E4D0F7A737C2BF06A364C6E995ED596C88F4685F412B60205ECB9FA3ECA18A5B7B2DBEF3F26614806067E2F5831BB9CFF38278A25BB79A8F081A9E72E92CF74DE524DFBC07B6F5F77DF5F1EFF385E0B943282DF43A220AF62387F662982CCEDB59302EAD733438089FE871856F3C6E9221198094EA76E20868AEC4A7D7C809223CB28627DF3A05961B5148BE043CC64ECA1BFCC427F476E8A6769CDD7F5B774311BC166DB8FEC80E7C2BB9DF3B391D5D441B6BB35F0828BB9A22C9151FC63F1F3C04517C127A0BB98A2850867D7074E8D0C2FC576</code></pre> <pre><code>b = 744E93CF8FA7E1510D1FE832C1DCE2AF7B343B0D786CA507D1F34DBABF922AFFB3D0635EDE27ADF1F2B2A5471CC087A69665BB834C98D4CAEC542892AB02A4087734B6F3AE36A78FCF38A78659F15DBE4C416963955486C656A9AFD8AE81A3357B2FA6BEEB37A561356C5188D593D941A711C06A836ECBF684BF37437F033010432227DB935FDF2CA0B0BF0B644DEB64394D1BFB6A5DCAC8E117DB36E46B8EE8C5FE300276997EFA0B5BDA54C6C9F5F7D45B38E93A0FB2F33A2A929252D47BCB71CF0423DEA4E122F63551C3198C07BA84F95C36104761EF23D294F226FDA75AB3321C2F3A2071F52056688B9295C09EBF751E4CC2022BCD2E79BB716B23203D</code></pre>
<!-- end b --> <!-- end b -->
<p>Then compute <code>g_b = pow(g, b) mod dh_prime</code></p> <p>Then compute <code>g_b = pow(g, b) mod dh_prime</code></p>
<!-- start g_b --> <!-- start g_b -->
<pre><code>g_b = 69A19DF1CA7E2F7EB2D1C4FB9BA2856EF2AA19510669FF991757F7A3A10AA176A81CBD993DC7BD794C4E169056601BABFFE5C1A8DC6BCB705BB24BDB5E17280D26DAF0A9A801558CB87A11E30D6E8DD29CC039D014EA819CD0F8148CBA1BDB21331FFCB6063ED8FB66A6E90A02A80B68CDE53CB45D1266E8C19617FDD5AFD824001FD16BF666A1946B54B45C751CDD535B3718C6BE7A2EBAD4B35F5CA61D128B5B10ED4223C08D7294FCE18C8D30B5CFC8D73A80469150F7180F5F76F4FEAA0156EFA7665BB37F87B5F9EEAA654550555C05F91342608BB76F1E394EA6C51CE64589540E8729F9F5AE1B33108E8D35233ABFEE824AA2B940C5F04335CA59E0C4</code></pre> <pre><code>g_b = 55F3A678CBBC2D12C34DC41345387B1162E949DCA78F1D7DC02167AB9B983CAC956AE49E50FA0655C45CB7FD439238E6FAB3F4186794602FE44BE4194912B32536619A017A4DFE50D9893FF9C511B5DA8AE5A7598DDFD82BA0122DA7937E22BCE1F3F3C0CE51E6EBEA24FDA496C7365B0CFBC16671E06A10CB45A0749F520401C278E7F8A162BBDDF6973642A5E49E515962328297012984B36EF4D2D35C28C20CB25928B3F3D46BA6FC6FEE832F71F16347744F75085AA22F3677717D8F643F5AF88C394F87B149144CDA035977A08443679DC97E17642AF1C0519095686642E158A0F0D9CFAFE461ACABB41A72A76AE8FC5F39EDAF53DE68DEBE8EDEDFAB9B</code></pre>
<!-- end g_b --> <!-- end g_b -->
<h6>7.1) generation of encrypted_data</h6> <h6>7.1) generation of encrypted_data</h6>
<!-- start client_DH_inner_data --> <!-- start client_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p> <p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 54 B6 43 66 B0 BB 83 C2 68 49 38 B7 6A C4 92 3A <pre><code>0000 | 54 B6 43 66 3B 6C E1 1B ED C3 46 61 B0 E7 0F 88
0010 | A5 45 C8 F0 59 2E 37 C5 BF 99 B8 DD AE 33 E6 EE 0010 | 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34 91 06 77 B5
0020 | 39 4B 47 42 00 00 00 00 00 00 00 00 FE 00 01 00 0020 | 9A 8B DD 7C 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | 69 A1 9D F1 CA 7E 2F 7E B2 D1 C4 FB 9B A2 85 6E 0030 | 55 F3 A6 78 CB BC 2D 12 C3 4D C4 13 45 38 7B 11
0040 | F2 AA 19 51 06 69 FF 99 17 57 F7 A3 A1 0A A1 76 0040 | 62 E9 49 DC A7 8F 1D 7D C0 21 67 AB 9B 98 3C AC
0050 | A8 1C BD 99 3D C7 BD 79 4C 4E 16 90 56 60 1B AB 0050 | 95 6A E4 9E 50 FA 06 55 C4 5C B7 FD 43 92 38 E6
0060 | FF E5 C1 A8 DC 6B CB 70 5B B2 4B DB 5E 17 28 0D 0060 | FA B3 F4 18 67 94 60 2F E4 4B E4 19 49 12 B3 25
0070 | 26 DA F0 A9 A8 01 55 8C B8 7A 11 E3 0D 6E 8D D2 0070 | 36 61 9A 01 7A 4D FE 50 D9 89 3F F9 C5 11 B5 DA
0080 | 9C C0 39 D0 14 EA 81 9C D0 F8 14 8C BA 1B DB 21 0080 | 8A E5 A7 59 8D DF D8 2B A0 12 2D A7 93 7E 22 BC
0090 | 33 1F FC B6 06 3E D8 FB 66 A6 E9 0A 02 A8 0B 68 0090 | E1 F3 F3 C0 CE 51 E6 EB EA 24 FD A4 96 C7 36 5B
00A0 | CD E5 3C B4 5D 12 66 E8 C1 96 17 FD D5 AF D8 24 00A0 | 0C FB C1 66 71 E0 6A 10 CB 45 A0 74 9F 52 04 01
00B0 | 00 1F D1 6B F6 66 A1 94 6B 54 B4 5C 75 1C DD 53 00B0 | C2 78 E7 F8 A1 62 BB DD F6 97 36 42 A5 E4 9E 51
00C0 | 5B 37 18 C6 BE 7A 2E BA D4 B3 5F 5C A6 1D 12 8B 00C0 | 59 62 32 82 97 01 29 84 B3 6E F4 D2 D3 5C 28 C2
00D0 | 5B 10 ED 42 23 C0 8D 72 94 FC E1 8C 8D 30 B5 CF 00D0 | 0C B2 59 28 B3 F3 D4 6B A6 FC 6F EE 83 2F 71 F1
00E0 | C8 D7 3A 80 46 91 50 F7 18 0F 5F 76 F4 FE AA 01 00E0 | 63 47 74 4F 75 08 5A A2 2F 36 77 71 7D 8F 64 3F
00F0 | 56 EF A7 66 5B B3 7F 87 B5 F9 EE AA 65 45 50 55 00F0 | 5A F8 8C 39 4F 87 B1 49 14 4C DA 03 59 77 A0 84
0100 | 5C 05 F9 13 42 60 8B B7 6F 1E 39 4E A6 C5 1C E6 0100 | 43 67 9D C9 7E 17 64 2A F1 C0 51 90 95 68 66 42
0110 | 45 89 54 0E 87 29 F9 F5 AE 1B 33 10 8E 8D 35 23 0110 | E1 58 A0 F0 D9 CF AF E4 61 AC AB B4 1A 72 A7 6A
0120 | 3A BF EE 82 4A A2 B9 40 C5 F0 43 35 CA 59 E0 C4</code></pre> 0120 | E8 FC 5F 39 ED AF 53 DE 68 DE BE 8E DE DF AB 9B</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -659,19 +658,19 @@ answer = BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>4, 16</td> <td>4, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>20, 16</td> <td>20, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>g_b</td> <td>g_b</td>
<td>36, 260</td> <td>36, 260</td>
<td><code>FE00010069A19DF1CA7E2F7EB2D1C4FB</code> <code>9BA2856EF2AA19510669FF991757F7A3</code> <code>A10AA176A81CBD993DC7BD794C4E1690</code> <code>56601BABFFE5C1A8DC6BCB705BB24BDB</code> <code>5E17280D26DAF0A9A801558CB87A11E3</code> <code>0D6E8DD29CC039D014EA819CD0F8148C</code> <code>BA1BDB21331FFCB6063ED8FB66A6E90A</code> <code>02A80B68CDE53CB45D1266E8C19617FD</code> <code>D5AFD824001FD16BF666A1946B54B45C</code> <code>751CDD535B3718C6BE7A2EBAD4B35F5C</code> <code>A61D128B5B10ED4223C08D7294FCE18C</code> <code>8D30B5CFC8D73A80469150F7180F5F76</code> <code>F4FEAA0156EFA7665BB37F87B5F9EEAA</code> <code>654550555C05F91342608BB76F1E394E</code> <code>A6C51CE64589540E8729F9F5AE1B3310</code> <code>8E8D35233ABFEE824AA2B940C5F04335</code><br> <code>CA59E0C4</code></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>Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding</td> <td>Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding</td>
</tr> </tr>
<tr> <tr>
@ -685,47 +684,47 @@ answer = BA0D89B5B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B474
<!-- end client_DH_inner_data --> <!-- 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> <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 --> <!-- start client_DH_inner_data_input -->
<pre><code>data = 54B64366B0BB83C2684938B76AC4923AA545C8F0592E37C5BF99B8DDAE33E6EE394B47420000000000000000FE00010069A19DF1CA7E2F7EB2D1C4FB9BA2856EF2AA19510669FF991757F7A3A10AA176A81CBD993DC7BD794C4E169056601BABFFE5C1A8DC6BCB705BB24BDB5E17280D26DAF0A9A801558CB87A11E30D6E8DD29CC039D014EA819CD0F8148CBA1BDB21331FFCB6063ED8FB66A6E90A02A80B68CDE53CB45D1266E8C19617FDD5AFD824001FD16BF666A1946B54B45C751CDD535B3718C6BE7A2EBAD4B35F5CA61D128B5B10ED4223C08D7294FCE18C8D30B5CFC8D73A80469150F7180F5F76F4FEAA0156EFA7665BB37F87B5F9EEAA654550555C05F91342608BB76F1E394EA6C51CE64589540E8729F9F5AE1B33108E8D35233ABFEE824AA2B940C5F04335CA59E0C4 <pre><code>data = 54B643663B6CE11BEDC34661B0E70F8833910C6F78D0022E8C91C634910677B59A8BDD7C0000000000000000FE00010055F3A678CBBC2D12C34DC41345387B1162E949DCA78F1D7DC02167AB9B983CAC956AE49E50FA0655C45CB7FD439238E6FAB3F4186794602FE44BE4194912B32536619A017A4DFE50D9893FF9C511B5DA8AE5A7598DDFD82BA0122DA7937E22BCE1F3F3C0CE51E6EBEA24FDA496C7365B0CFBC16671E06A10CB45A0749F520401C278E7F8A162BBDDF6973642A5E49E515962328297012984B36EF4D2D35C28C20CB25928B3F3D46BA6FC6FEE832F71F16347744F75085AA22F3677717D8F643F5AF88C394F87B149144CDA035977A08443679DC97E17642AF1C0519095686642E158A0F0D9CFAFE461ACABB41A72A76AE8FC5F39EDAF53DE68DEBE8EDEDFAB9B
padding = 4670CB59FFB7033A86C62AA9 padding = 85AA2A17BC9D581BA4E758F7
tmp_aes_key = 3826079A7BBD2CC9B9AE0E9D1BEEDA1A663CE630DC446D259DE256A1C953E8FA tmp_aes_key = 3956EDA6DB9239D3E00942D65FA2782983547D27A037FC9A3875196482457CF5
tmp_aes_iv = 7A6748BA29AAC95EF75BD4588351617832FD34568EF1C4018F04F871FA05D41E</code></pre> tmp_aes_iv = ED25CF95B5053DDCC1F53F4AD1AF7DD0E5A4A21F89ECDFBB2F041BE4EDFD8445</code></pre>
<!-- end client_DH_inner_data_input --> <!-- end client_DH_inner_data_input -->
<p>Process:</p> <p>Process:</p>
<pre><code>data_with_hash := SHA1(data) + data + padding (0-15 random bytes such that total length is divisible by 16) <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> encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);</code></pre>
<p>Output:</p> <p>Output:</p>
<!-- start client_DH_inner_data_output --> <!-- start client_DH_inner_data_output -->
<pre><code>encrypted_data = B157BF3596956D48DF20A9E10AB507971128D20530E7E3B6087FB1BA74DBE774DE8C5A1AC9D01F70868ED3681FC694F30CE358FC74B854DB48143196F4555CB22721DB87E83D14286CBFB54F4C18F51C9EB719C5924B4E546D6B073C68BA93198FB7A91FB4538E88F6DA2DCCF3734F7EA0112595DEDD6E69C38A5F70E1507069C26E847FB39EEF4BE96863A898FB521117DA5289CAD8F26F3D912D3314A3D4E54D81202AB36ED3625704730BCB495D3464433CB2CC51D1A355AD788C04084CFF69AEAA9AC6282785192BE1C7C1E4AC14E91358056E1A4BC2B0D5E9840F19F70257AD7975DAC3338C5B393835296E51D4845C07962A58F88EE2E2E67C46B1F44CBCA4624D6BD8CC3BA6B59B635CAFF706893E6368404F0475975F652D4C7C69C4E8FA88A9023BB89895823132B3408C0326A4FE9EE68ADEBC56768F0329C9DB79108F080FCEE326135F10E4F89E4C9EF5</code></pre> <pre><code>encrypted_data = C65BD12A8AD2A14AC0343F20F6BF3844DD8D81A18975F0827FEE29DD0CB97F7F1531D3EF781A9777F799EAD72CDBB84BEABCEBEC4C8232D51773493C6C4DB77A39B0BCD4AFED22FCEA12957BDF0FE5880FB8D6C38B12FE1C3F39694D12BFA0A3E124ACA9547F44678F5388561196085DE31F6AD05F30C87B213F0A2CC366DD73126FE3668FA448F84E5C1A2BCE76BE5B4B66001C69E6C124FA731FCF653F92A584DFAECCF247BD41AE10F3633999B0BA842BFFEC4B669BB01645167168DABE5C9EBEEA1B0ED94DAED0C7BA6CE6513A1F6292E9D9B85D8328C2A4D8BA3A43DCE484F2B5BB26FDD3337CA81D835A830EF56F623060DE68F93E21BBA5E893A2C352DA2DD697A6B562DDD677AB92FD748445509CDCCF5954D99D934BD7AC2730A36F096C0E8E57CA39C36EE8EDFDCED80B20C558B75A117944E57E0D89F333E2169ED6CA00C73886CD68CC7B116E2BE156E6</code></pre>
<!-- end client_DH_inner_data_output --> <!-- end client_DH_inner_data_output -->
<p>The length of the final string is 336 bytes.</p> <p>The length of the final string is 336 bytes.</p>
<h6>7.2) set_client_DH_params query</h6> <h6>7.2) set_client_DH_params query</h6>
<!-- start set_client_DH_params --> <!-- start set_client_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p> <p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 BC D6 09 00 B2 AF 9C 64 <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 B0 BB 83 C2 68 49 38 B7 0010 | 78 01 00 00 1F 5F 04 F5 3B 6C E1 1B ED C3 46 61
0020 | 6A C4 92 3A A5 45 C8 F0 59 2E 37 C5 BF 99 B8 DD 0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | AE 33 E6 EE 39 4B 47 42 FE 50 01 00 B1 57 BF 35 0030 | 91 06 77 B5 9A 8B DD 7C FE 50 01 00 C6 5B D1 2A
0040 | 96 95 6D 48 DF 20 A9 E1 0A B5 07 97 11 28 D2 05 0040 | 8A D2 A1 4A C0 34 3F 20 F6 BF 38 44 DD 8D 81 A1
0050 | 30 E7 E3 B6 08 7F B1 BA 74 DB E7 74 DE 8C 5A 1A 0050 | 89 75 F0 82 7F EE 29 DD 0C B9 7F 7F 15 31 D3 EF
0060 | C9 D0 1F 70 86 8E D3 68 1F C6 94 F3 0C E3 58 FC 0060 | 78 1A 97 77 F7 99 EA D7 2C DB B8 4B EA BC EB EC
0070 | 74 B8 54 DB 48 14 31 96 F4 55 5C B2 27 21 DB 87 0070 | 4C 82 32 D5 17 73 49 3C 6C 4D B7 7A 39 B0 BC D4
0080 | E8 3D 14 28 6C BF B5 4F 4C 18 F5 1C 9E B7 19 C5 0080 | AF ED 22 FC EA 12 95 7B DF 0F E5 88 0F B8 D6 C3
0090 | 92 4B 4E 54 6D 6B 07 3C 68 BA 93 19 8F B7 A9 1F 0090 | 8B 12 FE 1C 3F 39 69 4D 12 BF A0 A3 E1 24 AC A9
00A0 | B4 53 8E 88 F6 DA 2D CC F3 73 4F 7E A0 11 25 95 00A0 | 54 7F 44 67 8F 53 88 56 11 96 08 5D E3 1F 6A D0
00B0 | DE DD 6E 69 C3 8A 5F 70 E1 50 70 69 C2 6E 84 7F 00B0 | 5F 30 C8 7B 21 3F 0A 2C C3 66 DD 73 12 6F E3 66
00C0 | B3 9E EF 4B E9 68 63 A8 98 FB 52 11 17 DA 52 89 00C0 | 8F A4 48 F8 4E 5C 1A 2B CE 76 BE 5B 4B 66 00 1C
00D0 | CA D8 F2 6F 3D 91 2D 33 14 A3 D4 E5 4D 81 20 2A 00D0 | 69 E6 C1 24 FA 73 1F CF 65 3F 92 A5 84 DF AE CC
00E0 | B3 6E D3 62 57 04 73 0B CB 49 5D 34 64 43 3C B2 00E0 | F2 47 BD 41 AE 10 F3 63 39 99 B0 BA 84 2B FF EC
00F0 | CC 51 D1 A3 55 AD 78 8C 04 08 4C FF 69 AE AA 9A 00F0 | 4B 66 9B B0 16 45 16 71 68 DA BE 5C 9E BE EA 1B
0100 | C6 28 27 85 19 2B E1 C7 C1 E4 AC 14 E9 13 58 05 0100 | 0E D9 4D AE D0 C7 BA 6C E6 51 3A 1F 62 92 E9 D9
0110 | 6E 1A 4B C2 B0 D5 E9 84 0F 19 F7 02 57 AD 79 75 0110 | B8 5D 83 28 C2 A4 D8 BA 3A 43 DC E4 84 F2 B5 BB
0120 | DA C3 33 8C 5B 39 38 35 29 6E 51 D4 84 5C 07 96 0120 | 26 FD D3 33 7C A8 1D 83 5A 83 0E F5 6F 62 30 60
0130 | 2A 58 F8 8E E2 E2 E6 7C 46 B1 F4 4C BC A4 62 4D 0130 | DE 68 F9 3E 21 BB A5 E8 93 A2 C3 52 DA 2D D6 97
0140 | 6B D8 CC 3B A6 B5 9B 63 5C AF F7 06 89 3E 63 68 0140 | A6 B5 62 DD D6 77 AB 92 FD 74 84 45 50 9C DC CF
0150 | 40 4F 04 75 97 5F 65 2D 4C 7C 69 C4 E8 FA 88 A9 0150 | 59 54 D9 9D 93 4B D7 AC 27 30 A3 6F 09 6C 0E 8E
0160 | 02 3B B8 98 95 82 31 32 B3 40 8C 03 26 A4 FE 9E 0160 | 57 CA 39 C3 6E E8 ED FD CE D8 0B 20 C5 58 B7 5A
0170 | E6 8A DE BC 56 76 8F 03 29 C9 DB 79 10 8F 08 0F 0170 | 11 79 44 E5 7E 0D 89 F3 33 E2 16 9E D6 CA 00 C7
0180 | CE E3 26 13 5F 10 E4 F8 9E 4C 9E F5</code></pre> 0180 | 38 86 CD 68 CC 7B 11 6E 2B E1 56 E6</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -747,8 +746,8 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>BCD60900B2AF9C64</code></td> <td><code>1C4704005A969E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a></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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
@ -765,19 +764,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>encrypted_data</td> <td>encrypted_data</td>
<td>56, 340</td> <td>56, 340</td>
<td><code>FE500100B157BF3596956D48DF20A9E1</code> <code>0AB507971128D20530E7E3B6087FB1BA</code> <code>74DBE774DE8C5A1AC9D01F70868ED368</code> <code>1FC694F30CE358FC74B854DB48143196</code> <code>F4555CB22721DB87E83D14286CBFB54F</code> <code>4C18F51C9EB719C5924B4E546D6B073C</code> <code>68BA93198FB7A91FB4538E88F6DA2DCC</code> <code>F3734F7EA0112595DEDD6E69C38A5F70</code> <code>E1507069C26E847FB39EEF4BE96863A8</code> <code>98FB521117DA5289CAD8F26F3D912D33</code> <code>14A3D4E54D81202AB36ED3625704730B</code> <code>CB495D3464433CB2CC51D1A355AD788C</code> <code>04084CFF69AEAA9AC6282785192BE1C7</code> <code>C1E4AC14E91358056E1A4BC2B0D5E984</code> <code>0F19F70257AD7975DAC3338C5B393835</code> <code>296E51D4845C07962A58F88EE2E2E67C</code> <code>46B1F44CBCA4624D6BD8CC3BA6B59B63</code> <code>5CAFF706893E6368404F0475975F652D</code> <code>4C7C69C4E8FA88A9023BB89895823132</code> <code>B3408C0326A4FE9EE68ADEBC56768F03</code> <code>29C9DB79108F080FCEE326135F10E4F8</code><br> <code>9E4C9EF5</code></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>Encrypted client_DH_inner_data generated previously, serialized as a TL byte string</td> <td>Encrypted client_DH_inner_data generated previously, serialized as a TL byte string</td>
</tr> </tr>
</tbody> </tbody>
@ -786,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> <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> <p>The client computes the auth_key using formula <code>g_a^b mod dh_prime</code>:</p>
<!-- start auth_key --> <!-- start auth_key -->
<pre><code>auth_key = 4B2FB207D87D159C14CFBC094533E4305721FD3F8CF1F4C2E218481DAD5BDE4BD687064C86A2F9B15DDF2EB43F6558C7EF91B99FADF614711AEDC6BBAE02F10B97EC40B81837695E58F11F2FAC48E949AF2DBC35E3A8476FF2C8C1CA85835634BEA918657C9801AD8876E8319C02ADF9209EAF5A3D429560D98816943C3019971B67372E146106CD27FB110A589DA8890F43348AF77143AFFCB08BEBEF89BD14BBFECC6AFE2B028C4BEC26ADC3D6786DABFF738CDAEBFE2D15806977DB496736716CD0B64938F1AEC6911FB56B70CC86BFB458048E970CD28E2F3844B7082493C1D46C0EA0AA798068C4160DA2C2D7562A6160255C6A1D7C3C47B7B8DD1C6D55</code></pre> <pre><code>auth_key = 3527D417E01D4F221CECB78C9B5C29936C3CECC218DF73F86FECBAE6641A78998805CDF21B48558B6B5E51B6F4C639C6007CA58453CFEF33DD6CB6E2FF7FB6DDC9FE801BEC559EBD969B16FD49F6F808B18F8391DD336FB7D2E46D868444EE22B4805E1FDCA0EA115B81B3C23B138503DA4DC02EF639240BB60EB4A897A8A325090E221F4D60B37704D7ED709ABD6AC2C78FF6973B79A5196E8EC6F2814E5BD1A99F716085B03769044F38A8A6683EF8E772C6864C72D01A3EBD83F23C2372AC59CDD9260E104FFF8540A8EE5680BF2885FB385D8F6D759C9C66B355F84EB18CB00C4ADDBB7899AE5A3452C559862C3FC7C1171F5701A4D748830FA90C25F334</code></pre>
<!-- end auth_key --> <!-- 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> <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> <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 --> <!-- start dh_gen_ok -->
<p>Received payload (excluding transport headers/trailers):</p> <p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 60 9B 67 B2 AF 9C 64 <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 B0 BB 83 C2 68 49 38 B7 0010 | 34 00 00 00 34 F7 CB 3B 3B 6C E1 1B ED C3 46 61
0020 | 6A C4 92 3A A5 45 C8 F0 59 2E 37 C5 BF 99 B8 DD 0020 | B0 E7 0F 88 33 91 0C 6F 78 D0 02 2E 8C 91 C6 34
0030 | AE 33 E6 EE 39 4B 47 42 6A F1 5D D5 EA 4A 58 6A 0030 | 91 06 77 B5 9A 8B DD 7C 09 8D 03 93 43 E0 FD 46
0040 | 27 E0 A1 DC 7E 26 D2 C4</code></pre> 0040 | 06 5E 7C 90 20 D7 9F 17</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -818,8 +817,8 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>01609B67B2AF9C64</code></td> <td><code>0198C94C5A969E64</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a></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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
@ -836,19 +835,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>B0BB83C2684938B76AC4923AA545C8F0</code></td> <td><code>3B6CE11BEDC34661B0E70F8833910C6F</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>592E37C5BF99B8DDAE33E6EE394B4742</code></td> <td><code>78D0022E8C91C634910677B59A8BDD7C</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>new_nonce_hash1</td> <td>new_nonce_hash1</td>
<td>56, 16</td> <td>56, 16</td>
<td><code>6AF15DD5EA4A586A27E0A1DC7E26D2C4</code></td> <td><code>098D039343E0FD46065E7C9020D79F17</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> <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> </tr>
</tbody> </tbody>
@ -920,8 +919,11 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
</div> </div>
</div> </div>
<script src="/js/main.js?47"></script> <script src="/js/main.js?47"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>backToTopInit("Go up"); <script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit(); removePreloadInit();
</script> </script>
</body> </body>