AT Protocol spaces are in development. Expect changes throughout the beta starting on December 1st, 2026.

Chapter 11

Implementation notes

Revised 2026-11-23Markdown

The spec is firmly opinionated in some places and open-ended in others, so developers of space hosts, PDSes, applications, and tools have a lot of room in what they build and how. This chapter walks through the directions those choices can take and what each one implies, including its side effects, along with the passages that need careful reading and a checklist for your own conformance.

Where the spec leaves a choice#

These are the choices atproto-crates makes. Another conforming implementation may differ, so clients should not depend on them.

Reference

Authorization choices spec crates#

What happens inside authorizeSpaceSync when the spec doesn’t pin it down.

ChoiceWhat the spec saysWhat atproto-crates does
Check orderUnstatedKey and notify, hosted authority, active authority, SpaceDeleted, delegation token, attestation, policy
HTTP status of refusalsUnstatedNotAuthorized, AppNotAuthorized, InvalidClientAttestation, and BlobNotFound all return 400
Managing app can’t answerNo error declared502 UpstreamFailure; the credential isn’t issued, and the registration is kept
Suspended authorityRepoTakendown or RepoDeactivatedAdds RepoSuspended

RepoSuspended is there because repo-host reads already declare it. A client gets the same error for the same account state whichever host it asks.

Reference

Notification and sync choices spec crates#

How the space host talks to syncers.

ChoiceWhat the spec saysWhat atproto-crates does
Notify tokenOpaque, at most 512 bytes, one per space and stable across authorizationsThe client derives an HMAC-SHA256 of the space URI under an app secret and checks it statelessly
confirmRegistration challengeA random challenge32 random bytes in hex, with 10 seconds to answer
Expiry and deletion notice retriesBackoff for at least 72 h1 m, 10 m, 1 h, 6 h, then every 12 h, with 50 to 100% jitter, for at least 72 h
Write and removal updatesReasonable-effort deliveryQueued in the notify outbox; a failure that might clear is retried
listRepoOps with both since and cursorBoth parameters existBoth apply; a stale since returns the remaining ops and the commit

The retry schedule is front-loaded so a syncer that was briefly down hears about an expiry or deletion within the hour. After that it settles to every 12 hours, which keeps the 72-hour window to a handful of attempts. The jitter spreads retries out, so a syncer coming back from an outage isn’t hit by every space at once.

Reference

Membership and migration choices spec crates#

ChoiceWhat the spec saysWhat atproto-crates does
Repeated DID in putMembersUnstatedLast entry wins
managingApp validationA did#serviceId stringAn absolute did:plc or did:web with a fragment, checked on create, update, and import
Export by a restricted accountTaken-down accounts may exportSuspended and deactivated accounts may too

Passages that need careful reading#

The delegation token section says the token is "addressed (aud) to the space authority", but the normative example uses the space host’s service id, which for the family space is did:plc:ejjl2znzqp3ci25dqaslpkk2#atproto_pds. Use the service id, as client attestations also do.

The policy section says that after a policy migration "applications remain responsible for removing any writers", while memberspace says the authority should remove a removed member from the writer set. Hosts may prune differently on a policy change. A careful syncer re-reads listWriters after any policy change it learns of.

clearRecords clears the operation log along with the records. A syncer resuming from an old since gets no ops, and the commit it gets back has the empty digest, so its fold mismatches and it recovers with getRepo (or treats the repo as empty).

Design trade-offs worth knowing#

No proof of possession at authorization#

authorizeSpaceSync binds credentialKey without asking the caller to sign with it. Whoever holds a valid delegation token can bind a credential to a key of their choosing. Delegation tokens are single-use, last 60 seconds, and name one host, so the exposure is small, but treat one as a bearer secret for that minute and keep it out of logs.

Audience replay is allowed#

A credential signature covers only the credential and the audience, not the HTTP method or request path, so a captured request can be replayed to the same audience until the credential expires. That is deliberate. The design targets one threat, a repo host that received the credential replaying it to another host, and binding the signature to the audience is enough to stop it. Within one audience, TLS keeps a request from being captured in the first place, so covering the method and path would add nothing against that threat.

Notifications are unauthenticated beyond the token#

confirmRegistration and notifySpaceUpdate carry no service auth. A leaked token can only make a syncer check for updates unnecessarily, provided the syncer confirms everything with the repo host or space host and never drops data on a notice alone.

Compressed versus uncompressed keys#

DID documents and did:key carry compressed P-256 keys; HPKE’s enc and the derivation use uncompressed 65-byte encodings.

Conformance checklist#

  • LtHash: empty digest matches e5a00aa9...b183ad; add then remove returns to empty; order of adds doesn’t matter

  • Element bytes are exactly {collection}/{rkey}/{cid} with the CID as a string

  • HPKE secret export matches the export-only P-256 entry in the RFC 9180 test vectors

  • A new ephemeral KEM key for every request, retry, and page

  • Accept-Signature with the right profile tag on every credentialed getLatestCommit, getRepo, listRepoOps, and getRecord

  • MAC verified as hmac-sha256 over the sf-canonicalized covered header, and the header matched against the body

  • MAC failure triggers a DID refresh and a retry with a new key

  • Credential signature found by tag atproto-space-credential under any label, covering exactly ("authorization" "atproto-space-audience")

  • keyid checked against cnf.kid when present; extra parameters ignored

  • Verifiers accept high-S P-256 signatures

  • Audience is the repo DID for repo methods and the authority DID for host methods

  • Credentials capped at 60 minutes; revoked jti values held 60 minutes

  • listWriters entries branched on $type; #repoRemoved stops a repo being treated as part of the space

  • listRepoOps applied until a page has no cursor, then compared with that page’s commit

  • STAR reader refuses bad control bytes, missing end byte, trailing bytes, out-of-order keys, and size-limit breaches

  • confirmRegistration echoes the challenge only for a token issued for that space

  • notifySpaceUpdate matched on full $type, with unknown types ignored

  • #spaceDeleted triggers reauthorization; data is dropped only on a SpaceDeleted answer

  • A checkpoint older than 72 hours lists the whole writer set

  • UpstreamFailure treated as retryable, never as a refusal

  • Space-only syncers still consume #account and #identity firehose events

Chapter 11 of 11 · AT Protocol Spaces: A Field Guide

Search