Skip to main content

Python SDK foundation for TrustPlane Auth request material and local Ed25519 signing

Project description

TrustPlane Auth SDK for Python

Preview Python caller SDK for TrustPlane Auth request signing.

This package provides caller-side helpers for:

  • building transcript-v1 request material
  • computing body SHA-256 values
  • parsing passport claims needed by signing
  • raw local Ed25519 software signing
  • returning adapter-ready TrustPlane Auth headers

It does not include a verifier, broker, adapter, policy engine, SPIFFE issuer, deployment code, enrollment flow, bundle mutation, or TrustPlane Control API.

Install

Install released preview versions from PyPI with an exact version pin:

python -m pip install trustplane-auth-sdk==0.1.0rc1

For unreleased local changes, test this repository through a local checkout or built wheel.

Package Name

The Python distribution name candidate is trustplane-auth-sdk.

The import module is trustplane_auth:

from trustplane_auth import body_sha256, build_request, sign_request

The package version remains 0.0.0 until the release workflow is introduced.

PyPI trusted publishing is planned in a follow-up.

Build Request Example

from trustplane_auth import SOFTWARE_KEY_BINDING, Header, build_request

material = build_request(
    method="POST",
    scheme="https",
    authority="orders.example",
    path="/v1/orders",
    audience="orders-api",
    route_id="orders.create",
    content_encoding="identity",
    body=b'{"order_id":"ord_123","amount":"42.00"}',
    headers=[
        Header(name="Content-Type", value="application/json"),
        Header(name="X-TrustPlane-Nonce", value="nonce-v1-001"),
    ],
    header_allow_list=["content-type", "x-trustplane-nonce"],
    passport_jti="passport-v1-minimal-001",
    nonce="nonce-v1-001",
    issued_at_unix=1740000000,
    key_binding=SOFTWARE_KEY_BINDING,
)

print(material.transcript_sha256)

Signing Example

Signing requires a real passport whose cnf.key_binding is software and whose cnf.public_key_b64url matches the Ed25519 private key.

from pathlib import Path

from trustplane_auth import Header, sign_request

passport = "header.payload.signature"
private_key_pem = Path("ed25519-private-key.pem").read_bytes()

signed = sign_request(
    request={
        "method": "POST",
        "scheme": "https",
        "authority": "orders.example",
        "path": "/v1/orders",
        "route_id": "orders.create",
        "content_encoding": "identity",
        "body": b'{"order_id":"ord_123","amount":"42.00"}',
        "headers": [
            Header(name="Content-Type", value="application/json"),
            Header(name="X-TrustPlane-Nonce", value="nonce-v1-001"),
        ],
        "header_allow_list": ["content-type", "x-trustplane-nonce"],
        "nonce": "nonce-v1-001",
    },
    passport_token=passport,
    private_key=private_key_pem,
)

headers = signed.headers

sign_request reads passport-bound fields from the passport and fails if caller-supplied consistency checks conflict. It does not infer or repair aud, jti, iat, cnf.kid, cnf.key_binding, or cnf.public_key_b64url from caller request inputs.

Conformance Posture

testdata/conformance/v1 contains public-safe contract vectors copied from the TrustPlane Auth reference. Tests assert exact canonical transcript lines, transcript SHA-256 values, and body SHA-256 values.

Security Rule

This SDK signs only the verifier-rebuilt request transcript. Raw local signing is software-only and requires an Ed25519 private key whose public key exactly matches the passport cnf.public_key_b64url claim.

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

trustplane_auth_sdk-0.1.0rc1.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

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

trustplane_auth_sdk-0.1.0rc1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file trustplane_auth_sdk-0.1.0rc1.tar.gz.

File metadata

  • Download URL: trustplane_auth_sdk-0.1.0rc1.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trustplane_auth_sdk-0.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 1743adc5419f69b2b51978da059f6556fa618636a81408d5a3d5854614cf4d72
MD5 0ef834df9db53723b2a985da77d54ccd
BLAKE2b-256 a8e3d0e4007166bffeb8dd6153d5341789650e9516f5cb847b9768cedc79ba1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for trustplane_auth_sdk-0.1.0rc1.tar.gz:

Publisher: release-pypi.yml on trustplane-dev/trustplane-auth-sdk-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 trustplane_auth_sdk-0.1.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for trustplane_auth_sdk-0.1.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 589456b0000d538f04dc5c7b6f230056401e3b6ca0004b0f24afee5228eafcf8
MD5 f51bb82809dced270f67a2cf4d13178f
BLAKE2b-256 093069e17dbc9fa0385f3ae16f6f60ad444992c4ebec7128d6fce7dfad8447fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for trustplane_auth_sdk-0.1.0rc1-py3-none-any.whl:

Publisher: release-pypi.yml on trustplane-dev/trustplane-auth-sdk-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