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 sourcetests/— unit tests + env-gated live testspyproject.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
NebulAuthResponsewith:status_codeokdataheaders
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_TOKENNEBULAUTH_SIGNING_SECRETNEBULAUTH_TEST_KEY
- Required for dashboard live test:
NEBULAUTH_DASHBOARD_BEARER_TOKEN
- Optional:
NEBULAUTH_TEST_HWID
Project details
Release history Release notifications | RSS feed
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.2.0.tar.gz
(13.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nebulauth_sdk-0.2.0.tar.gz.
File metadata
- Download URL: nebulauth_sdk-0.2.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a79674965f01d90d39cdbfb7309132030ca91a9f7f521fba827ae95723a69b8e
|
|
| MD5 |
8b862f44cc18030fccfe59414a108622
|
|
| BLAKE2b-256 |
56727985f396ea1d7ead6a61aa1a2bb37c2e814880b0b8d4240e844a93751e7a
|
File details
Details for the file nebulauth_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nebulauth_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
285e484948b105a2cef5ae542a210660a58121601cb96e70b115000464330114
|
|
| MD5 |
072badbb08f995d94f1141adbe7f5f9b
|
|
| BLAKE2b-256 |
80ad82d733c5229fc14d3aa2d7592cf64594c106752ba1492e20448e46cba7f9
|