Skip to main content

Module upgrade

Module upgrade 

Source
Expand description

The album-upgrade proposal client. Hand-written for one reason only: its request body is application/cbor, which spargen 0.5 cannot lower, so build.rs narrows the operation out of the generated client. The GET and DELETE on the same path are JSON and are generated — reach them through client::AuthenticatedClient. Proposing an album upgrade — the client half of the ceremony’s one server-side step (over the server’s album-upgrade wire).

Versioning — Album Upgrade Ceremony is a client ceremony carried on MLS application messages the server cannot read. Four of its steps are the server’s, and the first is the one this module drives: POST /v1/albums/{album_id}/upgrade hands the server a signed UpgradeIntent, which quiesces the album (a v_old client that never saw the proposal is precisely the party that will not stop writing on its own) and starts the deadline on the server’s own clock (so a skewed member clock can neither extend nor shorten the window).

Two rules shape this module, and both are the directory client’s rules for the same reason:

  • The signed bytes travel verbatim. intent_cbor is the canonical CBOR capsule_core::crypto::upgrade::SignedUpgradeIntent produced, and it is written to the body unchanged. Re-encoding it here would detach it from the signature the server checks against the proposing device’s DSK in the account’s published directory, and the failure would look like a forged proposal.
  • Nothing cryptographic happens here. The intent is built and signed in capsule-core; this module is the wire and its refusals.

§What is hand-written, and what would retire it

The request body is application/cbor, and spargen 0.5’s classify_media does not know that media type, so capsule-sdk/build.rs narrows the operation out of the generated client — the surface is narrowed, the document is never mutilated. Only the request is hand-written: the path, the media type, and the verbatim CBOR body. Every JSON document the operation answers with decodes into the generated types — the phase into crate::rest::types::UpgradePhaseResponse, every refusal into crate::rest::types::CodedProblem — so this module carries no second parser for a shape the contract already declares. ADR 0002 records the exception; teaching spargen the media type (issue #440) retires it, and nothing in this repository can.

The other two operations on this path — GET (read the phase) and DELETE (end the ceremony) — are plain JSON and are generated. Call them through crate::client::AuthenticatedClient; this module deliberately does not duplicate them.

Structs§

UpgradeClient
The album-upgrade proposal client. Borrows an authenticated Session, so every call rides the SDK’s bearer/refresh machinery and no token is handled here.
UpgradePhase
The ceremony an album is in, as the proposal answered it.

Enums§

UpgradeError
Everything a proposal can fail with. Callers switch on the typed variant, or on its stable error.* code, and never on a bare status.