capsule_sdk/federation.rs
1//! [`FederationPull`] — a peer server pulling one shared album from its home server.
2//!
3//! # There is no federation protocol to speak
4//!
5//! design/federation.md introduces **no new data protocol**: a peer pulls through exactly the
6//! primitives a client pulls through, `GET /v1/sync?album_id=` and `GET /v1/blob/{hash}`, with a
7//! capability token in the `Authorization: Bearer` slot instead of a session access token. So
8//! this module is *orchestration over generated calls* and contains no parser: the page comes
9//! back through [`SyncConsumer::pull_album`], the bytes through the generated `get_blob` fed
10//! into the same self-verifying [`RangedFetcher`](crate::fetch::RangedFetcher) every download
11//! uses, and the lifecycle calls are the generated `refresh_capability` and `revoked_jti`.
12//!
13//! # The pull is gated on a fresh revocation list, and fails closed
14//!
15//! A capability is a bearer token: the only thing that can take one back before it expires is
16//! the home server's published list at `/.well-known/capsule/revoked-jti`. So a puller does not
17//! present a token it has not recently checked. [`FederationPull`] refreshes its snapshot when
18//! the one it holds is older than the list's own `max_staleness_seconds`, refuses to pull when
19//! the snapshot cannot be refreshed past that bound ([`FederationError::ListStale`]), and
20//! refuses immediately when the token's `jti` is on the list
21//! ([`FederationError::Revoked`]) — the same fail-closed rule the server-side verifier applies.
22//!
23//! Nothing here caches a decision it could re-derive: the snapshot is the list as published,
24//! and the answer is recomputed from it on every call.
25//!
26//! # Refresh replaces the credential in place
27//!
28//! `POST /v1/federation/capabilities/refresh` presents the *previous* capability and answers the
29//! successor; the predecessor is revoked as the successor is issued, so a puller that kept using
30//! it would refuse itself on the next poll. [`FederationPull::refresh`] therefore swaps the held
31//! token, its `jti` and both clients over together, under one lock.
32//!
33//! # Every presentation is signed by the puller
34//!
35//! A capability alone is a bearer token, so the home server admits one only with an
36//! `X-Capsule-Request-Signature` made by the peer its `sub` names, over the request's method,
37//! path and the token itself (design/federation.md, "Request Signatures"). The puller's
38//! operational key signs through a [`RequestSigner`] it is handed rather than one this crate
39//! holds: the key is the peer server's, and where it lives (memory, a file, an HSM) is the
40//! server's business. Every request is signed afresh — a new nonce, the current time — retries
41//! included, because the home server accepts each signature once.
42
43use std::sync::{Arc, RwLock};
44use std::time::{Duration, Instant};
45
46use base64::Engine as _;
47use base64::engine::general_purpose::URL_SAFE_NO_PAD as BASE64URL;
48use serde::Serialize;
49use tracing::instrument;
50
51use crate::fetch::{BlobSource, RangeOutcome};
52use crate::sync::{SyncConsumer, SyncCursor, SyncError, SyncPage};
53use crate::{net, rest};
54
55/// The domain separator a request signature's claim opens with (design/federation.md).
56pub const REQUEST_CONTEXT: &str = "capsule-federation-request-v1";
57
58/// The path the capability refresh is signed over: the operation's own, whatever prefix the
59/// base URL has (design/federation.md, `path`).
60const REFRESH_PATH: &str = "/v1/federation/capabilities/refresh";
61
62/// What signs a puller's capability presentations: its operational Ed25519 key, the one the
63/// home server's operator pinned for it.
64pub trait RequestSigner: Send + Sync {
65 /// The Ed25519 signature over `message`.
66 fn sign(&self, message: &[u8]) -> [u8; 64];
67}
68
69/// The map a request signature covers, encoded as canonical CBOR.
70///
71/// The server holds its own copy of this shape; both pin the same vector
72/// (`tests::the_signing_bytes_match_the_servers_vector`), so neither can drift alone.
73#[derive(Serialize)]
74struct RequestClaim<'a> {
75 context: &'a str,
76 method: &'a str,
77 path: &'a str,
78 token_sha256: String,
79 signed_at: i64,
80 nonce: &'a str,
81}
82
83/// The `X-Capsule-Request-Signature` for presenting `token` on `method path`, now, with a fresh
84/// nonce.
85///
86/// # Errors
87///
88/// A description when the claim does not encode, which nothing a caller passes can cause.
89pub(crate) fn request_signature(
90 signer: &dyn RequestSigner,
91 method: &str,
92 path: &str,
93 token: &str,
94) -> Result<String, String> {
95 // A UUIDv7's sixteen bytes: unique per call, and the instant it carries is already in `t`.
96 let nonce = BASE64URL.encode(uuid::Uuid::now_v7().as_bytes());
97 signature_header(
98 signer,
99 method,
100 path,
101 token,
102 jiff::Timestamp::now().as_second(),
103 &nonce,
104 )
105}
106
107/// The header value for one request, at `signed_at` with `nonce`.
108fn signature_header(
109 signer: &dyn RequestSigner,
110 method: &str,
111 path: &str,
112 token: &str,
113 signed_at: i64,
114 nonce: &str,
115) -> Result<String, String> {
116 let method = method.to_ascii_uppercase();
117 let claim = RequestClaim {
118 context: REQUEST_CONTEXT,
119 method: &method,
120 path,
121 token_sha256: capsule_core::crypto::hash::hash_bytes(token.as_bytes()).to_hex(),
122 signed_at,
123 nonce,
124 };
125 let bytes = capsule_core::cbor::to_canonical_vec(&claim).map_err(|error| error.to_string())?;
126 let signature = signer.sign(&bytes);
127 Ok(format!(
128 "t={signed_at}, n={nonce}, s={}",
129 BASE64URL.encode(signature)
130 ))
131}
132
133/// Why a federated pull could not proceed.
134#[derive(Debug, thiserror::Error)]
135pub enum FederationError {
136 /// The capability's `jti` is on the home server's published revocation list.
137 ///
138 /// Terminal for this token. The peer asks the album's owner for a fresh grant, or stops.
139 #[error("this capability has been revoked by its issuer")]
140 Revoked,
141 /// The revocation list could not be refreshed inside its own staleness bound.
142 ///
143 /// **Not** a reason to keep pulling: a list a peer cannot refresh is a list that may have
144 /// revoked this token, and honouring the token anyway is exactly the failure the bound
145 /// exists to prevent.
146 #[error("the revocation list is staler than its own bound allows")]
147 ListStale,
148 /// The home server refused, or could not be reached.
149 #[error("the home server answered {code}: {detail}")]
150 Refused {
151 /// The stable `error.*` code, where the answer carried one.
152 code: String,
153 /// The server's own description.
154 detail: String,
155 },
156 /// The transport failed, or a URL could not be built.
157 #[error("the pull could not be transported: {0}")]
158 Transport(String),
159 /// The feed answered, and the page did not survive validation.
160 #[error(transparent)]
161 Feed(#[from] SyncError),
162 /// The home server will not take this peer's writes: its `426`, or a window it advertised
163 /// that already refuses this build (issue #674).
164 #[error(transparent)]
165 UpgradeRequired(Box<crate::net::negotiation::UpgradeRequired>),
166}
167
168/// The revocation list as the home server last published it.
169#[derive(Debug, Clone)]
170pub struct RevocationSnapshot {
171 /// Every `jti` the issuer currently refuses.
172 pub revoked: Vec<String>,
173 /// How long the issuer says a copy of this list may be relied on.
174 pub max_staleness: Duration,
175 /// When this peer fetched it, on the local monotonic clock.
176 ///
177 /// The *local* clock and not the list's `generated_at`: a peer deciding freshness from a
178 /// timestamp the issuer wrote would be trusting the party whose revocations it is checking
179 /// to be honest about their age.
180 fetched_at: Instant,
181}
182
183impl RevocationSnapshot {
184 /// Whether this copy is still inside the issuer's own bound at `now`.
185 #[must_use]
186 pub fn is_fresh(&self, now: Instant) -> bool {
187 now.duration_since(self.fetched_at) <= self.max_staleness
188 }
189
190 /// Whether the issuer currently refuses `jti`.
191 #[must_use]
192 pub fn refuses(&self, jti: &str) -> bool {
193 self.revoked.iter().any(|revoked| revoked == jti)
194 }
195}
196
197/// What the puller currently holds: the credential, and the clients built over it.
198struct Held {
199 token: String,
200 jti: String,
201 sync: SyncConsumer,
202 blobs: CapabilityBlobSource,
203 client: rest::Client,
204}
205
206/// A peer server pulling one album it holds a capability for.
207pub struct FederationPull {
208 base_url: String,
209 album_id: String,
210 signer: Arc<dyn RequestSigner>,
211 held: RwLock<Held>,
212 snapshot: RwLock<Option<RevocationSnapshot>>,
213}
214
215impl FederationPull {
216 /// A puller against `base_url`, presenting `token` for `album_id`, signing every request
217 /// with `signer`.
218 ///
219 /// `jti` is the token's own identifier as the home server minted it — the key the revocation
220 /// list is checked against. It is passed in rather than parsed out of the token, because
221 /// this module holds no JWT parser and a client that read its own credential's claims would
222 /// be trusting a value it never verified.
223 ///
224 /// `signer` holds the key the home server pinned for this peer; a request it did not sign
225 /// is refused `401` however good the token is.
226 ///
227 /// # Errors
228 ///
229 /// [`FederationError::Transport`] when `base_url` is not a URL a client can hang paths off.
230 pub fn new(
231 base_url: &str,
232 album_id: impl Into<String>,
233 token: impl Into<String>,
234 jti: impl Into<String>,
235 signer: Arc<dyn RequestSigner>,
236 ) -> Result<Self, FederationError> {
237 let token = token.into();
238 let jti = jti.into();
239 Ok(Self {
240 base_url: base_url.to_owned(),
241 album_id: album_id.into(),
242 held: RwLock::new(Held::build(base_url, token, jti, &signer)?),
243 signer,
244 snapshot: RwLock::new(None),
245 })
246 }
247
248 /// The `jti` of the capability currently held.
249 #[must_use]
250 pub fn jti(&self) -> String {
251 read(&self.held).jti.clone()
252 }
253
254 /// The token currently held, for a caller that persists it across restarts.
255 #[must_use]
256 pub fn token(&self) -> String {
257 read(&self.held).token.clone()
258 }
259
260 /// Fetch the issuer's revocation list and keep it as this puller's snapshot.
261 ///
262 /// # Errors
263 ///
264 /// [`FederationError::Refused`] or [`FederationError::Transport`]; the snapshot is left
265 /// as it was, and the next [`Self::admit`] will refuse once the old one goes stale.
266 #[instrument(skip(self))]
267 pub async fn poll_revocations(&self) -> Result<RevocationSnapshot, FederationError> {
268 let client = read(&self.held).client.clone();
269 let list = client
270 .revoked_jti()
271 .await
272 .map_err(|error| {
273 // Every refusal the list declares is coded, so whichever status carried it the
274 // generated error has a problem body to read the code from.
275 let code = match &error {
276 rest::Error::Api(response) => {
277 response.inner().body().map(|problem| problem.code.clone())
278 }
279 _ => None,
280 };
281 refusal("the revocation list", code, &error.to_string())
282 })?
283 .into_inner();
284 // The bound is unsigned on the wire, so a negative one never decodes: that refresh
285 // fails (through `refusal`, as every generated failure here does) and no snapshot is
286 // taken from the list.
287 let max_staleness = Duration::from_secs(u64::from(list.max_staleness_seconds));
288 let snapshot = RevocationSnapshot {
289 revoked: list
290 .revoked
291 .into_iter()
292 .map(|token| token.jti.clone())
293 .collect(),
294 max_staleness,
295 fetched_at: Instant::now(),
296 };
297 tracing::debug!(
298 revoked = snapshot.revoked.len(),
299 max_staleness = ?snapshot.max_staleness,
300 "refreshed the issuer's revocation list"
301 );
302 *write(&self.snapshot) = Some(snapshot.clone());
303 Ok(snapshot)
304 }
305
306 /// Refuse unless the held capability is admissible right now.
307 ///
308 /// Refreshes the snapshot when the held one is past the issuer's own bound. Every pull goes
309 /// through here, so a revoked grant stops the pull rather than being discovered one refusal
310 /// at a time.
311 ///
312 /// # Errors
313 ///
314 /// [`FederationError::Revoked`] when the issuer refuses this `jti`;
315 /// [`FederationError::ListStale`] when the list could not be refreshed inside its bound.
316 pub async fn admit(&self) -> Result<(), FederationError> {
317 let fresh = read(&self.snapshot)
318 .as_ref()
319 .filter(|snapshot| snapshot.is_fresh(Instant::now()))
320 .cloned();
321 let snapshot = match fresh {
322 Some(snapshot) => snapshot,
323 None => self.poll_revocations().await.map_err(|error| {
324 tracing::warn!(%error, "the revocation list could not be refreshed; refusing to pull");
325 FederationError::ListStale
326 })?,
327 };
328 if snapshot.refuses(&read(&self.held).jti) {
329 tracing::info!("the issuer has revoked this capability; the pull stops");
330 return Err(FederationError::Revoked);
331 }
332 Ok(())
333 }
334
335 /// Pull one page of the album this capability covers.
336 ///
337 /// # Errors
338 ///
339 /// As [`Self::admit`], plus whatever the feed answered.
340 #[instrument(skip(self, cursor), fields(album = %self.album_id))]
341 pub async fn page(
342 &self,
343 cursor: &SyncCursor,
344 page_size: u32,
345 ) -> Result<SyncPage, FederationError> {
346 self.admit().await?;
347 let sync = read(&self.held).sync.clone();
348 Ok(sync.pull_album(cursor, page_size, &self.album_id).await?)
349 }
350
351 /// Fetch one blob the page named, verified against its own address.
352 ///
353 /// The bytes are self-verifying: [`crate::fetch::fetch_blob`] hashes what arrives and
354 /// refuses anything that is not the address asked for, so a home server cannot substitute
355 /// content for a peer any more than it can for its own client.
356 ///
357 /// # Errors
358 ///
359 /// As [`Self::admit`], plus [`FederationError::Refused`] carrying the fetch's own reason —
360 /// `error.federation.scope_insufficient` for a blob outside the grant's scope among them.
361 #[instrument(skip(self), fields(album = %self.album_id))]
362 pub async fn blob(&self, hash: &str, expected_len: u64) -> Result<Vec<u8>, FederationError> {
363 self.admit().await?;
364 let blobs = read(&self.held).blobs.clone();
365 crate::fetch::fetch_blob(&blobs, hash, expected_len)
366 .await
367 .map_err(|error| FederationError::Refused {
368 // The stable code the server sent, not a prose rendering of it: the doc above
369 // promises `error.federation.scope_insufficient` here, and a caller that had to
370 // string-match a message to find it would be matching on a message.
371 code: error.error_code().unwrap_or_default().to_owned(),
372 detail: error.to_string(),
373 })
374 }
375
376 /// Exchange the held capability for its successor, and pull with that from now on.
377 ///
378 /// Idempotent at the server: a replay of the same predecessor answers the same successor,
379 /// so a puller that crashed between the call and persisting the answer gets the same token
380 /// back rather than a second grant.
381 ///
382 /// # Errors
383 ///
384 /// [`FederationError::Refused`] when the issuer will not continue the grant — a revoked
385 /// predecessor, a blocked peer, a spent budget, a member no longer on the roster
386 /// (`error.federation.member_not_on_roster`) — or [`FederationError::Transport`].
387 #[instrument(skip(self))]
388 pub async fn refresh(&self) -> Result<String, FederationError> {
389 let (client, token) = {
390 let held = read(&self.held);
391 (held.client.clone(), held.token.clone())
392 };
393 let signature = request_signature(self.signer.as_ref(), "POST", REFRESH_PATH, &token)
394 .map_err(FederationError::Transport)?;
395 let refreshed = client
396 .refresh_capability(rest::RefreshCapabilityParams {
397 x_capsule_request_signature: Some(signature),
398 ..rest::RefreshCapabilityParams::from(rest::RefreshCapabilityParamsRequired {
399 x_capsule_protocol: capsule_core::crypto::primitives::PROTOCOL_VERSION.into(),
400 })
401 })
402 .await
403 .map_err(|error| match crate::client::upgrade_required_of(&error) {
404 // The gate's `426`, or the typed transport's local one (issue #674).
405 Some(refusal) => FederationError::UpgradeRequired(Box::new(refusal)),
406 None => refresh_refusal(error),
407 })?
408 .into_inner();
409
410 let held = Held::build(
411 &self.base_url,
412 refreshed.token.clone(),
413 refreshed.jti.clone(),
414 &self.signer,
415 )?;
416 // The predecessor is revoked the moment the successor is issued, so the swap has to be
417 // one act: a puller holding one client on the old token and another on the new would
418 // refuse itself on whichever request lost the race.
419 *write(&self.held) = held;
420 // The list a moment ago did not carry the predecessor; it does now. Dropped rather than
421 // patched, so the next pull re-reads it from the issuer.
422 *write(&self.snapshot) = None;
423 tracing::info!(jti = %refreshed.jti, replayed = refreshed.replayed, "refreshed the capability");
424 Ok(refreshed.token)
425 }
426}
427
428/// Map a capability refresh refusal that is not an upgrade refusal.
429///
430/// Exhaustive over the generated enum on purpose, as [`describe`] is: every refusal the contract
431/// declares carries a coded problem, and a status matched by a catch-all is a code dropped on the
432/// floor — the `409 error.federation.member_not_on_roster` a peer acts on by asking the owner for
433/// a fresh grant was, until #529. A status the contract adds later is a compile error here.
434fn refresh_refusal(error: rest::Error<rest::RefreshCapabilityError>) -> FederationError {
435 match error {
436 rest::Error::Api(response) => match response.into_inner() {
437 rest::RefreshCapabilityError::Status400(problem)
438 | rest::RefreshCapabilityError::Status401(problem)
439 | rest::RefreshCapabilityError::Status403(problem)
440 | rest::RefreshCapabilityError::Status404(problem)
441 | rest::RefreshCapabilityError::Status409(problem)
442 | rest::RefreshCapabilityError::Status413(problem)
443 | rest::RefreshCapabilityError::Status425(problem)
444 | rest::RefreshCapabilityError::Status426(problem)
445 | rest::RefreshCapabilityError::Status429(problem)
446 | rest::RefreshCapabilityError::Status500(problem) => FederationError::Refused {
447 code: problem.code.clone(),
448 detail: problem.detail.clone().unwrap_or_default(),
449 },
450 },
451 other => FederationError::Transport(other.to_string()),
452 }
453}
454
455impl std::fmt::Debug for FederationPull {
456 fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
457 // Never the token: a `Debug` that printed a live credential is how one reaches a log.
458 formatter
459 .debug_struct("FederationPull")
460 .field("base_url", &self.base_url)
461 .field("album_id", &self.album_id)
462 .field("jti", &read(&self.held).jti)
463 .finish_non_exhaustive()
464 }
465}
466
467impl Held {
468 fn build(
469 base_url: &str,
470 token: String,
471 jti: String,
472 signer: &Arc<dyn RequestSigner>,
473 ) -> Result<Self, FederationError> {
474 Ok(Self {
475 sync: SyncConsumer::with_signed_capability(base_url, token.clone(), signer.clone())
476 .map_err(|error| FederationError::Transport(error.to_string()))?,
477 blobs: CapabilityBlobSource::new(base_url, token.clone(), signer.clone())?,
478 client: client_for(base_url, &token)?,
479 token,
480 jti,
481 })
482 }
483}
484
485/// A generated client for `base_url` carrying `token` under the bearer scheme.
486fn client_for(base_url: &str, token: &str) -> Result<rest::Client, FederationError> {
487 let http = net::http_client().map_err(|error| FederationError::Transport(error.to_string()))?;
488 Ok(crate::client::negotiated_client(http, base_url)
489 .map_err(FederationError::Transport)?
490 .with_bearer(token.to_owned().into()))
491}
492
493/// A refusal from the home server, carrying the stable code when the answer had one.
494fn refusal(doing: &str, code: Option<String>, detail: &str) -> FederationError {
495 tracing::info!(%doing, ?code, %detail, "the home server refused a federated call");
496 FederationError::Refused {
497 code: code.unwrap_or_default(),
498 detail: detail.to_owned(),
499 }
500}
501
502/// Read a lock, recovering from a poisoned one.
503fn read<T>(lock: &RwLock<T>) -> std::sync::RwLockReadGuard<'_, T> {
504 lock.read()
505 .unwrap_or_else(std::sync::PoisonError::into_inner)
506}
507
508/// Write a lock, recovering from a poisoned one.
509fn write<T>(lock: &RwLock<T>) -> std::sync::RwLockWriteGuard<'_, T> {
510 lock.write()
511 .unwrap_or_else(std::sync::PoisonError::into_inner)
512}
513
514/// A [`BlobSource`] over the **generated** `get_blob`, presenting a capability.
515///
516/// Not [`HttpBlobSource`](crate::fetch::HttpBlobSource): that one is raw `reqwest` over an
517/// SDK session, and a peer has no session. Everything that parses or serializes here is
518/// generated — the `Range` parameter, the byte body and every declared refusal — and what is
519/// hand-written is the mapping from a status to the fetcher's own outcome.
520#[derive(Clone)]
521pub struct CapabilityBlobSource {
522 client: Arc<rest::Client>,
523 token: Arc<str>,
524 signer: Arc<dyn RequestSigner>,
525}
526
527impl CapabilityBlobSource {
528 /// A source against `base_url`, presenting `token` and signing each range with `signer`.
529 ///
530 /// # Errors
531 ///
532 /// [`FederationError::Transport`] when `base_url` is not a URL a client can hang paths off.
533 pub fn new(
534 base_url: &str,
535 token: impl Into<String>,
536 signer: Arc<dyn RequestSigner>,
537 ) -> Result<Self, FederationError> {
538 let token: String = token.into();
539 Ok(Self {
540 client: Arc::new(client_for(base_url, &token)?),
541 token: token.into(),
542 signer,
543 })
544 }
545}
546
547impl std::fmt::Debug for CapabilityBlobSource {
548 fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
549 formatter.write_str("CapabilityBlobSource")
550 }
551}
552
553impl BlobSource for CapabilityBlobSource {
554 async fn get_range(&self, hash: &str, start: u64, max_len: Option<u64>) -> RangeOutcome {
555 // A zero-length window would be malformed; the fetcher never asks for one when bytes
556 // remain, so it is read as the open-ended remainder.
557 let range = match max_len {
558 Some(len) if len > 0 => format!("bytes={start}-{}", start + len - 1),
559 _ => format!("bytes={start}-"),
560 };
561 // Signed per range: the fetcher's next range is a new request, and the home server
562 // accepts each signature once.
563 let signature = match request_signature(
564 self.signer.as_ref(),
565 "GET",
566 &format!("/v1/blob/{hash}"),
567 &self.token,
568 ) {
569 Ok(signature) => signature,
570 Err(error) => {
571 tracing::error!(%error, "a federated blob request could not be signed");
572 return RangeOutcome::Status {
573 status: 0,
574 code: None,
575 };
576 }
577 };
578 let params = rest::GetBlobParams {
579 range: Some(range),
580 x_capsule_request_signature: Some(signature),
581 ..rest::GetBlobParams::from(rest::GetBlobParamsRequired {
582 x_capsule_protocol: capsule_core::crypto::primitives::PROTOCOL_VERSION.into(),
583 })
584 };
585 match self.client.get_blob(hash.to_owned(), params).await {
586 Ok(response) => {
587 let bytes = match response.into_inner() {
588 rest::GetBlobResponse::Status200(bytes)
589 | rest::GetBlobResponse::Status206(bytes) => bytes,
590 };
591 RangeOutcome::Complete {
592 bytes: bytes.to_vec(),
593 }
594 }
595 Err(rest::Error::Api(response)) => {
596 let (status, code) = describe(response.into_inner());
597 RangeOutcome::Status { status, code }
598 }
599 Err(error) => {
600 tracing::debug!(%error, "a federated blob range request failed in transport");
601 RangeOutcome::Status {
602 status: 0,
603 code: None,
604 }
605 }
606 }
607 }
608}
609
610/// The status and the stable code a declared blob refusal carries.
611///
612/// Exhaustive over the generated enum on purpose: a status the contract adds later is a compile
613/// error here rather than a silent `0` the fetcher would read as a transport failure.
614fn describe(error: rest::GetBlobError) -> (u16, Option<String>) {
615 let coded =
616 |status: u16, problem: Box<rest::types::CodedProblem>| (status, Some(problem.code.clone()));
617 match error {
618 rest::GetBlobError::Status304 => (304, None),
619 rest::GetBlobError::Status400(problem) => coded(400, problem),
620 rest::GetBlobError::Status401(problem) => coded(401, problem),
621 rest::GetBlobError::Status403(problem) => coded(403, problem),
622 rest::GetBlobError::Status404(problem) => coded(404, problem),
623 rest::GetBlobError::Status409(problem) => coded(409, problem),
624 rest::GetBlobError::Status410(problem) => coded(410, problem),
625 rest::GetBlobError::Status412 => (412, None),
626 rest::GetBlobError::Status413(problem) => coded(413, problem),
627 rest::GetBlobError::Status416(problem) => coded(416, problem),
628 rest::GetBlobError::Status429(problem) => coded(429, problem),
629 rest::GetBlobError::Status500(problem) => coded(500, problem),
630 }
631}
632
633#[cfg(test)]
634mod tests;