List all attestation history for a domain (sorted by timestamp descending)
(&self, domain: &str)
| 1001 | |
| 1002 | /// List all attestation history for a domain (sorted by timestamp descending) |
| 1003 | pub fn list_cert_attestations(&self, domain: &str) -> Vec<CertAttestation> { |
| 1004 | let prefix = keys::cert_attestation_prefix(domain); |
| 1005 | let latest_key = keys::cert_attestation_latest(domain); |
| 1006 | let state = self.persistent.read(); |
| 1007 | let mut attestations: Vec<CertAttestation> = state |
| 1008 | .iter_by_prefix(&prefix) |
| 1009 | .filter_map(|(key, entry)| { |
| 1010 | // Skip the "latest" entry |
| 1011 | if key == &latest_key { |
| 1012 | return None; |
| 1013 | } |
| 1014 | let value = entry.value.as_ref()?; |
| 1015 | match decode(value) { |
| 1016 | Ok(att) => Some(att), |
| 1017 | Err(e) => { |
| 1018 | warn!("failed to decode attestation for key {key}: {e:?}"); |
| 1019 | None |
| 1020 | } |
| 1021 | } |
| 1022 | }) |
| 1023 | .collect(); |
| 1024 | // Sort by generated_at descending (newest first) |
| 1025 | attestations.sort_by(|a, b| b.generated_at.cmp(&a.generated_at)); |
| 1026 | attestations |
| 1027 | } |
| 1028 | |
| 1029 | // ==================== Watch helpers ==================== |
| 1030 |
no test coverage detected