(session: &Service, info: &pb::AttestationInfo)
| 1106 | } |
| 1107 | |
| 1108 | fn print_attestation_json(session: &Service, info: &pb::AttestationInfo) -> CliResult<()> { |
| 1109 | let path = info.vault_path.as_deref().ok_or_else(|| { |
| 1110 | CliError::Internal(anyhow::anyhow!("the service returned no attestation path")) |
| 1111 | })?; |
| 1112 | let response = session.get_vault_entry(pb::GetVaultEntryRequest { |
| 1113 | repository: Some(session.reference.clone()), |
| 1114 | kind: Kind::Unspecified as i32, |
| 1115 | id: String::new(), |
| 1116 | path: Some(path.trim_start_matches(".vault/").to_string()), |
| 1117 | include_bundle: true, |
| 1118 | view: None, |
| 1119 | })?; |
| 1120 | let bundle = response.entry_bundle.as_ref().ok_or_else(|| { |
| 1121 | CliError::Internal(anyhow::anyhow!( |
| 1122 | "the service returned no attestation bundle" |
| 1123 | )) |
| 1124 | })?; |
| 1125 | let bundle = parse_entry_bundle(bundle)?; |
| 1126 | let node: serde_json::Value = serde_json::from_slice(&bundle.entry.content_bytes) |
| 1127 | .map_err(|error| CliError::Internal(anyhow::anyhow!("attested node: {error}")))?; |
| 1128 | println!( |
| 1129 | "{}", |
| 1130 | serde_json::to_string_pretty(&node).map_err(|error| CliError::Internal(error.into()))? |
| 1131 | ); |
| 1132 | Ok(()) |
| 1133 | } |
| 1134 | |
| 1135 | pub fn intent_validate(args: &super::intent::validate::IntentValidate) -> CliResult<bool> { |
| 1136 | // Path-arg form reads a file, no redb — stays local. |
no test coverage detected