Skip to content

Commit ef9a604

Browse files
committed
cli: attesteer ias attestation report takes a filename (to a hex encoded report) instead of its contents
1 parent 72c2100 commit ef9a604

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cli/src/attesteer/commands/send_ias_attestation.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,26 @@
1717

1818
use itc_rpc_client::direct_client::DirectApi;
1919
use itp_rpc::{RpcRequest, RpcResponse, RpcReturnValue};
20+
use itp_types::DirectRequestStatus;
2021
use itp_utils::FromHexPrefixed;
2122
use log::error;
23+
use std::fs::read_to_string;
2224

2325
use crate::{command_utils::get_worker_api_direct, Cli};
2426

2527
/// Forward IAS attestation report for verification.
2628
#[derive(Debug, Clone, Parser)]
2729
pub struct SendIASAttestationReportCmd {
28-
/// Hex encoded IAS attestation report.
30+
/// Hex encoded IAS attestation report filename.
2931
report: String,
3032
}
3133

3234
impl SendIASAttestationReportCmd {
3335
pub fn run(&self, cli: &Cli) {
3436
let direct_api = get_worker_api_direct(&cli);
35-
let hex_encoded_report = self.report.clone();
37+
let hex_encoded_report = read_to_string(&self.report)
38+
.map_err(|e| error!("Opening hex encoded IAS attestation report file failed: {:#?}", e))
39+
.unwrap();
3640

3741
//let request = Request { shard, cyphertext: hex_encoded_quote.to_vec() };
3842

@@ -52,5 +56,10 @@ impl SendIASAttestationReportCmd {
5256
})
5357
.ok()
5458
.unwrap();
59+
60+
match rpc_return_value.status {
61+
DirectRequestStatus::Ok => println!("IAS attestation report verification succeded."),
62+
_ => error!("IAS attestation report verification failed"),
63+
}
5564
}
5665
}

0 commit comments

Comments
 (0)