Skip to main content

quantumpipe

PSK-bootstrapped, mutually authenticated key exchange using hybrid ML-KEM-768 and X25519, with ChaCha20-Blake3 encrypted transport. Includes a sans-I/O protocol state machine and an asyncio WebSocket wrapper.

Draft version 0.1.0: The protocol and API are still likely to change. Do not use in production.

Features

  • Registration: establishes a persistent peer credential from a one-time shared registration secret, with out-of-band short authentication string verification.
  • Resumption: authenticates subsequent connections using the stored credential and fresh ephemeral keys.
  • Encrypted traffic: ordered, authenticated bidirectional channels with application-defined message kinds.
  • Flexible integration: drive Session directly over any transport, or use SecSocket with websockets and FastAPI/Starlette-style connections.
  • Credential lifecycle: atomic registration rotation, concurrent-registration arbitration, and verified/unverified state.

Installation

pip install quantumpipe

Python 3.12 or newer is required. Install websockets separately when using the WebSocket wrapper with the websockets library.

Sans-I/O usage

Both sides initially receive the same registration secret out of band. The initiator selects its link ID; the responder discovers it while processing the first message.

from quantumpipe import Message, Session, generate_registration_secret

secret = generate_registration_secret()
alice = Session({"peer": secret}, "peer")
bob = Session({"peer": secret})

msg1, = alice()
msg2, = bob(msg1)
msg3, = alice(msg2)
verification, = bob(msg3)

# Compare verification.sas on both sides through an authenticated
# out-of-band channel before accepting it. None proceeds unverified.
verification.answer = True
msg4, = bob(verification)
verification, = alice(msg4)
assert verification.answer is None
verification.answer = True
msg5, established = alice(verification)
bob_established, = bob(msg5)

frame, = alice(Message(b"hello", kind=1))
assert bob(frame) == [Message(b"hello", kind=1)]

After registration, persist each mutated store and use its composite credential for the next connection. Resumption completes in three messages and does not request another comparison. Application storage and persistence are deliberately outside the library.

WebSocket usage

from quantumpipe import SecSocket, Verification

async def verify(v: Verification) -> bool:
    return await compare_out_of_band(v.sas)

sock = SecSocket(
    websocket,
    store,
    "peer",  # omit on the responding side
    handlers={Verification: verify},
)
await sock.connect()  # use accept() on the responding side
await sock.send(b"hello")
message = await sock.receive()
await sock.close()

The entire handshake, including verification callbacks, has a 15-second default timeout configurable with handshake_timeout.

See demo/client.py and demo/server.py for a runnable example. Protocol details are in docs/protocol.md; state, storage, and error-handling policies are in docs/design.md.

Development

uv run pytest
uv build

The package version is derived from Git tags using hatch-vcs.

License

MIT

Metadata

Release files for quantumpipe 0.1.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 quantumpipe 0.1.0
File Size Uploaded Provenance Actions
quantumpipe-0.1.0.tar.gz 36.4 kB Without provenance Details for quantumpipe-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quantumpipe 0.1.0
File Interpreter ABI Platform Actions
quantumpipe-0.1.0-py3-none-any.whl Python 3 none any Details for quantumpipe-0.1.0-py3-none-any.whl

Total release size: 54.5 kB

Release files / quantumpipe-0.1.0.tar.gz

Download URL quantumpipe-0.1.0.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
645a0c7bd7889b71e6a43c16678f2b7685e01ac8ed2265bab4ecc78ad7ec25e5
BLAKE2b-256 checksum
How to use checksums
eb8ff7aecea0631d9164098414f1dd5e46d5cf74fbdd216719d739725e1deeb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / quantumpipe-0.1.0-py3-none-any.whl

Download URL quantumpipe-0.1.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca3556bdaf108be0fd8a6d8bee4b18b0ce3955d2c55377019b0b5d28d6badb4d
BLAKE2b-256 checksum
How to use checksums
6a59cbc8d213907ce14344a358947321bfaa428fee134bc372023c795de9678a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for quantumpipe 0.1.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.1.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