Skip to main content

🛡️ Userbot-Auth Library Mode

Enterprise-Grade

✨ Features

Userbot-Auth Library Mode is a server-enforced authentication and control layer for userbots. It is designed to keep authority on the backend, not inside copied client code.

Getting Started

# Add an __init__.py, or add additional files as needed

import os
from pyrogram import Client
from userbot_auth import UserbotAuth

ubt = UserbotAuth(
    url="https://ubt.ryzenths.dpdns.org",
    secret=os.getenv("UBT_SECRET"),
    token=os.getenv("UBT_PROVISION_TOKEN"),
    strict=True
)

class Userbot(Client):
    super().__init__(...)
    self.me = None

    async def start(self, *args, **kwargs):
        await super().start()
        self.me = await self.get_me()
        await ubt.client_authorized(self, self.me)

User = Userbot()

Main API Chat/Completions

from userbot_auth import UserbotAuth

ubt = UserbotAuth(...)

return await ubt.chat_completions({
    "model": "r-services-pro-7-plus",
    "stream": False,
    "messages": [{"role": "user", "content": "Say good"}]
})

Feature Highlights

🔐 Server-Issued Runtime Keys

All runtime access is controlled by server-generated keys bound to a specific user identity.

🛑 Deploy Control & Remote Blocking

Deployments can be disconnected or blocked remotely, even if client code is copied or modified.

🔄 Key Rotation & Revocation

Runtime keys can be rotated at any time to invalidate existing deployments instantly.

📊 Plan-Based Rate Limiting

Request limits are enforced by server-defined plans (FREE / PRO / MAX) with optional per-user overrides.

🕶️ One-Time Key Exposure

Runtime keys are shown only once during issuance to reduce leakage risk.

📝 Audit-Friendly Key Issuance

Every issued key includes a unique issued_id for tracking, review, and incident response.

🔒 Hardened Request Validation

Supports timestamp checks, nonce-based HMAC signatures, and timing-safe comparisons.

🏛️ Centralized Enforcement

All authorization decisions are made on the backend, not in client code.

⚡ Anti-Reuse & Anti-Repack Design

Copied source code cannot bypass server validation or rate limits.

📚 Library-First Architecture

Designed to integrate cleanly into existing userbot frameworks or backend services without lifecycle coupling.

🔑 Authentication and Identity

  • Server-issued runtime keys (ubt_live_*, optional ubt_test_*) Keys are issued by the server and verified on every request.

  • Per-user identity binding Every key is associated with a specific user_id. The server decides whether that identity is valid.

  • Strict separation of secrets Provisioning secrets and runtime keys are isolated to prevent privilege escalation.


⚙️ Provisioning and Key Control

  • Controlled key provisioning Runtime keys can only be issued through a protected provision flow.

  • Key rotation and revocation Keys can be rotated to invalidate old deployments immediately.

  • One-time key visibility Runtime keys are displayed once during issuance to reduce leakage risk.

  • Audit identifiers (issued_id) Every issued key can be traced and reviewed through an audit-friendly identifier.

⚡ Runtime Enforcement

  • Connected-user verification Requests are accepted only when the server confirms the user is connected and authorized.

  • Remote deploy blocking The server can block deployments at runtime (disconnect or ban), regardless of client code.

  • Automatic disconnect on invalid credentials Invalid keys or mismatched identity triggers server-side disconnect logic.

📈 Plan System and Rate Limiting

  • Plan-based limits Traffic limits are enforced by plan tiers (FREE / PRO / MAX).

  • Per-user overrides Limits can be customized per user (including unlimited access for trusted accounts).

  • Server-side rate enforcement Limits cannot be bypassed by modifying client code, because counters and windows live on the server.

  • Consistent 429 responses with reset metadata The API can return retry timing information for clean client backoff behavior.

🔐 Security Hardening

  • Timestamp freshness validation Prevents delayed or replayed requests outside allowed time skew.

  • Nonce-based request signing (HMAC) Provides integrity checks and replay resistance for sensitive endpoints.

  • Replay protection strategy Requests can be rejected if a nonce is reused within a time window.

  • Timing-safe comparisons Protects secret comparisons from timing-based attacks.

Operational Visibility

  • Deployment and runtime telemetry The server can track version, platform, device, and last-seen activity.

  • Actionable status responses Standardized responses for states like DISCONNECTED, BANNED, and RATE_LIMIT.

  • Central enforcement policies Your backend defines enforcement rules, and the library ensures they are applied consistently.

Intended Use

  • 🔒 Private userbot frameworks
  • 💼 Commercial or restricted deployments
  • 🛡️ Projects requiring deploy control and anti-reuse enforcement
  • 👨‍💻 Developers who need server authority and auditability

Metadata

Release files for userbot-auth 1.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for userbot-auth 1.0.17
File Size Uploaded Provenance Actions
userbot_auth-1.0.17.tar.gz 13.6 kB Without provenance Details for userbot_auth-1.0.17.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for userbot-auth 1.0.17
File Interpreter ABI Platform Actions
userbot_auth-1.0.17-py3-none-any.whl Python 3 none any Details for userbot_auth-1.0.17-py3-none-any.whl

Total release size: 26.4 kB

Release files / userbot_auth-1.0.17.tar.gz

Download URL userbot_auth-1.0.17.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f7393a7e925c8ff973574ef3ddc4d9a899d0905bb218195d5bc8a3cacfb33b95
BLAKE2b-256 checksum
How to use checksums
521b7381a821a90562349598033a0ccc88920d8b11cc764e984985ee86c06017
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / userbot_auth-1.0.17-py3-none-any.whl

Download URL userbot_auth-1.0.17-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0032a308f3b8030f3455030b4753e63ddebf98a62725797000260b9db61c1e76
BLAKE2b-256 checksum
How to use checksums
b1c5c2bdac41c5e7c70b45ad7c905fe617e0b52d7629b302a1306ead20299b48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for userbot-auth 1.0.17

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page