Skip to main content

sbp-client

SBP (Session Bridge Protocol) end-to-end encryption core. Implements the wire format from sbp-spec/spec/SBP-0.4-e2ee.md.

The relay (sbp-dispatcher) never holds a secret: confidentiality comes from crypto_box sealing to the pinned recipient box public key, and integrity from an Ed25519 signature over tag || eph || cipher. Routing is blinded with HMAC(rk, scope), so the relay cannot even tell which session a frame belongs to.

Install

pip install sbp4ai-client

Quick start

from sbp_client import KeyPair, KeyRing, derive_rk, E2EELink

rk = derive_rk("your-routing-passphrase")          # 32-byte shared routing key
me = KeyPair.generate()                            # your box+sign keypair
ring = KeyRing()
ring.add("peer", peer_box_pk_b64, peer_sign_pk_b64)  # pin the other side's publics

link = E2EELink(me, ring, rk, my_key_id="cli", device_did="dev_abc", role="client")
hello = link.hello()                               # send to relay first
link.subscribe(link.scope.device())                # ask relay to route device-tag frames
envelope = link.send(inner_frame, link.scope.session("sess1"), peer_key_id="dev")
# ... ship `envelope` over WebSocket; on the other side:
inner = link.recv(envelope)                        # decrypted + signature-checked

Key formats

Field Bytes Note
box_sk / box_pk 32 X25519 (crypto_box)
sign_sk 32 (PyNaCl seed) or 64 (libsodium seed‖pk) both accepted by KeyPair
sign_pk 32 Ed25519 verify key
rk 32 64-hex = raw key; anything else is stretched with Argon2id

KeyPair.to_strings() exports sign_sk in the 64-byte libsodium form, so the same string can be pasted straight into a JS client (libsodium / tweetnacl both want 64 bytes).

Wire format

envelope = { v:"sbp/0.3e", tag, kid, eph, sig, cipher }
  tag    = base64url(HMAC-SHA256(rk, scope))       scope: "dev|{did}" | "sid|{did}|{sid}"
  eph    = base64url(ephemeral X25519 public key)
  cipher = base64url(nonce[24] || crypto_box(inner))
  sig    = base64url(Ed25519.sign(sign_sk, tag || eph || cipher))

Every frame uses a fresh ephemeral keypair, so each crypto_box key is independent (forward secrecy within a session). The relay verifies sig with sign_pk from its public-key directory and routes by tag — it can do neither without rk / box_sk.

Layout

  • sbp_client/crypto.py — KeyPair, KeyRing, derive_rk, compute_tag, wrap/unwrap, sign_challenge/verify_challenge, verify_sig.
  • sbp_client/transport.py — E2EELink / Scope: transport-agnostic envelope wrap/unwrap + subscription control, shared by sbp-agents and client apps.
  • sbp-dispatcher — the relay (public-key directory + opaque-tag pub/sub).
  • sbp-agents — the device/panel that reports local tmux / CLI sessions.

Metadata

Release files for sbp4ai-client 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sbp4ai-client 0.4.0
File Size Uploaded Provenance Actions
sbp4ai_client-0.4.0.tar.gz 8.2 kB Without provenance Details for sbp4ai_client-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sbp4ai-client 0.4.0
File Interpreter ABI Platform Actions
sbp4ai_client-0.4.0-py3-none-any.whl Python 3 none any Details for sbp4ai_client-0.4.0-py3-none-any.whl

Total release size: 16.1 kB

Release files / sbp4ai_client-0.4.0.tar.gz

Download URL sbp4ai_client-0.4.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6f43bdb3d61f5ae0129bd05e68872aa95627ce0115655e3ecff443e16260daaa
BLAKE2b-256 checksum
How to use checksums
1eaa73d0c4a3b44b23d2aabef70441959b14ffbdd51f965d4edf230331940110
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / sbp4ai_client-0.4.0-py3-none-any.whl

Download URL sbp4ai_client-0.4.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f53c2dc33144c6752c842a9d79afdb76bc31e770c7d3b0e8f1800860ba516a68
BLAKE2b-256 checksum
How to use checksums
ab70a2687413d2492e6f512ead6d4aafe2b2b01319c83ae262d8ae613022e6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Security for sbp4ai-client 0.4.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.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page