Skip to main content

Python SDK for NebulAuth runtime API

Project description

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,
    )

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

Optional: NEBULAUTH_BASE_URL=..., NEBULAUTH_TEST_HWID=...

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

nebulauth_sdk-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

nebulauth_sdk-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file nebulauth_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: nebulauth_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for nebulauth_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 070f45bcfe753e544597245ffe9ba048c77e1e1c665e08bbdfa2795d6e690670
MD5 98f9e32d8d944af3cfd2d8cf15fb5263
BLAKE2b-256 0bae99fa307e24bec00c035691d04aa265aa1a915a69f88909a61a4b6244f1bd

See more details on using hashes here.

File details

Details for the file nebulauth_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nebulauth_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for nebulauth_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3322ecfcc73945a4aaefc1d3c0c57a817270d7ec15ea4636dbdd50692500554d
MD5 15fa9c59ff329ddd443427d376dd5fdf
BLAKE2b-256 a81567a80944ca2bcdad3200fb43bf86b18722708fa7c7c20c6a34957e23cabe

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