Paul HittandClaude Opus 5 0330a7b84a Android: refuse a key we have reason to distrust
Android had the transparency log's verifier and nothing that called it. The
parity table listed trust state, verification, identity-change acceptance, and
key-log enforcement as absent, and they were — so the relay could hand out a
key it minted, the conversation would encrypt to it, and every byte on the wire
would be correctly encrypted to the wrong person. A log nothing checks records
the substitution faithfully and is never read.

Two independent checks, because neither is sufficient alone.

**Pinning, always on.** Every identity key a peer offers is compared against
what was pinned on first contact; a send to a changed identity is refused until
a person accepts it. The comparison is "every offered key is already pinned",
not "any" — a relay adding one key of its own ALONGSIDE the real ones is the
attack, and the fact that all the genuine devices still work is exactly what
makes it invisible. There is a test for that case specifically.

**The log, opt-in.** `require-key-log` on the Account screen makes a send
demand that the relay prove the recipient's key appears in the log it
publishes. Off by default for the same reason the web engine's is: a relay
predating the log has none, and refusing every peer on those deployments is a
worse failure than the one being prevented.

`KeyLog.verifyConsistency` did not exist in the Kotlin engine. Inclusion alone
is worth very little — a relay that rewrites history reissues perfectly valid
inclusion proofs against its new tree, honest proofs about a dishonest log.
Consistency against a head this device already pinned is the one thing it
cannot produce. Ported from `engine/src/keylog.js`, which is normative, rather
than re-derived: a re-derivation that accepts too much passes every honest test
and fails only against an attacker.

Head gossip rides along with messages and compares a peer's view against ours,
which is what turns a per-device check into a detectable fork — alone, each
client only knows the relay was consistent with itself.

Tested, 100 engine / 52 client, none failing. Consistency is checked over EVERY
pair of prefix sizes in the published vectors, because the traversal has a
special case when the old size is a power of two: an implementation that gets
that wrong still passes 3 -> 5 and fails 2 -> 5. The proof builder the test
uses is trustworthy because the tree it builds is the one whose roots already
matched the published vectors at every size.

The refusals are what carry the weight, so each has its own test: a head going
backwards, two roots at one size, a tampered proof node, a served key absent
from the log, an inclusion proof for somebody else's leaf, and a rewritten log
that cannot be reconciled with a pinned root. A trust check that accepts
everything passes every happy-path test ever written.

Reachable from the UI, per the standing rule. The thread shows identity state
and the safety number; the changed state offers accept and nothing else,
because an "ignore" affordance would be a way to silence the one signal in this
product that means interception. `CrudSurfaceTest` asserts the controls exist.

⚠️ Not yet exercised against a live relay — the tests drive a real HTTP server
with hand-built responses. Implemented and unit-tested, not proven in the
field. ⚠️ Sealed sender is still absent, so the relay still learns who talks to
whom; these protect different things.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 13:48:44 -04:00

Flamenet Messenger — Android

Nothing here is an app yet. This is the engine, and it is deliberately first.

An Android client needs the protocol implemented a third time. That 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 comes first, it is a plain Kotlin/JVM library with no Android in it at all, and it is held to engine/test/vectors/protocol-v1.json — the same file the other two engines are checked against, read from that one location rather than copied here.

./gradlew :engine:test

No Android SDK, no emulator, no device. It runs anywhere a JVM does, which is also what lets it run in CI on Linux.

What the engine covers today

Area Spec State
Safety numbers §7 Done — fingerprints and conversation ordering match the published vectors
Key transparency verification §19 Done — RFC 6962 leaf/node hashing, unbalanced split, bottom-up audit paths
Byte helpers — Unsigned comparison, constant-time equality

What it does not cover

Listed rather than left to be discovered, because a table of green ticks with the hard parts quietly missing is worse than no table:

Area Spec State
X25519 / Ed25519 §3 Not started — needs a provider that works on both JVM and Android
X3DH key agreement §4 Not started
Double Ratchet §6 Not started
Sealed sender §12 Not started
ML-KEM-768 hybrid §11 Not started
ML-DSA-65 identities §20 Not started
Relay client §8 Not started
The app itself — Not started

Until those exist, Android is honestly marked "not started" on the website, and a conversation gets the protocol's guarantees only when both ends are iOS.

Why the vectors matter more than the code

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.

S
Description
Flamenet Messenger for Android — the Kotlin engine, held to the published protocol vectors. No app yet. MIT.
Readme MIT
22 MiB
Languages
Kotlin 99.3%
Shell 0.6%
Python 0.1%