Skip to main content

Module directory

Module directory 

Source
Expand description

Publishing and fetching the signed device directory (over the server’s directory surface).

The directory is the user-IK-signed list of enrolled device signing keys that verify_asset resolves a manifest’s created_by_device against. Until a device’s entry is published, every asset it signs is RejectReason::UnknownDevice to every other device — which is why first-device enrollment publishes before it uploads anything.

Two rules shape this module:

  • The bytes are opaque and travel verbatim. The server projects exactly one field out of the document — directory_version, for the invariant-23 monotonicity check — and stores the rest byte-for-byte. Re-encoding the document here would detach it from the signature it carries, so the canonical CBOR capsule-core produced is what goes on the wire and what comes back off it.

  • A fetched directory is not trusted until it verifies. DirectoryClient::fetch requires the pinned user identity key and refuses a document that does not verify under it, so a server cannot hand a client a directory listing devices the user never enrolled. The signature check itself is capsule-core’s (DeviceDirectory::verify); nothing cryptographic is re-implemented here.

  • A publish names the key it is signed under. The document carries the user identity key’s signature but not the key, so DirectoryClient::publish sends the verifying key beside it, base64 in X-Capsule-Identity-Key. The server anchors that key on first publish, refuses any other thereafter, and refuses a document that does not verify under it — invariant 23’s second clause. Without the header every publish is a 400.

Hand-written rather than generated: the committed OpenAPI declares no request body for the publish operation, so the generated client’s publish_device_directory() takes none. The wire below is the documented one (application/cbor plus the identity-key header in, {directory_version} out).

Structs§

DirectoryClient
The device-directory client. Borrows an authenticated Session, so every call rides the SDK’s bearer/refresh machinery and no token is handled here.

Enums§

DirectoryError
Everything the device-directory flows can fail with. Callers switch on the typed variant (or its stable error.* code), never on a bare status.