Skip to main content

TNG (Trusted Network Gateway) Python SDK — encrypted HTTP requests with remote attestation

Project description

TNG Python SDK

中文文档

Trusted Network Gateway (TNG) Python SDK — encrypted HTTP requests with remote attestation.

Quick Start

pip install tng-sdk
from tng import Tng
import requests

# Create TNG client (no_ra = disable remote attestation for testing)
tng = Tng(no_ra=True)

# Wrap a requests session
session = requests.Session()
tng.wrap_requests(session)

# All requests flow through the encrypted TNG tunnel
resp = session.get("http://tng-server:10001/api/data")
print(resp.json())

tng.close()

Supported Clients

Client Method
requests tng.wrap_requests(session)
httpx tng.wrap_httpx(client)
openai tng.wrap_openai(client)

Security Options

# Disable remote attestation (testing only)
tng = Tng(no_ra=True)

# With verifier
tng = Tng(verify={"as_addr": "http://127.0.0.1:8080/", "policy_ids": ["default"]})

# With attester
tng = Tng(attest={"aa_addr": "unix:///run/aa.sock", "model": "passport"})

# Bidirectional attestation
tng = Tng(
    attest={"aa_addr": "unix:///run/aa.sock"},
    verify={"as_addr": "http://127.0.0.1:8080/", "policy_ids": ["default"]}
)

Encryption Protocol

# OHTTP is the default
tng = Tng(no_ra=True)

# Use rats-TLS instead of OHTTP (mutually exclusive)
tng = Tng(no_ra=True, rats_tls={"multiplex": True})

# Custom OHTTP
tng = Tng(no_ra=True, ohttp={"key": {"source": "self_generated", "rotation_interval": 300}})

Documentation

Architecture

Your Code → HTTP Library (native proxy) → TNG http_proxy (local)
    → OHTTP/rats-TLS → TNG Server (remote) → Backend

The SDK starts a TNG subprocess with http_proxy ingress. Requests are routed through the native proxy support of each HTTP library, automatically encrypted, and sent to the remote TNG server.

Requirements

  • Python 3.8+
  • tng binary on system PATH (included in wheel, or install separately)

See the Getting Started guide for detailed installation instructions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

tng_sdk-2.6.0-py3-none-any.whl (26.0 MB view details)

Uploaded Python 3

File details

Details for the file tng_sdk-2.6.0-py3-none-any.whl.

File metadata

  • Download URL: tng_sdk-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tng_sdk-2.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 227a72b3ad4b9a8a0ce4026315c75805d608a9b533235020e5e873c4c6c6247a
MD5 b0642e5ee91ea21e917e401b55e09b0b
BLAKE2b-256 328913c817663d67e4bbf28167faaf4d8bad9619c3ad572e8423d23e860a769b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tng_sdk-2.6.0-py3-none-any.whl:

Publisher: build-python-sdk.yml on inclavare-containers/TNG

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