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.1.tar.gz (10.3 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.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sdkey-0.1.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sdkey-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6c9128f3080be0ac2be934d5a3de61dc2c68338ec42fdb77e26b39be1de054f6
MD5 e2e34422d61b3f81765769cdc5c0adef
BLAKE2b-256 23126b321e7d65fe1c7e6802a03c590d9107f5b62476e278785662c61dd22edc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdkey-0.1.1.tar.gz:

Publisher: publish.yml on SDKeyDev/sdkey-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: sdkey-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sdkey-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b59482de789aceff9d9c8cfbd6886e322093a35982a2bf7433adda21bd82e76
MD5 19e6cbecfe81c9f48c98b4ab9f56c7dc
BLAKE2b-256 cf8cf2a6866a4ad0c89d2161145ae5aa9dde95f8d6b21a9068bafb5932fd715e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdkey-0.1.1-py3-none-any.whl:

Publisher: publish.yml on SDKeyDev/sdkey-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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