Get ACME info for all managed domains (or a specific domain)
(&self, domain: Option<&str>)
| 357 | |
| 358 | /// Get ACME info for all managed domains (or a specific domain) |
| 359 | pub(crate) fn acme_info(&self, domain: Option<&str>) -> Result<AcmeInfoResponse> { |
| 360 | let kv_store = self.kv_store.clone(); |
| 361 | |
| 362 | let mut quoted_hist_keys = vec![]; |
| 363 | |
| 364 | // Get domains to query |
| 365 | let domains: Vec<String> = match domain { |
| 366 | Some(d) => vec![d.to_string()], |
| 367 | None => kv_store |
| 368 | .list_zt_domain_configs() |
| 369 | .into_iter() |
| 370 | .map(|c| c.domain) |
| 371 | .collect(), |
| 372 | }; |
| 373 | |
| 374 | // Get account_uri, account_quote and account_attestation from global ACME attestation |
| 375 | let (account_uri, account_quote, account_attestation) = kv_store |
| 376 | .get_acme_attestation() |
| 377 | .map(|att| (att.account_uri, att.quote, att.attestation)) |
| 378 | .unwrap_or_default(); |
| 379 | |
| 380 | for domain in &domains { |
| 381 | // Get all attestations for this domain |
| 382 | let attestations = kv_store.list_cert_attestations(domain); |
| 383 | for att in attestations { |
| 384 | quoted_hist_keys.push(QuotedPublicKey { |
| 385 | public_key: att.public_key, |
| 386 | quote: att.quote, |
| 387 | attestation: att.attestation, |
| 388 | }); |
| 389 | } |
| 390 | } |
| 391 | Ok(AcmeInfoResponse { |
| 392 | account_uri, |
| 393 | account_quote, |
| 394 | account_attestation, |
| 395 | quoted_hist_keys, |
| 396 | }) |
| 397 | } |
| 398 | |
| 399 | /// Register a CVM with the given app_id, instance_id and client_public_key. |
| 400 | /// |
no test coverage detected