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

Method add_cert

gateway/src/cert_store.rs:240–260  ·  view source on GitHub ↗

Add a certificate to the builder The domain is the base domain (e.g., "example.com"). All gateway certificates are wildcard certs for "*.{domain}".

(&mut self, domain: &str, data: &CertData)

Source from the content-addressed store, hash-verified

238 /// The domain is the base domain (e.g., "example.com").
239 /// All gateway certificates are wildcard certs for "*.{domain}".
240 pub fn add_cert(&mut self, domain: &str, data: &CertData) -> Result<()> {
241 let certified_key = parse_certified_key(&data.cert_pem, &data.key_pem)
242 .with_context(|| format!("failed to parse certificate for {}", domain))?;
243
244 let certified_key = Arc::new(certified_key);
245
246 // Gateway certificates are always wildcard certs
247 // domain is the base domain (e.g., "example.com"), cert is for "*.example.com"
248 self.wildcard_certs
249 .insert(domain.to_string(), certified_key);
250 info!(
251 "cert_store: prepared wildcard certificate for *.{} (expires: {})",
252 domain,
253 format_expiry(data.not_after)
254 );
255
256 // Store metadata
257 self.cert_data.insert(domain.to_string(), data.clone());
258
259 Ok(())
260 }
261
262 /// Build the immutable CertStore
263 pub fn build(self) -> CertStore {

Callers 5

update_certMethod · 0.80
test_cert_store_builderFunction · 0.80
test_cert_store_wildcardFunction · 0.80
newMethod · 0.80

Calls 2

parse_certified_keyFunction · 0.85
cloneMethod · 0.80

Tested by 2

test_cert_store_builderFunction · 0.64
test_cert_store_wildcardFunction · 0.64