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
- Getting Started — Complete installation, usage, and configuration guide
- Getting Started (中文) — 完整的安装、使用和配置指南
- Architecture — How it works
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+
tngbinary on system PATH (included in wheel, or install separately)
See the Getting Started guide for detailed installation instructions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
227a72b3ad4b9a8a0ce4026315c75805d608a9b533235020e5e873c4c6c6247a
|
|
| MD5 |
b0642e5ee91ea21e917e401b55e09b0b
|
|
| BLAKE2b-256 |
328913c817663d67e4bbf28167faaf4d8bad9619c3ad572e8423d23e860a769b
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tng_sdk-2.6.0-py3-none-any.whl -
Subject digest:
227a72b3ad4b9a8a0ce4026315c75805d608a9b533235020e5e873c4c6c6247a - Sigstore transparency entry: 2084388117
- Sigstore integration time:
-
Permalink:
inclavare-containers/TNG@f6f31a137af0cf91c32f21973ea5d4345dac00a8 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/inclavare-containers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-python-sdk.yml@f6f31a137af0cf91c32f21973ea5d4345dac00a8 -
Trigger Event:
workflow_dispatch
-
Statement type: