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

Method bootstrap

kms/src/onboard_service.rs:60–82  ·  view source on GitHub ↗
(self, request: BootstrapRequest)

Source from the content-addressed store, hash-verified

58
59impl OnboardRpc for OnboardHandler {
60 async fn bootstrap(self, request: BootstrapRequest) -> Result<BootstrapResponse> {
61 ensure_self_kms_allowed(&self.state.config)
62 .await
63 .context("KMS is not allowed to bootstrap")?;
64 let keys = Keys::generate(&request.domain)
65 .await
66 .context("Failed to generate keys")?;
67
68 let k256_pubkey = keys.k256_key.verifying_key().to_sec1_bytes().to_vec();
69 let ca_pubkey = keys.ca_key.public_key_der();
70 let attestation = attest_keys(&ca_pubkey, &k256_pubkey).await?;
71
72 let cfg = &self.state.config;
73 let response = BootstrapResponse {
74 ca_pubkey,
75 k256_pubkey,
76 attestation,
77 };
78 // Store the bootstrap info
79 safe_write(cfg.bootstrap_info(), serde_json::to_vec(&response)?)?;
80 keys.store(cfg)?;
81 Ok(response)
82 }
83
84 async fn onboard(self, request: OnboardRequest) -> Result<OnboardResponse> {
85 let source_url = request.source_url.trim_end_matches('/').to_string();

Callers

nothing calls this directly

Calls 5

ensure_self_kms_allowedFunction · 0.85
attest_keysFunction · 0.85
to_vecMethod · 0.80
bootstrap_infoMethod · 0.80
storeMethod · 0.80

Tested by

no test coverage detected