Files
wanderbooks/crates/ledger-link/Cargo.toml
T
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

52 lines
1.9 KiB
TOML

[package]
name = "ledger-link"
version = "0.1.0"
edition.workspace = true
license.workspace = true
repository.workspace = true
publish.workspace = true
description = "wanderbooks: the app's side of the relay (plan P15 B3): its own name and key, the one outbound line, its own TLS and certificate, and the renewals."
[dependencies]
# The relay crate's `proto`, `names`, `mux` and `client` modules are the
# app's side of the protocol too; one definition of the wire, never a copy.
relay = { path = "../relay" }
futures = "0.3"
# The certificate authority's protocol (RFC 8555) and ARI (RFC 9773). No
# default features: `ring` is the crypto the rest of the tree uses (the
# default, aws-lc-rs, needs a C toolchain at build time).
instant-acme = { version = "0.8", default-features = false, features = ["ring", "hyper-rustls", "time", "x509-parser"] }
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "io-util", "sync", "net", "time"] }
tokio-rustls = { version = "0.26", default-features = false, features = ["ring", "tls12"] }
tokio-util = "0.7"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
base64 = "0.22"
ring = "0.17"
x509-parser = "0.18"
zeroize = "1"
webpki-root-certs = "1"
# Owner-only DACLs for the key and certificate files (the helper the token
# files use).
[target.'cfg(windows)'.dependencies]
ledger-store = { path = "../ledger-store" }
[dev-dependencies]
tempfile = "3"
rcgen = { version = "0.14", default-features = false, features = ["ring", "pem"] }
hickory-proto = { version = "0.26", default-features = false, features = ["std"] }
tokio = { version = "1", features = ["test-util"] }
http = "1"
http-body-util = "0.1"
bytes = "1"
async-trait = "0.1"
sha2 = "0.10"
time = "0.3"
tokio-rustls = { version = "0.26", default-features = false, features = ["ring", "tls12"] }
[lints]
workspace = true