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)
| 456 | /// could raise here, and a read against a public project may not need one at |
| 457 | /// all. |
| 458 | fn delegation_header(store: &IdentityStore, identity: &Identity, server: &str) -> Option<String> { |
| 459 | if !identity.identity_type.is_delegated() { |
| 460 | return None; |
| 461 | } |
| 462 | |
| 463 | match crate::auth::delegation::active_for(store, identity, Some(server)) { |
| 464 | Ok(resolved) => Some(atomic_canonical::delegation::encode_for_transport( |
| 465 | &resolved.document, |
| 466 | )), |
| 467 | Err(e) => { |
| 468 | log::debug!( |
| 469 | "No usable delegation for agent '{}' against {server}: {e}", |
| 470 | identity.name |
| 471 | ); |
| 472 | None |
| 473 | } |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | /// What went wrong (if anything) when checking for usable push credentials. |
| 478 | /// |
no test coverage detected