Skip to content

miniproto.media.cdn

Telegram CDN retrieval, AES-CTR decryption, and FileHash-bounded integrity checks.

The module accepts and returns ordinary immutable bytes. Ciphertext, plaintext, redirect keys, IVs, and temporary counter buffers are not explicitly zeroized; callers that require memory sanitization must manage their own process and buffer-lifetime boundary.

  • CDN_HASH_BLOCK_SIZE — Public attribute miniproto.media.cdn.CDN_HASH_BLOCK_SIZE.
  • CdnError — Raised when a CDN response cannot be reuploaded, decrypted, or interpreted.
  • CdnIntegrityError — Raised when a CDN range lacks valid FileHash coverage or verification fails.
  • CdnRedirect — Validated information supplied by Telegram when a file moves to its CDN.
  • get_cdn_file_part — Fetch, decrypt, and hash-verify one CDN file range.
  • verify_cdn_part — Verify a decrypted CDN chunk against Telegram’s 128 KiB SHA-256 file hashes.
  • cdn_redirect_from_raw — Convert a raw CDN redirect response to stable transfer metadata.
  • decrypt_cdn_chunk — Decrypt a CDN ciphertext range with the counter aligned to its file offset.