(self, request: BootstrapRequest)
| 58 | |
| 59 | impl 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(); |
nothing calls this directly
no test coverage detected