Skip to main content

ensure_album

Function ensure_album 

Source
pub async fn ensure_album(
    client: &AlbumClient,
    album_id: Uuid,
) -> Result<ProvisionedAlbum, AlbumError>
Expand description

Register album_id with the server before any blob session opens for it.

The album’s id is derived from the account master key, so the client knows it and the server does not. Invariant 6 refuses an upload whose album does not exist or is not writable by the caller, so without this step a real push cannot land a single byte — the ladder below would open its first session straight into error.upload.album_access_denied.

Idempotent, and relied upon to be. Provisioning an album the caller already owns is a success that writes nothing, so this runs unconditionally on every push: there is no client-side “already registered” flag to keep in sync across devices, which is exactly what deriving the id from the master key buys. Pushing twice therefore cannot fail here.

No album name crosses the wire — album titles live in the encrypted sidecar.