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.