(
&self,
root: &Path,
session_id: &str,
attestation: Vec<u8>,
session_json: String,
)
| 326 | } |
| 327 | |
| 328 | fn submit_attestation( |
| 329 | &self, |
| 330 | root: &Path, |
| 331 | session_id: &str, |
| 332 | attestation: Vec<u8>, |
| 333 | session_json: String, |
| 334 | ) -> Result<Result<Hash, SubmitRejection>, String> { |
| 335 | let session_id = session_id.to_string(); |
| 336 | exchange(root, move |repository, target, channel| async move { |
| 337 | let response = sandbox_client(channel) |
| 338 | .submit_attestation(pb::SubmitAttestationRequest { |
| 339 | repository: Some(repository), |
| 340 | meta: Some(pb::RequestMeta { |
| 341 | request_id: uuid::Uuid::new_v4().to_string(), |
| 342 | observed_at: None, |
| 343 | }), |
| 344 | session_id, |
| 345 | attestation: Some(wire::attestation_bytes(attestation)), |
| 346 | session_json, |
| 347 | target: Some(target), |
| 348 | }) |
| 349 | .await |
| 350 | .map_err(refused)? |
| 351 | .into_inner(); |
| 352 | match response.outcome.ok_or("no outcome in SubmitAttestation")? { |
| 353 | pb::submit_attestation_response::Outcome::Submitted(submitted) => Ok(Ok( |
| 354 | wire::hash_from_proto(submitted.attestation_hash.as_ref())?, |
| 355 | )), |
| 356 | pb::submit_attestation_response::Outcome::Refused(info) => { |
| 357 | Ok(Err(wire::rejection_from_error_info(&info) |
| 358 | .ok_or_else(|| info.message.clone())?)) |
| 359 | } |
| 360 | } |
| 361 | }) |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | /// Install the link, once per process. Harmless outside a remote sandbox: |
no test coverage detected