Skip to main content

Official Python client for the SDKey license authentication protocol

Project description

sdkey

Official Python client for SDKey license authentication.

Implements the sealed session protocol: Ed25519-verified handshake, HKDF session keys, and AES-256-GCM validate envelopes. See PROTOCOL.md.

Install

pip install sdkey

Requires Python 3.10+.

Quick start

Embed these values from the SDKey dashboard when you ship your app:

from sdkey import SdkeyClient, SdkeyError

client = SdkeyClient(
    api_base_url="https://api.sdkey.dev",
    app_id="YOUR_APP_ID",
    app_public_key_b64="YOUR_APP_PUBLIC_KEY_BASE64",
)

try:
    result = client.validate("SDKY-XXXX-XXXX-XXXX-XXXX", "machine-hwid")
    if result.success:
        print("licensed", result.status, result.expires_at)
    else:
        print("denied", result.code, result.message)
except SdkeyError as err:
    print(err.code, err.message)
    raise

validate calls init() automatically when no session exists. Sessions last ~15 minutes server-side; on SESSION_EXPIRED the client clears local state so the next call re-handshakes.

API

SdkeyClient(options)

Option Type Description
api_base_url str API origin (no trailing slash)
app_id str Application UUID
app_public_key_b64 str Raw Ed25519 public key (32 bytes), base64
http_post callable Optional HTTP POST override (tests / custom transport)

Methods

  • init() — challenge handshake; verifies the signed hello; derives the AES session key
  • validate(license_key, hwid) — sealed validate; always decrypts then verifies the Ed25519 signature before trusting success
  • get_session() / clear_session() — inspect or drop the local session

Errors

Protocol / transport failures raise SdkeyError with a code:

INIT_FAILED · HELLO_SIGNATURE_INVALID · VALIDATE_RESPONSE_INVALID · RESPONSE_SIGNATURE_INVALID · SESSION_MISMATCH · CLOCK_SKEW · NETWORK

License denials (banned, HWID mismatch, etc.) return a normal ValidateResult with success=False — they are not raised.

Security notes

  • Never ship app private keys in a client.
  • Do not skip signature verification — that is the anti-spoof binding.
  • This package is open source; the SDKey server remains a separate product.

Development

python -m pip install -e ".[dev]"
pytest

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

sdkey-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

sdkey-0.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sdkey-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f53e2275ec3d256dd8cb113a12e1a6efd25001c2bf5c1352857eee884301dc38
MD5 58aeb201bd198a64996e08dcccb04236
BLAKE2b-256 054a667d268c8f5483b04baccdcac4aab196412e660fda0a6d4a812b7f7da49d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sdkey-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1dc391b50426ce2e8d106265d89ae7db65c96dbd371fa52838155c64dc9a7fd
MD5 1d17b8c0b487e97977e14973afd37a4d
BLAKE2b-256 3d3f9d411c22388ea7082ef3292982d94d74840c0721d4f51778b0c55e24b375

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