t2em — Python SDK (PyPI)
Python client for t2em.com for LangGraph / CrewAI /
AutoGen pipelines (ТЗ docs/TZ_t2em.md §8.3).
Status: implemented (Этап 4 done). Zero-knowledge secret drops — the relay stores only an AES-256-GCM envelope and can never derive the key.
Install
pip install t2em # from PyPI (when published)
pip install -e . # from this repo (editable, dev)
Usage (the ТЗ §8.3 contract)
from t2em import T2emClient, generate_x25519_keypair
client = T2emClient("https://t2em.com")
# Mode B (symmetric — key rides in the URL #fragment, never sent to the server)
drop = client.push(secret="sk-live-...", ttl=300)
print(drop.url) # https://t2em.com/s/abc123#xyz789
print(drop.delete_token)
secret = client.pull_text(drop.url)
# Mode A (asymmetric — sealed to the recipient's X25519 pubkey)
keys = generate_x25519_keypair()
drop = client.push(secret="sk-live-...", recipient_pubkey=keys.public_key, ttl=300)
secret = client.pull_text(drop.url, recipient_privkey=keys.private_key)
# Delete before TTL expiry
client.delete(drop.id, drop.delete_token)
# Keyfile — same JSON format as the TS CLI (`t2em-cli keygen`)
from t2em import write_keyfile, load_keyfile
pubkey = write_keyfile("./agent.key") # 0600, returns b64url pubkey
key = load_keyfile("./agent.key") # LoadedKey(private_key, public_key)
Guarantees
- Python ≥ 3.10, full type hints (
py.typed). - Networking: stdlib
urllibonly (norequests/httpx) — §8.3. - Crypto: PyCA
cryptographyas the single crypto dependency (hand-rolled crypto is forbidden, §11.2); HKDF strictly per RFC 5869. - Bit-compatible with the TypeScript protocol
@me2em/protocol: verified againstvectors/t2em-drop.v1.json(unpack AND deterministic re-encryption, both modes) plus TS↔Python cross-pack/unpack checks. - Transport is injectable (
T2emClient(base_url, transport=...)) for testing without sockets. - Error taxonomy mirrors §4.5: branch on
ProtocolError.code(MALFORMED/UNSUPPORTED_VERSION/DECRYPT_FAILED),UsageError,HttpError(status / code / retry_after).
Layout
python-sdk/
├── src/t2em/ # package (py.typed)
│ ├── protocol.py # constants: version, TTL bounds, HKDF info (freeze §4.5)
│ ├── base64url.py # strict RFC 4648 §5 unpadded codec
│ ├── envelope.py # v1 envelope validation (mirror of @me2em/protocol)
│ ├── mode_b.py # pack/unpack sym (AES-256-GCM, 12B IV)
│ ├── mode_a.py # pack/unpack X25519 ECDH + HKDF-SHA256
│ ├── fingerprint.py # 8-char pubkey fingerprint (§4.2.1)
│ ├── keyfile.py # t2em-x25519-key-v1 JSON keyfile (0600)
│ └── client.py # T2emClient: push / pull_text / pull_bytes / delete
└── tests/ # pytest: vectors bit-compat, client journeys, keyfile
Metadata
Release files for t2em 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| t2em-0.6.0.tar.gz | 22.2 kB | Without provenance | Details for t2em-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| t2em-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for t2em-0.6.0-py3-none-any.whl |
Total release size: 42.8 kB
Release files / t2em-0.6.0.tar.gz
| Download URL | t2em-0.6.0.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc9195b8c045b6dd6307e567268522a4a3d961df2b39f1db1f396f0718274215
|
|
BLAKE2b-256 checksum How to use checksums |
102cb321eaffcd01fa25432a85aa2d0bc891fc1199c741c595815d8fb72e0767
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / t2em-0.6.0-py3-none-any.whl
| Download URL | t2em-0.6.0-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86aa54439719ad2a07b8536b012059fb7b20b746025aeb07fdb81bd2d64ac810
|
|
BLAKE2b-256 checksum How to use checksums |
f3868cb6f7059b6373691a86164be654908e81f99dfe49d8bc464347db38a6cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for t2em 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.