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

Function get_info

guest-agent/src/rpc_service.rs:192–255  ·  view source on GitHub ↗
(state: &AppState, external: bool)

Source from the content-addressed store, hash-verified

190}
191
192pub async fn get_info(state: &AppState, external: bool) -> Result<AppInfo> {
193 let hide_tcb_info = external && !state.config().app_compose.public_tcbinfo;
194 let versioned_attestation = state.inner.info_attestation()?;
195 let attestation = versioned_attestation.into_v1();
196 let app_info = attestation
197 .decode_app_info(false)
198 .context("Failed to decode app info")?;
199 let event_log = attestation.tdx_event_log().unwrap_or_default();
200 let tcb_info = if hide_tcb_info {
201 "".to_string()
202 } else {
203 let app_compose = state.config().app_compose.raw.clone();
204 let td_report = match attestation.td10_report() {
205 Some(report) => json!({
206 "mrtd": hex::encode(report.mr_td),
207 "rtmr0": hex::encode(report.rt_mr0),
208 "rtmr1": hex::encode(report.rt_mr1),
209 "rtmr2": hex::encode(report.rt_mr2),
210 "rtmr3": hex::encode(report.rt_mr3),
211 }),
212 None => json!({}),
213 };
214 serde_json::to_string_pretty(&json!({
215 "mrtd": td_report["mrtd"],
216 "rtmr0": td_report["rtmr0"],
217 "rtmr1": td_report["rtmr1"],
218 "rtmr2": td_report["rtmr2"],
219 "rtmr3": td_report["rtmr3"],
220 "mr_aggregated": hex::encode(app_info.mr_aggregated),
221 "os_image_hash": hex::encode(&app_info.os_image_hash),
222 "compose_hash": hex::encode(&app_info.compose_hash),
223 "device_id": hex::encode(&app_info.device_id),
224 "event_log": event_log,
225 "app_compose": app_compose,
226 }))
227 .unwrap_or_default()
228 };
229 let vm_config = if hide_tcb_info {
230 "".to_string()
231 } else {
232 state.inner.vm_config.clone()
233 };
234 state.maybe_request_demo_cert();
235 Ok(AppInfo {
236 app_name: state.config().app_compose.name.clone(),
237 app_id: app_info.app_id,
238 instance_id: app_info.instance_id,
239 device_id: app_info.device_id,
240 mr_aggregated: app_info.mr_aggregated.to_vec(),
241 os_image_hash: app_info.os_image_hash.clone(),
242 key_provider_info: String::from_utf8(app_info.key_provider_info).unwrap_or_default(),
243 compose_hash: app_info.compose_hash.clone(),
244 app_cert: state
245 .inner
246 .demo_cert
247 .read()
248 .or_panic("lock should not fail")
249 .clone(),

Callers 1

infoMethod · 0.85

Calls 10

read_dmi_fileFunction · 0.85
info_attestationMethod · 0.80
into_v1Method · 0.80
decode_app_infoMethod · 0.80
cloneMethod · 0.80
td10_reportMethod · 0.80
to_vecMethod · 0.80
configMethod · 0.45
tdx_event_logMethod · 0.45

Tested by

no test coverage detected