MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / list_cert_attestations

Method list_cert_attestations

gateway/src/kv/mod.rs:1003–1027  ·  view source on GitHub ↗

List all attestation history for a domain (sorted by timestamp descending)

(&self, domain: &str)

Source from the content-addressed store, hash-verified

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

Callers 1

acme_infoMethod · 0.45

Calls 5

cert_attestation_prefixFunction · 0.85
cert_attestation_latestFunction · 0.85
decodeFunction · 0.85
cmpMethod · 0.80
as_refMethod · 0.45

Tested by

no test coverage detected