This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
astraguard
Official AstraGuard SDK for Python - license validation, HWID binding, and AES-256-GCM offline cache for server-side applications.
Server-Side Only This SDK is for Python server applications (Flask, FastAPI, Django, etc.). Do NOT embed it in client-side software - Python offers no meaningful anti-debug or anti-VM protection. For desktop protection use the C++ header or Rust SDK.
Installation
pip install astraguard
Async support (FastAPI, asyncio):
pip install "astraguard[async]"
Sync (Flask / Django)
from astraguard import AstraGuardClient
client = AstraGuardClient(
api_url="https://api.astraguard.io",
product_id="your-product-id",
# Response Key from Dashboard -> Products -> Response Key. Without this,
# validate()/activate() refuse to trust any response (fail closed) -
# see the Security section below.
response_auth_key="YOUR-RESPONSE-KEY-BASE64",
)
result = client.validate("XXXX-XXXX-XXXX-XXXX")
if result.valid:
print("License valid!")
Async (FastAPI)
from astraguard import AsyncAstraGuardClient
client = AsyncAstraGuardClient(
api_url="https://api.astraguard.io",
product_id="your-product-id",
response_auth_key="YOUR-RESPONSE-KEY-BASE64",
)
result = await client.validate("XXXX-XXXX-XXXX-XXXX")
Features
- validate() / activate() with fully typed responses
- HMAC-SHA256 response verification (fail-closed)
- AES-256-GCM encrypted offline cache (configurable grace period)
- Background heartbeat thread
- Cross-platform HWID (Windows registry, /etc/machine-id, IOPlatformUUID)
- validate_or_exit() for CLI tools
- has_feature() / get_variable() shortcuts
- Update check via /check-update
- Full type annotations + py.typed marker
Error Handling
from astraguard import NetworkError, ServerError, SignatureMismatch
try:
result = client.validate(license_key)
except NetworkError:
pass # unreachable + no cache
except ServerError as e:
print(f"HTTP {e.status}")
except SignatureMismatch:
pass # tampered response
Security - Response Integrity
Every /validate response is signed by the server with
X-AstraGuard-Signature: sha256=<hex>, an HMAC-SHA256 over the exact response
body. Pass response_auth_key at construction time with the Response Key from
Dashboard -> Products -> Security -> Response Key to enable verification
(shown in both quick-start examples above).
- Fail-closed: without a configured key,
validate()/activate()never trust a response - they raiseSignatureMismatchinstead of silently treating an unsigned reply as valid. - Whole-body coverage: the signature check covers the entire response - features, cloud variables, security flags, everything - so a man-in-the-middle can't quietly alter a value in transit.
- Server-side secret: the Response Key must stay on the server - never send it to a browser or embed it in a distributed client. This SDK is already server-only (see the notice at the top of this README), so this is the natural place for it to live.
Heartbeat
import sys
client.start_heartbeat(
license_key="XXXX-XXXX-XXXX-XXXX",
interval=300,
on_lapse=lambda: sys.exit(1),
)
License
MIT
Links
- Docs: https://docs.astraguard.io
- Dashboard: https://www.astraguard.io/dashboard
- Discord (live help): https://discord.gg/Zkcyy5GnQd
- Email: support@astraguard.io
Metadata
Release files for astraguard 1.3.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 | |
|---|---|---|---|---|
| astraguard-1.3.0.tar.gz | 15.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| astraguard-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.1 kB
Release files / astraguard-1.3.0.tar.gz
| Download URL | astraguard-1.3.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7f03d9c388ef8eebd3f7001b039b11e2bfd952d618a81c6e6045225732a9e98
|
|
BLAKE2b-256 checksum How to use checksums |
8baf6eb6e9b8519775c20b61595e407178cc99659ca4d9a3458af7b0f9d4bc2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / astraguard-1.3.0-py3-none-any.whl
| Download URL | astraguard-1.3.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62fb43c84fb8d888965b1c90691daa23e90ede6eed84e737382aae208819a349
|
|
BLAKE2b-256 checksum How to use checksums |
2942cfc7ca69b02898b301bd37a54f8bb003de03122e90d24430e3d95684b830
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for astraguard 1.3.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.