Developer documentation

Telegram secret chats, rekeying and message order

Understand secret-chat boundaries, sequence checks and rekeying without mistaking HTTPS or ordinary bot chats for end-to-end encryption.

GetTGAPI editorial teamUpdated
Documentation notesReviewed

Based on official sources and independently maintained by GetTGAPI. Documentation and glossary →

On this page
  1. Identify the encryption endpoints
  2. Ordering is a security property
  3. Rekeying is a coordinated exchange
  4. Integration recommendations

Identify the encryption endpoints

Secret chats have a dedicated end-to-end protocol and TL schema. Cloud chats, bot conversations, HTTPS and secret chats are different security models. Database encryption does not replace protocol key-management requirements.

Ordering is a security property

Secret-chat sequence numbers detect replay, reordering and omissions, including service messages. Parity checks, gap recovery and deletion rules matter. Do not ignore invalid sequence state merely to display a message.

Rekeying is a coordinated exchange

The PFS specification defines exchange, acceptance, commitment and retirement of old keys. Do not begin a competing exchange while one remains incomplete. Correct key destruction and user-facing security verification are also necessary.

Integration recommendations

Prefer maintained implementations and review the official security checks individually. This guide is not a cryptographic implementation specification. Assess transport, storage encryption, device keys and backup recovery separately. Use isolated tests for malformed sequences instead of weakening production checks.