Urgent.News

What's breaking now, across thousands of outlets.

Tech

GoyGram — one Python runtime for both Telegram Bot API and MTProto, with a Rust core and OpSec-first sessions

GoyGram is a Telegram framework for Python. It runs both of Telegram's protocols — Bot API and MTProto — in a single asyncio runtime, and moves crypto and TL serialization into a compiled Rust extension. The dual-transport problem aiogram and python-telegram-bot are Bot API only. telethon and pyrogram are MTProto only. GoyGram runs both in one process, one loop, one dispatcher — the transport is…

GoyGram is a Python framework for Telegram that supports both the Bot API and MTProto protocols within a single asyncio runtime. It incorporates cryptographic functions and TL serialization into a compiled Rust extension. This innovative approach differentiates GoyGram from other popular libraries like aiogram and python-telegram-bot, which focus exclusively on the Bot API, and telethon and pyrogram, which are limited to MTProto.

The framework operates within a single process, utilizing one loop and one dispatcher. It intelligently selects the appropriate transport for each operation, ensuring seamless communication between the two protocols. The Rust core, employing AES-256-IGE and AES-256-GCM, operates with high performance - as demonstrated by benchmarks on a virtual private server running Python 3.11.

Cold import takes just 87 milliseconds, while RSS after import is a modest 12 MB, in stark contrast to other libraries that can consume 152 MB or more.

Performance is further enhanced by GoyGram's AES-256-IGE encryption, which achieves an impressive 113 MB per second, more than ten times faster than the default implementation in telethon. The framework also employs zero-overhead dynamic dispatch, resolving methods from the TL schema at load time, and reading raw fields lazily, thereby minimizing memory usage.

One of GoyGram's standout features is its commitment to operational security (OpSec). Sessions are stored securely in an AES-256-GCM vault, keyed to the machine's ID. Upon logout, keys are securely erased from memory, and login is restricted to terminal-only methods, such as QR codes, phone numbers, or two-factor authentication - ensuring that no tokens ever leave the device. The framework also supports multi-session capabilities, filters, finite-state machine state machines, transport routing, and an event pipeline.

For those interested in exploring GoyGram, the project is hosted on GitHub (https://github.com/GoyGram/GoyGram) and the documentation can be found at (https://goygram.github.io). Licensed under AGPL-3.0, GoyGram offers a robust and secure solution for developers looking to leverage Telegram's capabilities in their Python applications.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

About Best in IT: Practical AI, Automation and Developer Tools

Welcome to Best in IT. I’m Artur Poniedziałek — an IT project manager and technology enthusiast who enjoys turning promising tools into practical, repeatable solutions.

  • Artur Poniedziałek writes Best in IT to bridge tech advancements and real-world applicability.
  • Focuses on local AI models, private AI assistants, and developer tools.
  • Highlights benefits and challenges of running AI models locally.

bumpwarden: a dependency-triage agent that never merges

Every neglected repository has the same pile: seven Dependabot pull requests, each one a question nobody has time to answer. Which of these breaks the build? That question is the actual work.

  • Bumpwarden automates triaging of Dependabot pull requests
  • Agent scores bumps 0-100 based on semver, advisories, and more
  • Never merges, generates PRs, issues, or hold issues instead

I Freaking Love Breaking My Own Software

Validation testing is one of my favorite parts of the application lifecycle. I love, I mean I freaking love hammering away at code in search of bugs.

  • Passionate validation tester finds bugs and fixes them
  • Uses AI to discover edge cases and potential failures
  • Created ReliAgent to ensure reliability of AI agent software

The Hidden Cost Of A Line of Code

"Given an integer array nums , return true if any value appears at least twice in the array, and return false if every element is distinct." My first approach was to use a list class Solution : def…

  • Initial approach had O(n^2) time complexity
  • Set-based solution improved efficiency to O(n)
  • Final optimal solution uses single line of code

More from Sunday 30 August →