pub async fn install_certificate(
        &self,
        certificate_chain: &CertificateChain,
        private_key: &PrivateKey,
    ) -> Result<(), Error> {
        let db = self.hosted().await;

        TlsCertificate::entry(&self.data.primary_domain, &db)
            .update_with(|cert: &mut TlsCertificate| {
                cert.certificate_chain = certificate_chain.clone();
                cert.private_key = SerializablePrivateKey(private_key.clone());
            })
            .or_insert_with(|| TlsCertificate {
                domains: vec![self.data.primary_domain.clone()],
                private_key: SerializablePrivateKey(private_key.clone()),
                certificate_chain: certificate_chain.clone(),
            })
            .await?;

        self.refresh_certified_key().await?;

        let pinned_certificate_path = self.pinned_certificate_path();
        if pinned_certificate_path.exists() {
            tokio::fs::remove_file(&pinned_certificate_path).await?;
        }

        Ok(())
    }
/// Installs a certificate chain and private key used for TLS connections.
Installs a certificate chain and private key used for TLS connections.
Installs a certificate chain and private key used for TLS connections .
pub async fn install_certificate(
        &self,
        certificate_chain: &CertificateChain,
        private_key: &PrivateKey,
    ) -> Result<(), Error> {
        let db = self.hosted().await;
        TlsCertificate::entry(&self.data.primary_domain, &db)
            .update_with(|cert: &mut TlsCertificate| {
                cert.certificate_chain = certificate_chain.clone();
                cert.private_key = SerializablePrivateKey(private_key.clone());
            })
            .or_insert_with(|| TlsCertificate {
                domains: vec![self.data.primary_domain.clone()],
                private_key: SerializablePrivateKey(private_key.clone()),
                certificate_chain: certificate_chain.clone(),
            })
            .await?;
        self.refresh_certified_key().await?;
        let pinned_certificate_path = self.pinned_certificate_path();
        if pinned_certificate_path.exists() {
            tokio::fs::remove_file(&pinned_certificate_path).await?;
        }
        Ok(())
    }
pub async fn install_certificate ( & self , certificate_chain : & CertificateChain , private_key : & PrivateKey , ) -> Result < ( ) , Error > { let db = self . hosted ( ) . await ; TlsCertificate :: entry ( & self . data . primary_domain , & db ) . update_with ( | cert : & mut TlsCertificate | { cert . certificate_chain = certificate_chain . clone ( ) ; cert . private_key = SerializablePrivateKey ( private_key . clone ( ) ) ; } ) . or_insert_with ( | | TlsCertificate { domains : vec ! [ self data primary_domain clone ( ) ] , private_key : SerializablePrivateKey ( private_key . clone ( ) ) , certificate_chain : certificate_chain . clone ( ) , } ) . await ? ; self . refresh_certified_key ( ) . await ? ; let pinned_certificate_path = self . pinned_certificate_path ( ) ; if pinned_certificate_path . exists ( ) { tokio :: fs :: remove_file ( & pinned_certificate_path ) . await ? ; } Ok ( ( ) ) }
Installs a certificate chain and private key used for TLS connections.
Installs a certificate chain and private key used for TLS connections .
&self
certificate_chain
&CertificateChain
private_key
&PrivateKey
&self
certificate_chain
&CertificateChain
private_key
&PrivateKey