Skip to main content

Trustplane SDK (Python) for generating request proof headers

Project description

Trustplane Python SDK (v0.2)

Minimal SDK to generate Trustplane proof headers.

Install

pip install trustplane-sdk

Usage

from trustplane_sdk import sign

out = sign(
    tenant_id="mergematter.io",
    api_id="api_demo",
    client_id="client_demo",
    private_key_b64url="<private_key_b64url>",
    method="GET",
    path="/orders",
    body=""
)

print(out["headers"])

Config file

from trustplane_sdk import from_file

client = from_file("./trustplane.json")
out = client.sign(method="GET", path="/orders", body="", private_key_b64url="<private_key_b64url>")

Blindfold verify (one call)

from trustplane_sdk import blindfold_verify

res = blindfold_verify(
    auth_base_url="https://auth.trustplane.mergematter.io",
    tenant_id="new_tenant",
    api_id="api_demo_2",
    client_id="client_demo",
    private_key_b64url="<private_key_b64url>",
    method="GET",
    path="/orders",
    body="",
)
print(res["status"], res["data"])

Blindfold uses a blind OPRF exchange and only sends a blinded input to the Auth Plane.

Example scripts

TP_PRIVATE_KEY=<private_key_b64url> \
python3 sdk/python/examples/demo_core.py
TP_PRIVATE_KEY=<private_key_b64url> \
python3 sdk/python/examples/demo_blindfold.py

Both scripts read trustplane.json for gateway_url and request_path.

Tests

python3 -m unittest sdk/python/tests/test_vector.py

Integration test (against auth plane)

TP_AUTH_BASE_URL=https://auth.trustplane.mergematter.io \
TP_TENANT_ID=<tenant_id> \
TP_API_ID=<api_id> \
TP_CLIENT_ID=<client_id> \
TP_PRIVATE_KEY=<private_key_b64url> \
TP_MODE=core \
python3 sdk/python/tests/integration_test.py

For blindfold APIs, use TP_MODE=blindfold.

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_sdk-0.3.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

trustplane_sdk-0.3.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file trustplane_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: trustplane_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for trustplane_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 aa2d53f50a66504f1b44a7899ada36ef2c311ca6ab4a9dfa0a7f60dd2b4c33b4
MD5 875c4603584c5821973edc468be42241
BLAKE2b-256 85f8e10cdb5606a26d310a0197571e994ee4090ed8c70e124ae15a04d2b9befd

See more details on using hashes here.

File details

Details for the file trustplane_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: trustplane_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for trustplane_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1afe1f62abc8646a2560856cd674e416f275e460a26260c982ec82247e9f2dc
MD5 2b1f843a468ea3d2bb67ebd8d9397eba
BLAKE2b-256 84c88dae75daff3d2bcf1ccb54ec7b2fb371d8475d3d660262f931f58413c9ae

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