Skip to main content

AuthGuard Python SDK - Secure authentication client with NaCl encryption

Project description

AuthGuard Python SDK

Python SDK for the AuthGuard v2 API with NaCl box encryption.

Features

  • Full v2 API support with encrypted request/response bodies
  • NaCl box encryption (Curve25519 + XSalsa20-Poly1305)
  • DPoP (Proof-of-Possession) token support
  • Automatic token refresh
  • Device registration and session management
  • Optional SDK secret authentication (for developer apps)
  • Anti-debug report endpoints

Installation

pip install authguard-py

Or install from source:

pip install -r requirements.txt

Quick Start

from authguard import AuthGuardClient

# Initialize client
client = AuthGuardClient(
    app_id="your-app-id",
    # Optional: for apps with SDK secret enabled
    owner_id="developer-user-id",
    sdk_secret="your-sdk-secret"
)

# Initialize session and device
client.init_session()
client.ensure_device()

# Login
result = client.login("username", "password")
if result.ok:
    print("Logged in!")
    print(f"User: {result.data.get('username')}")

# Or use license key
result = client.license("XXXX-XXXX-XXXX-XXXX")

# Check session validity
result = client.check()

# Get app variable
result = client.get_var("my_variable")

# Send heartbeat
result = client.heartbeat()

# Log event
client.log("user_action", {"detail": "something happened"})

Configuration Options

client = AuthGuardClient(
    app_id="your-app-id",
    host="api.evora.lol",       # API host (default: api.evora.lol)
    port=443,                    # API port (default: 443)
    use_https=True,              # Use HTTPS (default: True)
    owner_id=None,               # Developer ID for SDK auth
    sdk_secret=None,             # SDK secret for developer auth
    hwid=None,                   # Custom HWID (auto-generated if None)
)

API Reference

Session Management

  • init_session() - Initialize app session
  • ensure_device() - Register/refresh device credentials
  • ensure_access_token() - Get valid access token (auto-refreshes)

Authentication

  • login(username, password) - Authenticate with username/password
  • register(username, password, email=None, key=None) - Create new account
  • license(license_key) - Authenticate with license key
  • upgrade(license_key) - Upgrade account with license key

Session Operations

  • check() - Verify session is valid
  • heartbeat() - Send heartbeat (keep session alive)
  • get_var(name) - Get application variable
  • log(action, data=None) - Log an event

Advanced

  • call_protected(path, data) - Make authenticated API call
  • call_bootstrap(path, data) - Make bootstrap API call (no auth)

Security Notes

  • All request bodies are encrypted on the wire using NaCl box
  • Device credentials are stored locally (consider encrypting at rest)
  • The SDK automatically handles token refresh
  • DPoP tokens prove possession of device key

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

authguard_py-1.0.2.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

authguard_py-1.0.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file authguard_py-1.0.2.tar.gz.

File metadata

  • Download URL: authguard_py-1.0.2.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for authguard_py-1.0.2.tar.gz
Algorithm Hash digest
SHA256 36e4dc52caf46b655d5681a76cd544a40eca8b98aa11fd2d149a2ea215b337fc
MD5 71cc0af3b3523a4f87d58528d87aa4b1
BLAKE2b-256 d3c7be2b740e5bdbb56632c42332b79c1b5b96a3cbd8211618419f54d4958616

See more details on using hashes here.

File details

Details for the file authguard_py-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: authguard_py-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for authguard_py-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7aa8d854cc3fbefb0141abfd1aaaf9ef352646906ac9a02ce83e3377784fa122
MD5 bb8669ad16864e6770ff87c65b2b40fe
BLAKE2b-256 011d6d7de5c40c8e27737aefeba8601b6178e6137731a4561327aec869ba6432

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page