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

Function need_renew

certbot/src/acme_client.rs:566–574  ·  view source on GitHub ↗
(cert_pem: &str, expires_in: Duration)

Source from the content-addressed store, hash-verified

564}
565
566fn need_renew(cert_pem: &str, expires_in: Duration) -> Result<bool> {
567 let pem = read_pem(cert_pem)?;
568 let cert = pem.parse_x509().context("Invalid x509 certificate")?;
569 let not_after = cert.validity().not_after.to_datetime();
570 let now = time::OffsetDateTime::now_utc();
571 debug!("will expire in {}", not_after - now);
572
573 Ok(not_after < now + expires_in)
574}
575
576pub(crate) fn read_pem(cert_pem: &str) -> Result<Pem> {
577 Pem::iter_from_buffer(cert_pem.as_bytes())

Callers 1

renew_cert_if_neededMethod · 0.85

Calls 1

read_pemFunction · 0.85

Tested by

no test coverage detected