diff --git a/doc/2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison/2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison.md b/doc/2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison/2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison.md new file mode 100644 index 000000000..31a1a82b4 --- /dev/null +++ b/doc/2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison/2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison.md @@ -0,0 +1,543 @@ +# Auth + transport investigation: comparison and recommendation + +Lane SYNTHESIS, 2026-11-23, for the capability-auth + p2p-transport +investigation (tracking issue +[developing-today/code#13779](https://github.com/developing-today/code/issues/13779)). +Built entirely from the five research notes in +`~/workspace/p2panda-investigation/research/` (`p2panda.md`, +`keyhive-subduction.md`, `willow-meadowcap.md`, `ocap-family.md`, +`capnp-and-survey.md`), each written from primary sources; load-bearing +claims below trace to those notes and their citations. + +**Executive summary.** The leaning "p2panda for everything" is right about +the data plane and wrong about the auth layer — and p2panda's own +documentation says so: p2panda-auth is a replicated group-membership state +machine, not a capability system, and the project names Meadowcap and UCAN +as the capability systems you compose in for delegated access. No candidate +in the field — named families or the wider survey — provides identity + +capabilities + sync + storage in one system; every credible stack is a +composition. The recommended default (§6) is therefore a composition: +p2panda's data plane, Meadowcap-as-spec authorisation for replicated data +with broker-run short-window renewal, and Biscuit tokens + capnp-over-iroh +for live sessions — with Keyline (Keyhive's auth model) adopted as the +reference design for revocation semantics and re-evaluated as code when +its disclosed gaps close. + +--- + +## 1. The matrix + +One row per family **layer** — several "families" are stacks whose layers +score very differently, and averaging them would hide exactly the facts +this decision turns on. Cells are deliberately terse; the notes carry the +evidence. + +### 1.1 Named families, by layer + +| Layer | Capability model | Revocation | Groups | Encryption | Sync model | Rust maturity | Cloudflare fit | SQLite/Turso fit | iroh fit | Production readiness | +|---|---|---|---|---|---|---|---|---|---|---| +| **p2panda core + sync + net** (data/transport plane) | None — auth is separate crates | n/a | Topics only | Channel only (iroh QUIC/TLS 1.3) | Single-writer logs; LogSync height-vector exact set difference; offline-first | Native; 0.8.1; lower layers ~2 yrs published | None (native only, no WASM) | SQLite yes (SQLx); **Turso no** | **Native — it *is* an iroh app** | Pre-1.0; breaking changes per minor; wire format evolving | +| **p2panda-auth** | Group-membership CRDT; 4 levels Pull/` URIs) and the short-TTL, + auto-rotation policy (~1 h) now: a house CA issuing short-lived + X.509 with a URI SAN, plus the existing OIDC provider issuing JWTs + with the same URI as `sub`, already *is* an SVID system in substance. + Deploy SPIRE itself only when external interop (Istio/Envoy, cloud + workload-identity federation) or attestation becomes concrete. + Name the genuine gap honestly: **attestation** — minting identity + from observed evidence (kernel/platform selectors) with no stored + secret — is the one identity capability the house stack lacks, and + neither p2panda nor any candidate in this investigation supplies it + either. + +--- + +## 5. Decision points that remain Drew's + +Stated as choices with consequences. The evidence narrows these; it +cannot settle them, because each turns on risk appetite, sequencing, or +how much machinery the estate wants to own. + +1. **Revocation posture for replicated data.** (a) *Short windows + + broker renewal* (composition A): revocation latency is bounded and + predictable, but authority depends on a live renewal path — a + partitioned seat keeps its window. (b) *Coordination-free permanent + revocation* (composition B): revocation survives any merge, forever, + offline — at the price of owning the engine and its folklore. + (c) *Accept p2panda-auth as-is*: least new machinery; revocation is + eventual and retroactive, and delegated/scoped grants stay + unexpressible. This choice decides how a compromised seat's authority + actually dies across the estate. +2. **How much security-critical code the estate owns.** Adopt pre-1.0 + upstream code (p2panda spaces/DCGKA; Keyhive with G1/G2 open), + implement a Final spec in-house (Meadowcap), implement a design-doc + model in-house (Keyline), or buy boring maturity (Biscuit, capnp + Level 1). Each option trades audit surface, upstream bus factor, and + schedule differently; no measurement in the notes prices that trade. +3. **E2EE ambition for replicated fleet/atlas data.** Ship on unaudited + DCGKA now; wait for an audit or BeeKEM's maturation; or keep + replicated data channel-encrypted only (iroh/TLS) and skip the + data-layer E2EE entirely. Consequences either way: membership + metadata is exposed until control-message encryption lands, and + harvest-now-decrypt-later exposure stands until a post-quantum story + exists. What the data *is* decides how much this matters, and that + valuation is Drew's. +4. **Identity binding, and the curve question.** Bind author/NodeId keys + to the fleet CA / IdP CA (certificates attesting key ownership — a + bridge the estate builds; no candidate consumes X.509), or run + raw-key identity with the CA as a parallel system indefinitely. + Entangled with it: Ed25519 everywhere (the p2p/iroh/UCAN world's + native curve) vs the interim IdP CA's P-384 (spec-legal for + Meadowcap, excluded from UCAN's suite, unsupported by Biscuit). + The curve chosen for the token layer constrains which token layers + exist. +5. **Whether any domain earns the Willow data model.** Mutable, named + state with traceless deletion fits infrastructure state (registries, + configs, seat state) arguably better than append-only logs — but + adopting Willow anywhere means a second data plane and a + house-written Rust sync, because none exists. Whether a domain's + mutability needs justify that is a product call, not an evidence + call. +6. **Turso convergence.** Accept per-node SQLite beside the Turso + stores (p2panda's shipped shape; two replication stories for fleet + data), or fund a libsql backend for p2panda-store as estate-owned + code with an upstream-shaped maintenance tail. +7. **Upstream engagement posture.** Every serious candidate is a tiny, + grant-funded team (p2panda: three people; worm-blossom: two; Ink & + Switch: a handful). Depending on their roadmaps without funding, + contributing, or forking is itself a choice; so is the opposite. + (One hard fact for this item: the OCapN project prohibits + AI-generated contributions to its specs and tooling by policy — any + engagement there is human-authored only.) + +--- + +## 6. Recommended default + +**RECOMMENDATION** (Archer's, under the standing decision posture; +recorded here for ratification or override): + +> **Adopt composition A + C now; hold B as the tracked design north +> star.** +> +> - **Data plane:** p2panda core/sync/net/store — the leaning was right +> here; it is the iroh-native, Rust, SQLite, offline-first stack the +> estate already chose the transport half of. +> - **Authorisation for replicated data:** Meadowcap **as a +> specification**, bound to p2panda via header extensions, with the +> broker running short-window renewal; p2panda-auth kept as the +> membership layer it actually is; p2panda-encryption used with its +> unaudited status explicit (decision point 3 governs how far). +> - **Live sessions:** Biscuit tokens for session establishment + +> capnp-over-iroh Level 1 facets with interposition revocation +> (composition C), serving the Actions-exec and coordinator surfaces +> already in flight. +> - **Design reference:** Keyline's model is adopted as the estate's +> reference semantics for revocation and relay power — the standard +> our own mechanisms are judged against — without adopting Keyhive's +> code while G1/G2 stand. + +**Reasoning, in one paragraph.** The estate's centre of gravity is a +broker with frequently-checking-in seats, replicated operational state, +Cloudflare doors, and a growing live-session surface. A is the only +composition whose capability layer is a Final spec designed to be +borrowed, whose revocation weakness (no revocation, only non-renewal) +is precisely the one this estate can patch cheaply because its seats +already check in. B has strictly better revocation semantics but exists +as pre-alpha code carrying a disclosed revocation bypass in its key +seating path; adopting its *model* now and its *code* later captures the +ideas without betting the estate on them. C is not optional garnish: +the live-session surfaces are being built this month, and neither A nor +B says anything about them. p2panda-for-everything, by contrast, asks +the weakest layers of a pre-1.0 stack (auth, encryption integration) to +carry the estate's most security-critical weight, against the project's +own documentation. + +**What evidence would change this recommendation.** + +- **Keyhive closes G1/G2** and the ciphersuite construction gets its + independent review (or a full audit lands): composition B's *code* + becomes adoptable, and Keyline-as-code likely displaces + Meadowcap-as-spec — better revocation, native Relay, one auth system + instead of two. +- **p2panda reaches 1.0** with wire-format stability, an encryption + audit, and encrypted control messages: the data-plane bet strengthens + materially, and if its capability story grows teeth in the process, + the auth composition re-opens. +- **A conformant UCAN 1.0 Rust implementation** (working-group or + third-party) reaches stability: UCAN likely displaces Biscuit in C + (invocation separation; `did:key` identity) and pressures Meadowcap + in A. +- **Willow's Confidential Sync unpauses** and a maintained Rust sync + implementation appears (or iroh-willow is ported to current iroh): + the data-plane question re-opens for mutable-state domains + (decision point 5). +- **BeeKEM's paper survives peer review** and a second implementation + appears: the group-key layer decision re-opens independently of the + auth decision. +- **OCapN freezes a 1.0 wire version** and a real Rust implementation + reaches test-suite parity: the live-session layer could standardise + on OCapN CapTP instead of capnp Level 1. (Near-term probability, per + the ocap note's evidence: low.) + +--- + +*Sources: the five research notes in `research/` are the evidence base; +every load-bearing claim above traces to a claim in those notes and its +primary-source citation. This document is the investigation's synthesis +deliverable under the master prompt in +`p2panda-program-investigation-prompt.md`.* diff --git a/doc/README.md b/doc/README.md index f6bd514da..dc799613d 100755 --- a/doc/README.md +++ b/doc/README.md @@ -35,6 +35,7 @@ This list is the workflow's request catalog (`request_catalog` in [`.agents/rese Folders are named `__`. The kinds in use are `feature`, `design`, `architecture`, `phase`, `fix`, `reference` and `research`. Run `ls doc/` to list them all. Some starting points: - [Modes and configuration surface](2026-11-23T20-56-52Z_design_id9111_modes_config_surface/2026-11-23T20-56-52Z_design_id9111_modes_config_surface.md) — design record for #9111 (§7 of #9106): the config schema for modes, link kinds, storages and tiering (behaviour as config, mechanism as primitives), the peer/trust and namespace knobs in one schema, the #9144 fan-out keys with defaults and the `max_hops` ceiling of 8, file format and merge rules with fail-closed trust sections, open questions with chosen defaults, and implementation issues named but not filed. +- [Capability auth + p2p transport comparison](2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison/2026-11-23T21-39-17Z_design_p2p-auth-transport-comparison.md) — synthesis record for #13779 (2026-11-23): the layer-by-layer matrix across p2panda (core/auth/encryption), Keyhive (Keyline/BeeKEM) + Subduction, Willow/Meadowcap, the ocap family (CapTP/Endo/Goblins/Agoric), Cap'n Proto/Cap'n Web, UCAN and Biscuit; the verdict that "p2panda for everything" holds for the data plane and fails for auth by p2panda's own documentation; three compositions (Meadowcap-as-spec with broker short-window renewal, the Keyline model adopted as design, Biscuit + capnp-over-iroh for live sessions); ideas to borrow regardless (interposition revocation, petnames, handoff certificates, ATProto key-split recovery, SPIFFE discipline); and the recommended default with the evidence that would change it. - [Fleet transport & pooling design](2026-11-23T21-10-36Z_design_fleet-transport-pooling/2026-11-23T21-10-36Z_design_fleet-transport-pooling.md) — design record for #13752 (Drew, 2026-11-23): choosing hosts and reaching them without Tailscale (the #2179 machine registry extended with transport offers, the queue broker as live overlay, commander-pattern public doors, DNS cold start), direct iroh for non-Muse agents (NodeId identity, relay rendezvous + hole punching, self-hosted relay/pkarr; why #1967's Go answer inverts for the Rust fleet binary), and a generic pool primitive (scope-keyed walls, failure-to-serve attempt semantics, strategy plug-ins, probe recovery) under model pools, route forms, host selection and placement. - [Identity, login & delegation — parent synthesis](2026-11-23T20-55-00Z_design_id5684_identity_login_synthesis/2026-11-23T20-55-00Z_design_id5684_identity_login_synthesis.md) — synthesis record for #5684 over the seven closed child designs #5884–#5890: the settled custody model (native keypair ID, variants (a) service-held / (b) user-held / (c) 10 security codes / (d) pseudo-login delegation), the #5885 feasibility matrix, the signed-hash construction, per-variant plain-language sign/lock-out/recover statements, the seven flows mapped end-to-end, three cross-record reconciliations (a→b migration is rotation; one genesis artefact; codes rotate rather than unwrap), consistency with #6379's group-delegation threat model, and the implementation programme. - [ID groups: legacy wire forms and their migration path](2026-11-23T17-52-00Z_design_id6379_legacy_group_wire_forms/2026-11-23T17-52-00Z_design_id6379_legacy_group_wire_forms.md) — design record for #13533 (finding F6 of #6379): the complete read-compat surface of the groups event wire — the legacy Remove successor form and its deterministic mode mapping, the group-wide delegation preference, and the remove_policy absent-field default — each with its modern replacement and a disposition (removal condition or retained-with-reason), and the silent cascade default stated as a decision.