FECTP from Python
The sans-IO session layer, over the C ABI in crates/ffi.
Payloads in, frames out, and back again — you own the socket, the thread
and the event loop.
Not audited. Nothing in this project has been reviewed by someone who breaks protocols for a living.
Installing
pip install fectp
Wheels for Windows x64, Linux x64 and arm64 (glibc 2.28 or newer — a
Raspberry Pi on a 64-bit OS, AWS Graviton) and macOS (Apple silicon and Intel),
each carrying the shared library it needs — no Rust and no
compiler. Python 3.9 or newer. ctypes underneath, so nothing else is pulled
in.
Running it from a checkout
cargo build -p fectp-ffi --release
python3 bindings/python/test_fectp.py
The shared library cargo just built is found under target/, or named through
FECTP_LIBRARY.
What it looks like
import fectp
server = fectp.Identity.generate()
client = fectp.Identity.generate()
initiator = fectp.Initiator(client, server.public, session_id=1)
responder = fectp.Responder(server)
opening = initiator.write_init(b"data sent with the handshake")
responder.read_init(opening) # -> b"data sent with the handshake"
server_session, reply = responder.write_response()
client_session, _ = initiator.read_response(reply)
frame = client_session.seal(b"hello") # put this on a socket
server_session.open(frame) # -> b"hello"
Initiator.read_response and Responder.write_response consume the handle
they are called on, success or failure — a handshake cannot be retried from a
half-read state. Using one again raises rather than corrupting memory, which is
what happens without that check: removing it takes
this test suite from passing to the interpreter dying.
The secret key
There is no way to read a private key out of an Identity, and the C ABI
exports no such call for this to wrap.
That is the shape of the whole binding rather than an oversight. Bytes handed
to Python cannot be wiped: bytes is immutable so nothing can overwrite it,
the interpreter copies freely, and the memory may reach swap. Rust wipes its
copy when the identity is dropped; nothing it does survives the crossing.
Identity.from_secret restores a key you stored elsewhere, and FECTP wipes the
copy it makes. What you passed in is yours — use a bytearray and overwrite it
afterwards, because a bytes cannot be.
Or never have it here
Identity.from_key takes a key held by a secure element, an HSM or a TPM, and
FECTP never sees it:
def dh(peer_public: bytes) -> bytes:
# Ask the device for X25519 with its private key; 32 bytes back.
return device.derive(peer_public)
identity = fectp.Identity.from_key(device.public_key, dh)
dh runs synchronously, twice per handshake on each side. If it raises, the
handshake ends with KeyUnavailable and your exception as its __cause__;
the identity can be used again. Return a bytearray and the wrapper wipes it
after copying.
What this does not do
The session layer only. Retransmission, congestion control, fragmentation and
keep-alive are not here — they live in the fectp crate, above the layer this
binds. A caller who needs reliable delivery builds it or does without.
That trade is why the binding is this shape at all (OTHER-LANGUAGES.md): binding the layer above would mean blocking calls to hold the GIL over, threads the library owns, and memory crossing the boundary in both directions.
One warning worth repeating from D63: the abandonment reporting such a caller would rebuild is the logic this project got wrong twice, and §5.5 of the specification notes that a conforming receiver cannot observe it — so wire-level test vectors cannot catch that class of mistake either.
Metadata
Release files for fectp 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| fectp-0.2.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for fectp-0.2.2-py3-none-win_amd64.whl |
| fectp-0.2.2-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for fectp-0.2.2-py3-none-manylinux_2_28_x86_64.whl |
| fectp-0.2.2-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details for fectp-0.2.2-py3-none-manylinux_2_28_aarch64.whl |
| fectp-0.2.2-py3-none-macosx_11_0_universal2.whl | Python 3 | none | macOS 11.0+ universal2 (ARM64, x86-64) | Details for fectp-0.2.2-py3-none-macosx_11_0_universal2.whl |
Total release size: 981.4 kB
Release files / fectp-0.2.2-py3-none-win_amd64.whl
| Download URL | fectp-0.2.2-py3-none-win_amd64.whl |
|---|---|
| Size | 120.7 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0c1516e7fc1afa94d79759eb03c55084dffd0b35566f2a67c3400b93954fcaa3
|
|
BLAKE2b-256 checksum How to use checksums |
abad3adb5f4a2ce6178abb5c0ca82093d05219cb2b9dd981d20419d8a800d9d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / fectp-0.2.2-py3-none-manylinux_2_28_x86_64.whl
| Download URL | fectp-0.2.2-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 239.5 kB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
41c613a53c246b279e7b191f5176efe85adf9b8b57bc03075ad0ca58d67857e0
|
|
BLAKE2b-256 checksum How to use checksums |
21ffa4bbb1f29e403f87b9d835c7fca91a9889b03e602bac6bbb2cc03a46fe60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / fectp-0.2.2-py3-none-manylinux_2_28_aarch64.whl
| Download URL | fectp-0.2.2-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 217.8 kB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
ae4cda02d37ba88924c36411200f1ef2c96e2bb351ca22894756052b2c62481f
|
|
BLAKE2b-256 checksum How to use checksums |
196788b960f9a0435133281087b41a29d7fe5b2b0e1657271326c82b7e9ad69e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / fectp-0.2.2-py3-none-macosx_11_0_universal2.whl
| Download URL | fectp-0.2.2-py3-none-macosx_11_0_universal2.whl |
|---|---|
| Size | 403.3 kB |
| Tags | Python 3 macOS 11.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
f2837a7571b0ceba8e80ee4df413656cee72c1f9d14551425ccfa68223cee4c7
|
|
BLAKE2b-256 checksum How to use checksums |
db2252f60fe392b7efe43994483a11bd57736d9dd5d56b96181d4f550f7567ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for fectp 0.2.2
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.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for fectp-0.2.2-py3-none-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA 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.