A session is post-quantum only when both ends are, so with every Android device registering `proto: 1` the iPhone implementation protected approximately no real conversation. The property was true of the code and false of the product. This is the other half. ML-KEM-768 over Bouncy Castle's low-level `pqc.crypto.mlkem`, the same way Ed25519 already uses its `rfc8032` class: not the JCA provider, which is awkward to register on Android and which R8 cannot shrink. The platform offers nothing here — Conscrypt has no ML-KEM at any API level — and hand-rolling a lattice KEM to avoid a dependency would be a far worse trade than the one Ed25519 already made. No new dependency: the jar was already in the build for Ed25519. Keys are stored as the 64-byte FIPS 203 seed, never the expanded decapsulation key — 64 bytes in the vault instead of 2400, and the same representation iOS persists, which is what lets a history export cross platforms. That is also the thing most likely to be silently wrong, so it is checked against the published vector rather than against another run of our own code: the seed in `pqx3dh-v2.json` derives the public key the normative JavaScript engine derived, and the full responder side reproduces the published session key and associated data byte for byte. Everything else here would pass with an implementation that is internally consistent and agrees with nobody. Negotiation refuses in three places, and each is a substitution somebody would otherwise get for free. A KEM prekey whose signature does not verify is treated as ABSENT, so a relay handing out a key of its own drops the session to v1 rather than to its key — the same substitution `spk_sig` stops classically, and worth more here because it buys the whole post-quantum half. A `proto` claim with no `caps_sig` reads as v1, so a relay cannot advertise a v2 device as v1-only and strip the post-quantum half off every new session. And the one-time id is signed big-endian and inside the signature, so a renumbered key falls back to the last-resort one instead of being spent. Both pools are refilled together, and that is not tidiness. They drain at the same rate — one key per new session — so a refill that topped up only the classical pool would let the post-quantum one run dry and push every later session onto the last-resort key, every one of them sharing a single KEM key, with nothing anywhere reporting a downgrade. Mixed fleets work in both directions and a spent prekey is not an error: a duplicate delivery of a v2 prekey envelope names a one-time key this device has already consumed, and throwing there would turn a retransmission into a dead conversation. Two test fixtures had to say what they are rather than answer by order. Sending now asks for a transparency-log head on its own, so a queue matched purely by position handed that request the device listing and failed on a parse error nowhere near the cause. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Flamenet Messenger — Android
The Android app, and the two libraries under it.
engine/ the protocol: X3DH, Double Ratchet, sealed sender, safety numbers,
key transparency. Plain Kotlin/JVM — no Android in it at all.
client/ the relay transport: HTTP, auth, the §8 routes.
app/ the Compose app.
interop/ the cross-engine driver; not shipped.
engine and client are deliberately plain JVM libraries. The protocol has
nothing to do with Android, and keeping it off the platform means their tests
run anywhere a JVM does — no SDK, no emulator, no device, which is also what
lets them gate in CI on Linux:
./gradlew :engine:test :client:test
The app's own unit tests need the Android SDK but still no emulator (Robolectric):
./gradlew :app:testDebugUnitTest
Where it stands
PARITY.md is the definition of done for this app — read that, not this. Every row there names the iOS file it came from so it can be re-checked rather than trusted. Headlines as of 2026-08-28: messaging, groups, attachments, voice notes, stories, calls, sealed sender, key transparency and the encrypted vault are built and tested; a cross-platform round trip against iOS was verified on 2026-08-26.
⚠️ This file said "Nothing here is an app yet" until 2026-08-28, above a tree containing the finished app — the README described the repository as it was when the engine landed and nothing updated it as the app grew around it. If a claim here ever disagrees with PARITY.md or with the tree, believe those, and fix this.
Why the engine came first, and is held to the vectors
An Android client needs the protocol implemented a third time, and the third
implementation is the one that finds the places where the specification says
less than the two existing engines quietly agreed on — but only if it is
written against the spec and the published vectors rather than against a
reading of our own Swift and JavaScript. So the engine is held to
test/vectors/protocol-v1.json in
flamenet-e2e — the same file the
other two engines are checked against, read from that repository rather than
copied here, because a copied vector file drifts and a drifting vector file
stops being a check. PublishedVectorsTest looks for it beside this checkout
and fails loudly if it cannot find it; FLAMENET_VECTORS overrides the search.
Two implementations that agree may both be wrong in the same way, especially when one was written while reading the other. The audit-path ordering in §19 is the worked example: a top-down reading of a bottom-up path produces the correct root for every left-spine index, so it passes any test that only checks index 0. The vector file pins a right-descending index for that reason, and the Kotlin tests assert both that the published path verifies and that the same path reversed does not.
If this engine ever disagrees with the file, the interesting question is which of the three is wrong — not this one by default.
Contributing and security
- CONTRIBUTING.md — building (JDK 21,
JAVA_HOMEis not optional on a Mac), the test gate, and the platform traps that cost an hour each. - PARITY.md — what iOS does, what this does, and what is left. It is the definition of done for this app.
- SECURITY.md — threat model and where to send a vulnerability report. Not an issue tracker matter: security@flamenetmessenger.com.