Files
wanderbooks/crates
swaitsandClaude Fable 5.2 9898e56950 feat(link): the app's side of the relay: identity, line, TLS at the app, certificates (P15 B3)
The app keeps one durable address https://<secret>.<four-words>.wanderbooks.link:
an Ed25519 key, a four-word name the app picks, and a 32-character base-36 secret
label (about 165 bits), all in private (0600 / owner-only) files in the data
root's link/ folder. One name per installation, as plan section 5 says; each
company is a path under it.

The line (yamux over TLS 1.3, the relay crate's own client) runs in the app's own
process, not in the books server child: a window that dies takes its sockets with
it, so the line can never keep a door open for books that closed. It reconnects
with full-jitter backoff, pings every 30 s (the relay drops a line silent for
180 s), re-dials at once after a wall-clock jump (a sleep), and says in words
what is wrong: no internet, the relay down, a busy relay, a wrong clock, a name
the relay lost.

TLS ends in the app with its own certificate (rustls, ALPN h2 and http/1.1),
served only for the app's exact host name, then the plain stream goes to the
remote door on 127.0.0.1 after the door's per-start secret and the relay's PROXY
header. The private keys are never sent to the relay.

Certificates are ordered by ACME DNS-01 (instant-acme, behind an Issuer trait so
tests use an in-process authority) for the wildcard under the app's name, from
the relay's authority list in its order (a not-usable one is skipped, a failing
one falls to the next), stored, reused across restarts, and renewed at the time
the authority's renewal information suggests, else two thirds through the life.

New dependencies: instant-acme 0.8 (Apache-2.0; ring, hyper-rustls, time and
x509-parser features, no aws-lc-rs), x509-parser 0.18 and webpki-root-certs 1
(already in the tree), time and async-trait for tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:57:51 -07:00
..