mirror of
https://github.com/danog/MadelineProtoDocs.git
synced 2024-12-02 09:38:28 +01:00
44 lines
1.5 KiB
Markdown
44 lines
1.5 KiB
Markdown
|
---
|
||
|
title: "messages.requestEncryption"
|
||
|
description: "You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats"
|
||
|
grand_parent: "Telegram RPC API"
|
||
|
parent: "Methods"
|
||
|
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
||
|
redirect_from: /API_docs/methods/messages_requestEncryption.html
|
||
|
---
|
||
|
# Method: messages.requestEncryption
|
||
|
[Back to methods index](index.html)
|
||
|
|
||
|
|
||
|
|
||
|
You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats
|
||
|
|
||
|
### Parameters:
|
||
|
|
||
|
| Name | Type | Description | Required |
|
||
|
|----------|---------------|-------------|----------|
|
||
|
|user\_id|[Username, chat ID, Update, Message or InputUser](/API_docs/types/InputUser.html) | User ID | Optional|
|
||
|
|g\_a|[bytes](/API_docs/types/bytes.html) | `A = g ^ a mod p`, see [Wikipedia](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) | Yes|
|
||
|
|
||
|
|
||
|
### Return type: [EncryptedChat](/API_docs/types/EncryptedChat.html)
|
||
|
|
||
|
### Can bots use this method: **NO**
|
||
|
|
||
|
|
||
|
### MadelineProto Example ([now async for huge speed and parallelism!](https://docs.madelineproto.xyz/docs/ASYNC.html)):
|
||
|
|
||
|
|
||
|
```php
|
||
|
if (!file_exists('madeline.php')) {
|
||
|
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
|
||
|
}
|
||
|
include 'madeline.php';
|
||
|
|
||
|
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
|
||
|
$MadelineProto->start();
|
||
|
|
||
|
$EncryptedChat = $MadelineProto->messages->requestEncryption(user_id: $InputUser, g_a: 'bytes', );
|
||
|
```
|
||
|
|