MCPcopy Create free account
hub / github.com/ElementsProject/lightning / to_certificate

Method to_certificate

plugins/grpc-plugin/src/tls.rs:15–22  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

13
14impl Identity {
15 fn to_certificate(&self) -> Result<Certificate> {
16 let keystr = String::from_utf8_lossy(&self.key);
17 let key = KeyPair::from_pem(&keystr)?;
18 let certstr = String::from_utf8_lossy(&self.certificate);
19 let params = rcgen::CertificateParams::from_ca_cert_pem(&certstr, key)?;
20 let cert = Certificate::from_params(params)?;
21 Ok(cert)
22 }
23
24 pub fn to_tonic_identity(&self) -> tonic::transport::Identity {
25 tonic::transport::Identity::from_pem(&self.certificate, &self.key)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected