request_encryption()

async Client.request_encryption()

Request an end-to-end encrypted chat (secret chat) with a user.

Usable by Users Bots
Parameters:
  • user_id (int | str) – The user to open a secret chat with.

  • random_id (int) – Random ID for the request.

  • g_a (bytes) – The Diffie-Hellman public key.

Returns:

EncryptedChat – The encrypted chat object.

Example

chat = await app.request_encryption(user_id, random_id=123, g_a=b"...")