> From *AT Protocol Spaces: A Field Guide* on atproto.how, revised 2026-11-23.
> Web page: https://atproto.how/atproto-spaces-field-guide/11-implementation-notes
> Index for agents: https://atproto.how/llms.txt · Text CC BY-SA 4.0, code samples MIT.

# Chapter 11 · Implementation notes

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.

> **If you’re building an app**
>
> If you build on an existing library, skim the trade-offs section. It explains behavior that can surprise app developers, such as why a captured request can be replayed to the same host until the credential expires. The rest of the chapter, including the conformance checklist, is for people building PDSes, space hosts, and libraries.

<a id="where-the-spec-leaves-a-choice"></a>

## 11.1 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.

| Choice | What the spec says | What atproto-crates does |
| --- | --- | --- |
| Check order | Unstated | Key and notify, hosted authority, active authority, `SpaceDeleted`, delegation token, attestation, policy |
| HTTP status of refusals | Unstated | `NotAuthorized`, `AppNotAuthorized`, `InvalidClientAttestation`, and `BlobNotFound` all return 400 |
| Managing app can’t answer | No error declared | 502 `UpstreamFailure`; the credential isn’t issued, and the registration is kept |
| Suspended authority | `RepoTakendown` or `RepoDeactivated` | Adds `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.

| Choice | What the spec says | What atproto-crates does |
| --- | --- | --- |
| Notify token | Opaque, at most 512 bytes, one per space and stable across authorizations | The client derives an HMAC-SHA256 of the space URI under an app secret and checks it statelessly |
| `confirmRegistration` challenge | A random challenge | 32 random bytes in hex, with 10 seconds to answer |
| Expiry and deletion notice retries | Backoff for at least 72 h | 1 m, 10 m, 1 h, 6 h, then every 12 h, with 50 to 100% jitter, for at least 72 h |
| Write and removal updates | Reasonable-effort delivery | Queued in the notify outbox; a failure that might clear is retried |
| `listRepoOps` with both `since` and `cursor` | Both parameters exist | Both 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\]

| Choice | What the spec says | What atproto-crates does |
| --- | --- | --- |
| Repeated DID in `putMembers` | Unstated | Last entry wins |
| `managingApp` validation | A `did#serviceId` string | An absolute `did:plc` or `did:web` with a fragment, checked on create, update, and import |
| Export by a restricted account | Taken-down accounts may export | Suspended and deactivated accounts may too |

<a id="passages-that-need-careful-reading"></a>

## 11.2 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).

<a id="design-trade-offs-worth-knowing"></a>

## 11.3 Design trade-offs worth knowing

<a id="no-proof-of-possession-at-authorization"></a>

### 11.3.1 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.

<a id="audience-replay-is-allowed"></a>

### 11.3.2 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.

<a id="notifications-are-unauthenticated-beyond-the-token"></a>

### 11.3.3 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.

<a id="compressed-versus-uncompressed-keys"></a>

### 11.3.4 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.

<a id="conformance-checklist"></a>

## 11.4 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
