Hub 2.2.0: a public key on the v2 heartbeat, Clear public key

Installs that registered with protocol v1 move to v2 by sending their
public key on a signed v2 heartbeat: saved / matches / mismatch, never a
failed heartbeat. Clear public key (2FA again) for a rebuilt server.
Contracts 1.4.0 vendored; hub-protocol.md §6 updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 12:05:59 +02:00
co-authored by Claude Opus 5.5
parent 7428337aa5
commit 106d71e566
11 changed files with 158 additions and 14 deletions
+21 -3
View File
@@ -332,6 +332,24 @@ what's needed) until the church's install of that product runs that version or l
**AI.** The monthly cap and markup are the church's, shared by all its installs: a call from any of
them counts what all of them used this month.
**Moving an install to v2** (e.g. Cross Events 2.4.0): register again with `protocolVersion: 2`,
the product and a public key (same licence and address: same install id, new secret), then send v2
heartbeats. Nothing on the Hub needs changing.
**Moving an install to v2** (e.g. Cross Events 2.4.0, Hub 2.2.0+): an install that registered with
v1 just starts sending v2 heartbeats, with its Ed25519 public key (PEM) in `publicKey`. It doesn't
need its licence key again (Cross Events never stored it). The heartbeat is already signed with the
install secret, so the Hub knows whose key it is. The reply says what happened in
`publicKeyStatus`:
| `publicKeyStatus` | Meaning |
|-------------------|---------|
| `saved` | The Hub had no key for the install and saved this one; the church's other installs list it from their next heartbeat |
| `matches` | The Hub already has this key (line endings and surrounding whitespace don't count) |
| `mismatch` | The Hub has a **different** key and keeps it: an alert opens on the install, and Joshua can **Clear public key** on its page (two-factor again) when the server was restored or rebuilt; the next heartbeat then saves the new key |
A key problem never fails the heartbeat: the licence keeps refreshing whatever happens to the key.
An install keeps sending `publicKey` until it gets `saved` or `matches`. A Hub before 2.2.0 ignores
the field (no `publicKeyStatus`), so the install isn't listed to its siblings until the Hub is
updated. Registering again with `protocolVersion: 2`, the product and a public key (same licence
and address: same install id, new secret) also works, as before.
**Connecting two installs** (Settings → Linked products → Connect) is between the installs, not
through the Hub: `crosscode.link/1` in `@crosscode/contracts` (`src/link.ts`), with each side
checking the other against the `linkedProducts` it has cached from the Hub.