Skip to main content

NebulAuth Python SDK Repo

This repository contains the Python package source and test suite for NebulAuth.

Structure

  • nebulauth_sdk/ — package source
  • tests/ — unit tests + env-gated live tests
  • pyproject.toml — package/build metadata

Install (local)

cd "NebulAuth SDKs/Python"
pip install -e .

Quick start

from nebulauth_sdk import NebulAuthClient

client = NebulAuthClient(
    bearer_token="mk_at_...",
    signing_secret="mk_sig_...",
    service_slug="your-service",
    replay_protection="strict",  # "none" | "nonce" | "strict"
)

# Verify key
verify = client.verify_key(
    key="mk_live_...",
    request_id="req-123",
    hwid="WIN-DEVICE-12345",
)
print(verify.status_code, verify.data)

# Redeem
redeem = client.redeem_key(
    key="mk_live_...",
    discord_id="123456789012345678",
)
print(redeem.status_code, redeem.data)

# Reset HWID
reset = client.reset_hwid(
    discord_id="123456789012345678",
    key="mk_live_...",
)
print(reset.status_code, reset.data)

PoP flow support

When you mint PoP credentials from /auth/verify, you can call endpoints with those values:

pop_bootstrap = client.auth_verify(key="mk_live_...", hwid="WIN-DEVICE-12345")
if pop_bootstrap.data.get("valid"):
    access_token = pop_bootstrap.data["accessToken"]
    pop_key = pop_bootstrap.data["popKey"]

    verify_with_pop = client.verify_key(
        key="mk_live_...",
        use_pop=True,
        access_token=access_token,
        pop_key=pop_key,
    )

Dashboard API usage

from nebulauth_sdk import NebulAuthDashboardClient

dashboard = NebulAuthDashboardClient(
    auth={"mode": "bearer", "bearer_token": "mk_at_..."},
)

me = dashboard.me()
users = dashboard.list_users()

session_users = dashboard.list_users(
    {
        "auth": {"mode": "session", "session_cookie": "session-cookie-value"}
    }
)

Notes

  • Canonical signing string matches your bot implementation:
    • METHOD\nPATH\nTIMESTAMP\nNONCE\nBODY_SHA256
  • Canonical path strips the base URL path prefix (e.g. /api/v1) before signing.
  • NebulAuth may return HTTP 200 with logical denials (e.g. {"valid": false, "reason": "NOT_FOUND"}).
  • SDK returns NebulAuthResponse with:
    • status_code
    • ok
    • data
    • headers

Tests

  • Unit/contract tests (mocked HTTP):
python -m unittest discover -s tests -v
  • Live integration tests (real API calls, optional):
NEBULAUTH_LIVE_TEST=1 \
NEBULAUTH_BEARER_TOKEN=mk_at_... \
NEBULAUTH_SIGNING_SECRET=mk_sig_... \
NEBULAUTH_TEST_KEY=mk_live_... \
python -m unittest tests.test_live_client -v

Live test env vars:

  • Required to enable live tests:
    • NEBULAUTH_LIVE_TEST=1
  • Required for runtime live tests:
    • NEBULAUTH_BEARER_TOKEN
    • NEBULAUTH_SIGNING_SECRET
    • NEBULAUTH_TEST_KEY
  • Required for dashboard live test:
    • NEBULAUTH_DASHBOARD_BEARER_TOKEN
  • Optional:
    • NEBULAUTH_TEST_HWID

Metadata

Release files for nebulauth-sdk 0.2.0

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

Source distribution (sdist)

Source distribution for nebulauth-sdk 0.2.0
File Size Uploaded
nebulauth_sdk-0.2.0.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nebulauth-sdk 0.2.0
File Interpreter ABI Platform
nebulauth_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.5 kB

Release files / nebulauth_sdk-0.2.0.tar.gz

Download URL nebulauth_sdk-0.2.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a79674965f01d90d39cdbfb7309132030ca91a9f7f521fba827ae95723a69b8e
BLAKE2b-256 checksum
How to use checksums
56727985f396ea1d7ead6a61aa1a2bb37c2e814880b0b8d4240e844a93751e7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / nebulauth_sdk-0.2.0-py3-none-any.whl

Download URL nebulauth_sdk-0.2.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
285e484948b105a2cef5ae542a210660a58121601cb96e70b115000464330114
BLAKE2b-256 checksum
How to use checksums
80ad82d733c5229fc14d3aa2d7592cf64594c106752ba1492e20448e46cba7f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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