Skip to main content

Module xrpc

Module xrpc 

Source
Expand description

com.atproto.* XRPC server surface — MVP public-read slice (#1112).

HTTP XRPC endpoints served from the same Axum surface that hosts OAuth and /.well-known/atproto-did (see super::did_document). hyprstream-pds remains deliberately no-networking: this module is the serving layer that calls its data functions (Commit/MST/car::build_record_proof_car).

§Endpoints

MethodPath (under /xrpc/)Notes
GETcom.atproto.identity.resolveHandlehandle→DID
GETcom.atproto.repo.describeRepoDID/handle + commit head + didDoc
GETcom.atproto.repo.getRecordrecord JSON (optional cid pinning)
GETcom.atproto.sync.getRepofull-repo CARv1 export (lazy stream)
GETcom.atproto.server.describeServerserver DID and account-domain policy
GETcom.atproto.server.getServiceAuthprotected hosted-account service JWT

createSession remains out of scope. Password / app-password verification and credential minting require the account authority contract. getSession is available only when an explicit native session resolver is installed and is protected by the existing bearer/DPoP middleware.

§Feature gate

Routes are mounted only when OAuthConfig::xrpc_read_slice is true (defaults to false). The in-process XrpcRepoStore starts empty; the write path (#910) populates it with RepoSnapshots whose [public] flag is true. Only public snapshots are served by these endpoints.

§Out of scope

  • com.atproto.sync.subscribeRepos (firehose) — issue #1112 defers it.
  • Write path (repo.createRecord etc.) — sequenced with #910.
  • createSession — sequenced with the account credential contract (#1113/#948).

Modules§

errors

Structs§

AtprotoSessionInfo
Native account authority’s answer for an authenticated getSession query. The resolver owns handle, DID-document and account lifecycle truth; this adapter never derives a handle from an unverified DID string.
RepoSnapshot
An in-memory snapshot of one repo’s signed state — enough to answer the public read slice (describeRepo / getRecord / sync.getRepo).
XrpcRepoStore
In-process registry of hosted repos, keyed by DID.

Constants§

GET_REPO_CONCURRENCY
Maximum number of concurrent sync.getRepo (full-CAR export) requests. Each request streams the entire repo; bounding concurrency prevents memory/CPU exhaustion from parallel full-repo exports.
GET_SERVICE_AUTH_PATH
Protected hosted-PDS service-auth endpoint from the ATProto server lexicon.
HOSTED_COLLECTION
ai.hyprstream.model is the only collection this PDS hosts today.

Traits§

AtprotoSessionResolver
Explicit native authority seam for standard getSession.

Functions§

create_record
com.atproto.repo.createRecord for the first native-authorized public posting slice. The route is deliberately opt-in: OAuthState must carry a PublicRepoWriter, and the normal bearer/DPoP middleware must have inserted AuthenticatedUser before this handler runs.
describe_repo
describe_server
Return the standard server capability and account-domain description.
get_record
get_repo
get_service_auth
Mint a short-lived, method-bound ATProto service JWT using the hosted account’s persisted #atproto key.
get_session
Return the current authenticated ATProto session from the native account authority. The bearer/DPoP middleware authenticates the request; this handler revalidates the token and scope before consulting the resolver.
public_canary_get_record
public_canary_routes
The one-record public read when the broader hosted-account XRPC slice is disabled. No other XRPC route or hosted-account record becomes reachable.
resolve_handle
xrpc_error
xrpc_error_body
xrpc_routes
The five XRPC read-slice route declarations, as a sub-Router parameterised over Arc<OAuthState>. This is the single source of truth for the XRPC route table — oauth::create_app merges it conditionally on xrpc_read_slice, and tests mount it directly. Changing the URI or handler here changes both.
xrpc_session_routes
Protected standard session read route. It is mounted only when an authority-provided AtprotoSessionResolver is installed.
xrpc_write_routes
Protected standard repository write routes. These are mounted only when a public writer is explicitly installed in OAuthState; the default remains read-only until account/session authorization is configured.