~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Spaces foundation: KEM keys, the pds-space crate, and a harness against the spaces alpha

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:spacesf-h

The foundation for atproto Spaces, the non-public data extension now in alpha, with the beta targeted for Dec 1. Later slices build the space repo, credentials, policies, sync and migration on top of it.

Spec

  • spec/SPACES.md (new), the entry page for spaces:
    • addressing and the space-ref format;
    • the roles, and what this server is in each;
    • the keys;
    • each building block, specified exactly enough to build from: the KEM shared secret (RFC 9180 DHKEM(P-256)), LtHash and the space commit, commit and record MACs, the HTTP Message Signature that credentials use, and STAR with the atproto-space-repo profile.
  • Vendored in spec/spaces/, with sources and licences in its README: proposal 0016 at fcad6b9388, the DASL STAR spec, RFC 9421, RFC 9180, and com.atproto.space.defs.
  • Vectors: spec/interop/spaces/*.json, 140 cases, each certified both against the alpha's own @atproto/space and against harness code written from the spec page alone; plus STAR's published fixtures in spec/interop/star/.
  • Changes to existing pages: every account gets an #atproto_kem P-256 key at creation, in its PLC genesis operation and in getRecommendedDidCredentials (ACCOUNTS.md, IDENTITY.md, DURABILITY.md). describeServer answers spacesAlpha: true. There is no backfill: no data of this server predates the key.

Server

  • New crate pds-space, pure, with no I/O: keys and KEM, LtHash, commits and MACs, the signature base and verification, an RFC 9651 dictionary parser, and a STAR reader and writer with the repo profile. Its tests run every vector file, and a guard test fails if a vector file has no test.
  • Accounts: the KEM key is stored with the account's keys in the same log frame, added to the genesis operation, carried unchanged through handle updates, and returned in getRecommendedDidCredentials.

Harness: two references

  • latest stays the reference for everything already built. Those runs now hold the KEM results to the spec: the server's genesis operation must carry a valid atproto_kem, and its credentials must name it. Only side-against-side comparisons take the key out.
  • New harness/spaces/: pinned to alpha 0.0.0-spaces-alpha-20261105160032 (pin-alpha.sh re-pins). It checks every vector against the alpha's libraries, then starts the alpha's PLC and PDS with our server on that PLC. It compares describeServer, createAccount, the genesis operation, the DID document, getRecommendedDidCredentials, updateHandle, and a restart. The alpha is held to every check too.
  • Gates and CI: the spaces run is in gates.mjs and in the workflow (npm ci in harness/spaces).

The checks bite: on main, the latest runs stop at the genesis operation (no atproto_kem), and the spaces run stops at describeServer (no spacesAlpha).

Checked: just gates: all 16 runs pass, the spaces run included, plus conformance and every crate's tests.

🤖 Generated with Claude Code

Approved

This adds each account's P-256 #atproto_kem key and the pure pds-space crate. The crate holds the KEM shared secret, LtHash, commit and record MACs, the HTTP Message Signature check, an RFC 9651 parser, and STAR with the repo profile. It also adds spec/SPACES.md, the vectors, and a harness run against the pinned spaces alpha.

What I checked against .knotless/review.md:

  • Spec and code agree. ACCOUNTS.md, IDENTITY.md, DURABILITY.md and PDS.md all describe the new KEM key, its place in the genesis operation, and spacesAlpha. The code does what they say. The key is stored in the same account log frame. A handle update carries verificationMethods through unchanged. An account with no KEM key still loads without one. The README says only what is built, in its Known gaps.
  • Harness is held to the spec, not loosened. On the latest runs the KEM key is taken out of the comparison only after it is checked separately. The genesis operation must carry a valid P-256 key that differs from the signing key. getRecommendedDidCredentials must name that same key. describeServer must answer spacesAlpha: true. The DID document is still held whole to the directory's.
  • The spaces run holds the alpha to every check too, which checks the checks.
  • No forbidden crate or source. The new dependencies are blake3 and p256, neither an atproto or MCP crate. In the crate sources I read, nothing is taken from the SDK.
  • Conformance. harness/conformance.yaml is not changed.

One small point, not blocking. spec/SPACES.md has a list of later parts ("These are filled in by later parts…", "Not checked yet…"), which reads as a plan. AGENTS.md asks the spec to say what is, not what is planned. Trimming it to what the page covers would match that.

Files I did not read in full: the vendored spec/spaces/* (the RFC texts, proposal.md, star.md, the licences, defs.json), spec/interop/star/*, harness/spaces/package-lock.json, harness/spaces/lib/spec.mjs, the spec/interop/spaces/*.json vectors, crates/pds-space/src/sf.rs, and crates/pds-space/tests/vectors.rs. I did not run the checks.

spec/SPACES.mdlines 46 to 56
Only the building blocks below are built so far. These are filled in by
later parts, each on a page or section of its own, and are not served yet:
- the space repo: the `com.atproto.space` record writes and reads, its
commit and operation log;
- full-state sync: a repo as a STAR archive (`getRepo`), blobs, and
importing a repo;
- credentials: delegation tokens, space credentials, revocation;
- write notifications, the writer set, registration and deletion notices;
- policies and the space lifecycle: creating, updating and deleting
spaces, and member lists.
review.knotless.dev

This is a roadmap of later parts. The spec is meant to say what is, so consider cutting it to what the page covers now.

Merged as d0530dd