JNet v2: Nodes You Can Prove, Not Nodes You Hope For
November 11, 2026
Federation has been part of Phosphor for a while: mark a board federated and peer nodes share it — boards, posts, echomail — over the JNet wire. What that first generation of JNet didn’t have was a way to prove who a peer node is.
This is what JNet v2 adds. Not a redesign of the sync layer — the declarative model is untouched — but an identity layer underneath it, the part that decides whether an incoming connection is a friend, a stranger, or an impostor.
The problem: a name is not an identity
In the old model, a node knew its peers as a list of names in a database. When a connection arrived claiming to be node X, the most you could say was: “the name matches something in my guest list.” Nothing bound the name to a machine. A malicious peer could introduce itself as your friend’s node id, and your node would happily accept federated mail from the impersonator into your users’ inboxes.
There was also a subtler problem: keys generated at startup evaporated on restart. Whatever trust you’d built up was attached to a key that was new again by morning. And even when the keys were right, they weren’t addressable — you can’t ask a human to type sysop@ab27876a… into a mail compose box.
JNet v2 attacks all three: proveable identity, persistent identity, and human-addressable identity.
Rule one: a node id is derived from its key
Every node gets an Ed25519 keypair — and now a node id that the key proves. The v2 rule, straight from the handshake code:
public static Verdict validateClaimedId(byte[] ed25519PublicKey, String claimedId) {
...
String derived = deriveNodeId(ed25519PublicKey);
return derived.equals(claimedId.toLowerCase(Locale.ROOT))
? Verdict.MATCH : Verdict.MISMATCH;
}
where an id is well-formed only if it’s the lowercase hex of the first 16 bytes of SHA-256(public_key) — exactly 32 characters, deterministic for a given key. A wire claim that says “I am node X, and here is my public key” only verifies if X really is the hash of that key. An impostor can’t claim your id and pass key verification, and can’t claim your id with a different key. This binding is what makes everything downstream meaningful.
Rule two: the key outlives the restart
The identity is persisted in the node’s database (bbs.jnet_identity), so a restart boots the same node — same key, same fingerprint. Trust accumulated over months doesn’t reset every time the sysop reboots. It also survives the everyday churn of a development box.
Rule three: pin on first use — in both directions
Trust in v2 is a ledger, not a handshake question. The first time two nodes complete a verified handshake, each one stores the actual public key bytes the other used. Both roles run the same block — the node that dialed out pins its peer with the exact code the dialed node pins its caller:
JNetAliasStore aliasStore = JNetAliasStore.current();
if (aliasStore != null) {
byte[] pinnedKey = aliasStore.lookupPeerKey(peerNodeId);
if (pinnedKey != null) {
if (!java.util.Arrays.equals(pinnedKey, peerPublicKey)) {
// refuse: close the session, constant reason, count-only log
}
// pinned + matching: silent proceed
After that, every future contact — every day, every session — must present a byte-identical key. If a key changes, the connection is refused with a single, constant reason: peer key mismatch (pinned). No exception details leak, no per-connection log spam; the ledger row’s last_seen timestamp doubles as the liveness ledger that orders sync rounds.
Older nodes that never adopted hash-derived ids still participate: their identity is established by the pin itself. First contact records what they are; every later contact must be that same thing. v2 nodes get the additional binding — the id must be the hash of the key.
A signed hello, and names that ride with it
Node announcements are signed. The HELLO frame carries a display name inside the signed structure, so a name is part of the authenticated payload, not a text field some stranger typed into a database. Phosphor resolves a peer’s display name in a fixed order: what your sysop named them in the contact book (a local nick), then the signed display name they published, then a short id. Third-party claims — a name learned from some other node’s gossip — carry no first-hand proof and lose to both.
Why this matters for mail
With identity and names in place, mail addressing goes human. A netmail address looks like sysop@betabbs — a username at the name you gave the peer node — and the node maps it DNS-style to the real key-bound identity before delivery:
// MailNameResolver.resolveHost, matching order:
// local host → already a pinned node id → contact-book nick
// → observed signed display name → pass through unchanged
An unknown name isn’t guessed into a plausible-looking node id — it passes through unchanged and fails loudly at delivery. Wrong addresses bounce instead of landing somewhere you didn’t intend. The literal id form (sysop@f4j2k9q1) keeps working for scripts and old habits.
The first resolved-and-delivered message is worth pointing at: a node addressed a peer purely by contact-book name and the mail crossed the signed channel, arriving in the remote sysop’s inbox. That’s the whole layer working end to end — a name, a nick table, a pin, and a signature you can’t forge.
Invites, and the honest limitation
Joining a friend’s network is a copy-paste block:
Phosphor invite (v2)
name=/ id=/ pk=/ addr=/...
sig=…
Paste it into the peer manager, and the node verifies the signed block and stores the peer — no hand-copying 128-character secrets. The pk= line exists because of one honest Ed25519 limitation: the signature scheme has no signer recovery, so you can’t reconstruct a public key from a signature alone. The key has to travel with the invitation, inside the signed payload.
What you get
- Impostor resistance. A peer claiming your friend’s id fails key verification on contact.
- Key-swap resistance. Long-term peers can’t be silently replaced by a different machine — the pin gate ends the connection with a constant refusal.
- Restart stability. Identity survives boots; trust doesn’t evaporate.
- Human addressing.
sysop@betabbsinstead of a hash — resolved locally, from names that either you chose or the peer signed.
Federation in Phosphor is still ten lines of declaration — the v2 work changed none of that. What changed is what the wire proves before it forwards a single message. If you want to try it, the server app ships JNet v2, and the federation guide still describes the sync layer.