Expand description
HTTP client for the Memstead registry (memstead.io).
Thin wrapper around reqwest::blocking that knows the two routes
the CLI consumes (POST /api/publish, GET /api/mem/...) plus
the typed error envelope (ApiError) the registry emits.
Structs§
- ApiError
Body - The decoded wire-level error shape the registry returns on any
non-2xx.
variantis present only forvalidation_failedresponses; other error kinds leave itNone. - Denylist
Response - Outcome of a successful
POST /api/admin/denylist. - Domain
Signature - A per-publish domain-authority signature, presented in request headers for a
<domain>:<handle>publish. The CLI builds this from the domain’s stored key (seecrate::auth::domain_key); the registry verifies it against the hosted proof manifest. - Publish
Response - Outcome of a successful
/api/publishPOST. - Unpublish
Response - Outcome of a successful
DELETE /api/mem/<scope>/<name>.
Enums§
Constants§
- ACCEPTED_
TERMS_ VERSION - The publisher-terms version the CLI accepts on publish. Running
memstead publishis a deliberate act, so the CLI accepts the current terms on the publisher’s behalf by sending this version. Must track the registry’sCURRENT_TERMS_VERSION; a mismatch surfaces as aterms_not_acceptedrefusal naming the version, telling the user to update. - DEFAULT_
REGISTRY - Default registry when no
--registry/MEMSTEAD_REGISTRYis set.
Functions§
- admin_
denylist - Admin-only: add a canonical-bytes SHA-256 to the content deny-list so those exact bytes can never be published. Refuses non-admins with 403.
- admin_
takedown - Admin-only takedown of a published mem: same
DELETEroute asunpublish, but with thex-memstead-takedownheader carrying the statement-of-reasons notice reference. The server selects the takedown path (deny-list the bytes, tombstone, burn the name) instead of an ordinary hard-delete, and refuses non-admins with 403. - build_
http - Shared HTTP client. 30 s timeout is comfortable for the 2 MB cap times a slow upstream — GitHub API is also cheap to tolerate.
- download_
mem - GET a sealed
.memarchive from the registry, streaming intodest_path. Returns the number of bytes written. - parse_
ref - Parse a registry ref
<scope>/<name>in one of the three scope forms (github:<handle>/<name>,<domain>:<handle>/<name>, or a bare<handle>/<name>). The legacy@scope/namesyntax is rejected by the caller before this is reached. ReturnsNonefor anything that is not a valid registry ref (e.g. a local file path), soinstallcan fall back to a local install. - publish
- POST a sealed
.memarchive to/api/publish. Returns the parsed success body or a typedApiErrorBodyon any non-2xx. - registry_
base - Resolve the registry base URL in priority order: CLI flag →
MEMSTEAD_REGISTRYenv →DEFAULT_REGISTRY. Trailing slashes are stripped so callers can unconditionally append route segments. - registry_
host - Extract the hostname for credentials keying. Falls back to the full URL on parse failure so nothing silently collides.
- unpublish
- DELETE a mem from the registry. Same auth + error envelope as
publish, so reuse
PublishErrorfor the failure shape.