The encoded certificate an agent identity should present, if any. `None` for a human — they have no certificate and need none. `None` too when an agent has no usable certificate, because the resulting 401 from the server ("carries no certificate") names the problem better than anything we could raise here, and a read against a public project may not need one at all.
(store: &IdentityStore, identity: &Identity, server: &str)
| 438 | /// could raise here, and a read against a public project may not need one at |
| 439 | /// all. |
| 440 | fn delegation_header(store: &IdentityStore, identity: &Identity, server: &str) -> Option<String> { |
| 441 | if !identity.identity_type.is_delegated() { |
| 442 | return None; |
| 443 | } |
| 444 | |
| 445 | match crate::commands::delegation::active_for(store, identity, Some(server)) { |
| 446 | Ok(resolved) => Some(atomic_canonical::delegation::encode_for_transport( |
| 447 | &resolved.document, |
| 448 | )), |
| 449 | Err(e) => { |
| 450 | log::debug!( |
| 451 | "No usable delegation for agent '{}' against {server}: {e}", |
| 452 | identity.name |
| 453 | ); |
| 454 | None |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | /// What went wrong (if anything) when checking for usable push credentials. |
| 460 | /// |
no test coverage detected