AuthLX-Python-Example
A production-ready Python SDK and example application for AuthLX — the authentication and license management platform for desktop software.
This repository shows how to securely integrate AuthLX into any Python application, with a full suite of runtime security features built in.
🌟 Features
Authentication
| Feature | Description |
|---|---|
register() |
Register a new user by activating a license key |
login() |
Authenticate with username, password, and HWID |
web_login() |
Authenticate without HWID (web/admin panels) |
logout() |
Invalidate the session on the backend |
check() |
Verify whether the current session is still active |
verify_token() |
Validate a standalone API token |
Account Management
| Feature | Description |
|---|---|
changeUsername() |
Rename the currently logged-in user |
forgot() |
HWID-verified password reset |
upgrade() |
Apply a second license key to extend a subscription |
Subscription Helpers
| Feature | Description |
|---|---|
has_active_subscription() |
Returns True if the subscription has not expired |
expiry_remaining() |
Seconds remaining until the subscription expires |
mark_authenticated() |
Flags the user as authenticated and records runtime start |
refresh_auth_runtime() |
Resets the authentication runtime timestamp |
Security
| Feature | Description |
|---|---|
| HWID Locking | Binds accounts to a physical hardware ID (Windows, macOS, Linux) |
| Anti-Tamper | SHA-256 checksum of the running script sent to the backend on login |
| Anti-Debug | Kills the process if a Python debugger (sys.gettrace()) is detected |
| Anti-MITM | session.trust_env = False disables proxy auto-configuration |
| Host Locking | Blocks all HTTP requests to non-whitelisted domains |
| Public-Key Pinning | Hook point for TLS certificate pin verification |
| Payload Cryptography | HMAC-SHA256 seal + XOR field encryption helpers |
Hardened req() |
Custom HTTP wrapper that enforces host-locking and key-pinning |
Rate Limiting & Lockouts
| Feature | Description |
|---|---|
record_login_fail() |
Increments the failure counter |
lockout_active() |
Returns True when a 5-minute lockout is in effect |
lockout_remaining_ms() |
Milliseconds left in the current lockout |
reset_lockout() |
Clears the failure counter and lockout |
bad_input_delay() |
2-second delay injected after each failed login attempt |
Ban Monitor
| Feature | Description |
|---|---|
start_ban_monitor() |
Starts a background thread that polls session validity |
stop_ban_monitor() |
Stops the ban monitor thread |
ban_monitor_running() |
Returns True if the monitor thread is alive |
🚀 Quick Start
1. Requirements
pip install -r requirements.txt
Windows users also need
pywin32for advanced HWID generation.
2. Configure
Open main.py and set your application details:
APP_NAME = "MyApp"
APP_ID = "YOUR-APP-UUID-HERE" # from your AuthLX Dashboard
APP_VERSION = "1.0"
APP_HASH = others.get_checksum() # auto-computed SHA-256
3. Run
python main.py
You will see an interactive console where you can test every SDK feature.
📁 Project Structure
AuthLX-Python-Example/
├── authlx.py ← The SDK (import this in your own projects)
├── main.py ← Interactive example demonstrating all features
├── requirements.txt ← Python dependencies
└── other-examples/
├── merged_example.py ← SDK + example in one standalone file
├── method1.py ← Recommended: your code below the login gate
├── method2.py ← Alternative: functions defined above main()
└── README.md ← Explanation of each integration pattern
🛡️ Security Notes
-
Anti-Debug (
others.anti_debug()) — called automatically duringapi.__init__(). Exits immediately if a debugger is attached. -
Anti-MITM (
session.trust_env = False) — forces therequestslibrary to ignore local proxy environments (Fiddler, Charles, Burp Suite, etc.). -
Anti-Tamper (
others.get_checksum()) — computes a real-time SHA-256 ofsys.argv[0]and sends it to the backend on everylogin()call. Enable Hash Check in your AuthLX Dashboard to reject modified executables automatically. -
HWID Locking — each
login()call sends the machine's Hardware ID. If it doesn't match the one on file, the backend rejects the request with a clear error message directing the user to request an HWID reset. -
Ban Monitor — call
start_ban_monitor()after login to run a background daemon that periodically callscheck(). If the session is revoked (e.g. by an admin ban), the process exits immediately viaos._exit(1). -
Host Locking — call
set_allowed_hosts(["authlx.com"])to restrict all HTTP requests made through the SDK to approved domains only.
📜 License
This SDK is provided open-source under the MIT License. Feel free to modify and adapt it for your own Python projects.
Metadata
Release files for authlx-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| authlx_sdk-1.0.0.tar.gz | 17.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| authlx_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.6 kB
Release files / authlx_sdk-1.0.0.tar.gz
| Download URL | authlx_sdk-1.0.0.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e83b3a187f443784373545dc4a343e3bcfc3976fe6636f0081736ff73dd8c4ea
|
|
BLAKE2b-256 checksum How to use checksums |
c207b34191e5bbe5731a185d6d49b5cf5a1b252ba9298adf4f361ec5c4b033f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / authlx_sdk-1.0.0-py3-none-any.whl
| Download URL | authlx_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb9b9e6bfbc010b2d0437e3c0fb53b59a183fc0500feff6d7b15e8f9af41e036
|
|
BLAKE2b-256 checksum How to use checksums |
d7f024876b80f30b56533891a4ea602e16cb05f66ac0b22ef9e8db5fdd523958
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for authlx-sdk 1.0.0
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.