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

chadtmiller.com/pds.js

An atproto PDS in JavaScript, for Cloudflare Workers and Node

0
0
main
45 lines · 2.5 KB Raw History

'@pdsjs/spaces': patch '@pdsjs/core': minor '@pdsjs/storage-sqlite': patch '@pdsjs/cloudflare': patch '@pdsjs/drive': patch

Spaces follow the reference's 0.0.0-spaces-alpha-20261022141228. Nothing of the old formats is accepted.

  • Credentials. getSpaceCredential takes {space, credentialKid, delegationToken?, clientAttestation?} and is not signed: credentialKid is the P-256 did:key the credential binds to. A space with a public read policy issues one without a delegation token; otherwise a request without one is answered SpaceNotFound. A deleted space is SpaceDeleted, and a token that does not verify or was spent is InvalidDelegationToken (400). A credential is presented as Authorization: Atproto-Space-Credential <jwt>, signed under the RFC 9421 label and tag atproto-space-credential with padded base64.
  • MACs instead of signatures. A commit is {ver, repo, space, rev, data} and carries no signature. getRecord, getRepo, getLatestCommit and listRepoOps answer an Atproto-Space-Want-Mac key share with an Atproto-Space-Mac header, under a secret derived from the account's #atproto_kem key; a credential read without one is BadSpaceMac. The responses vary on the request header and expose the MAC header across origins.
  • STAR. getRepo serves a STAR-lite v1 archive (application/octet-stream) and no longer takes excludeValues. A space record may be at most 1 MiB.
  • Records. A space record's {$link} is stored as a CID link and {$bytes} as a byte string, so its CID is the one other implementations compute. @pdsjs/core/repo gains cborDecodeLinks, jsonToLex, lexToJson and cborDecodeJson.
  • Notices. notifyWrite and listRepos carry data (was hash), and notifyWrite requires it and repoRev. Deleting a space owes every registered syncer a notifySpaceDeleted, stored and retried with backoff until it lands or the registration expires. The authority's own write into a space it has not created, or has deleted, is SpaceNotFound.
  • Identity. #atproto_space and #atproto_space_host are gone: tokens are signed by #atproto, and a delegation token is addressed to <authority>#atproto_pds.
  • Storage. SpaceStoragePort rows carry data (the column is renamed in place) and gain the deletion notice outbox: enqueueSpaceDeletedNotify, listDueSpaceDeletedNotify, rescheduleSpaceDeletedNotify, deleteSpaceDeletedNotify. createSpaceRoutes requires getKemKey.