Expand description
Capsule’s stateless core: pure functions over values — cryptography and the MLS authority, canonical CBOR, sidecar and CRDT logic, validation, media, LQIP, sharing and drop crypto, and ML orchestration.
It holds no connection, file handle or database, and reads no environment, clock or
filesystem: storage reaches it through ports such as ml::VectorIndex, and time and
identifier randomness through ambient::Clock and ambient::Rng, all of which callers
implement. Local state — the SQLite index, the on-disk library, the Workspace, import
execution, backup I/O and the hardware signers — lives in capsule-library; network state
lives in capsule-sdk. Two exceptions, each confined to one module:
- the OS CSPRNG behind
crypto::rng: key material must never come from an injectable, and therefore replaceable, source; catch_unwindinmedia::decode: a decoder panic on hostile input must become a typed error, not abort the caller.
cargo xtask architecture-check enforces the rest.
Modules§
- ambient
- The
ClockandRnga caller injects, and theIdSourcethat mints UUIDv7s from them. Always compiled: pure over its two traits, no native deps. The ambient inputs a caller injects: wall-clock time and identifier randomness. - backup
- The portable backup artifact and recovery mechanisms (SSoT: Backup and Recovery).
- cbor
- Canonical CBOR (RFC 8949 §4.2 deterministic encoding).
- client_
build - Client build identification — the
client_version/generated_by_clientgrammar and the build-embedded git commit. Always compiled: pure string formatting, no native deps. Client build identification — theclient_version/generated_by_clientgrammar. - cohort
- Device-cohort hash — the advisory session-grouping aid (SSoT: Authentication — Device Cohorts).
- constants
- content_
type - The file extension an original is named by for its sidecar
content_type— the one table the library’s adoption and a restore share. Always compiled: a pure string table. The file extension an original is named by for its sidecarcontent_type. - crypto
- Capsule’s cryptographic data plane.
- culling
- The client-side culling workflow engine (SSoT: Organization — Culling).
- derivative_
format - The closed set of still-derivative formats and the structural check over it — the tier
table’s format column as a type. Always compiled, and for the same reason
lqipis: the crates that receive aDerivativeManifest(capsule-server,capsule-wasm) build withdefault-features = false, so a check they cannot link is a check that never runs. Depends only oncrypto::provenance. The one public path to its items:mediadoes not re-export them. The closed set of committed still-derivative formats, and the structural check over it. - domain
- drop
- Web-upload guest drops — contract skeleton (SSoT: Web Upload).
- enrollment
- The wire form of the cross-device add ceremony (SSoT: Device Enrollment § Cross-Device Add): what each device advertises, the payloads they relay, and the safety code over them.
- exif
- federation
- Aggregated federated albums — the album-group view (SSoT: Federation — Federated Shared Albums and Organization — views).
- import
- The pure half of import: candidate grouping, special-file classification, the import scope,
default-album resolution and the upload policy. Scanning a directory, planning against the
index and executing an import are local state and live in
capsule-library’simportmodule, which re-exports everything here. - lqip
- LQIP — the chromahash placeholder carried in the signed sidecar’s
lqipfield. Always compiled, and deliberately so: the placeholder is produced by the import pipeline, read by the apps through the FFI crates, and read by the browser throughcapsule-wasm, so there is exactly one implementation and every surface links it.chromahashhas zero runtime dependencies and targetswasm32-unknown-unknown. The onenative-gated part islqip::sidecar, becausesidecaritself is. LQIP — the low-quality image placeholder carried in every asset’s signed sidecar. - media
- Still decode, orientation, metadata normalisation and derivative generation over
rawshift-image(mediafeature, implied bynative). Feature-gated rather thannative-gated so the codec stack is one manifest edit away from being dropped from a size-constrained build, and so thewasm32-unknown-unknownsealing surface provably does not link it. Seemedia. Still-image decode, orientation, metadata normalisation and derivative generation — the Capsule-side owner of the media pipeline. - metadata
- ml
- On-device ML orchestration and the model inventory seam (SSoT: AI/ML Integrations).
- notify
- Alert classes and their trigger predicates — the one shared decision function every platform evaluates instead of reimplementing the taxonomy (core half; SSoT: Notifications).
- sharing
- Share-link generation, encapsulation crypto, and the recipient-side
sharing::open_scopepath. Always compiled: it depends only oncbor+crypto, both of which targetwasm32-unknown-unknown, so the browser share viewer (viacapsule-wasm) can unwrap a link client-side. The native issuer (ShareLinkIssueroncapsule-library’sWorkspace) is not needed in the browser; only the pure crypto + recipient-open path is. Share links — link generation and capability validation (SSoT: Share Links). - sidecar
- validation
- Refuse-by-default validation invariants — the operational core of the threat model (SSoT: Threat Model — Validation Invariants).