All blog posts
Updates 3 min read

Rust Sessions v2, Sender Keys and Message History Transfer

The Rust port added version 2 sessions, encrypted message headers, sender keys and moving encrypted history to another device.

By Comutability Published Update from
Protected digital identity on a laptop representing encrypted sessions, sender keys and device transfer.

Project update: 15 November 2026. GitHub change #9: merged into the repository. The underlying protocol remains draft and unaudited.

The Rust port added version 2 sessions, encrypted message headers, sender keys and moving encrypted history to another device.

Why we made this change

Privacy can fail at the boundaries between features: when a new phone joins, a group member leaves, or a delayed message arrives after a key changes. This update gives those edge cases a common Rust implementation while retaining compatibility with the earlier session format.

The engineering record

The original pull request records the following technical scope and evidence. Some forward-looking notes in the record reflect the state of the work when the request was opened, rather than its status today.

Part 3 of moving Secure Net and Commonveil onto Rust. This brings the rest of the session protocol (CVP-016) across, with the same JSON state as the JavaScript, so a session can move between the two implementations mid-conversation.

What's ported

  • Sessions version 2 (session::v2):
    • the handshake: prekey public keys are bound in the transcript, and the sender's identity is encrypted
    • encrypted message headers
    • the sparse ML-KEM-768 exchange, sent in 256-byte pieces inside the headers
    • seven-day expiry of keys kept for messages that haven't arrived
  • Sender keys (session::group): group messages encrypted once for everyone and signed with Ed25519
  • History transfer (session::history): chunked, with each chunk bound to its manifest
  • JSON API: v2.*, group.* and history.* operations, for the command-line build and WebAssembly

How it's checked

  • Test vectors: every derivation in spec/vectors/cvp-016-v2.json (transcript, handshake, identity key, root, message key, header form)
  • Against the JavaScript: test/rust-session2-interop.test.mjs runs 90-message conversations for each pairing (JS↔Rust, Rust↔JS, Rust↔Rust). Each side switches implementation every few messages, messages arrive late or out of order, and at least two ML-KEM secrets get mixed in. The test also covers group messages and history transfers in both directions, and checks that the same error codes come back for:
    • replayed messages and replayed first messages
    • tampered headers and bodies
    • the wrong message version
    • an untrusted account key
    • keys for missing messages that have expired
  • Refusals: tests/session2.rs and unit tests exercise each refusal directly.
  • Mutation: I removed each of 14 security checks in turn, and every one made a test fail. The checks cover:
    • the ML-KEM exchange staying in step
    • replays in the current and older chains
    • skipped-key expiry
    • header keys bound to their chain
    • the skip limit and key-piece sizes
    • untrusted sending devices
    • dropping the handshake once it's answered
    • group signatures, replays and skip limits
    • history digests and chunk counts
  • Lints: clippy is clean with warnings treated as errors.
  • Locally: all JavaScript tests and all 41 Rust tests pass. CI runs the new interop suite against both the native and WebAssembly builds.

Needs human review

This is security-critical code. Tests and mutation checks show the implementations agree and that each check matters. They don't show the code is free of vulnerabilities, so a cryptographer should review it.

Next: the wire format, commons ledger, governance, private tokens, identity and consent, then the social protocol and MLS groups.

The wider direction

The Comutability approach is open source with human accountability. AI can help research, design, write code and test it, but a merged change is not the same thing as an independently audited product. Secure Net is explicitly described as a draft in its public README. Its use in a sensitive situation should wait for qualified cryptographic review.

What happens next

Review device enrolment and history transfer with human testers, and subject session state transitions to independent cryptographic review.

Read the original sources

Sources and further reading

Explore the evidence and original project records behind this article.