1717
1818use itc_rpc_client:: direct_client:: DirectApi ;
1919use itp_rpc:: { RpcRequest , RpcResponse , RpcReturnValue } ;
20+ use itp_types:: DirectRequestStatus ;
2021use itp_utils:: FromHexPrefixed ;
2122use log:: error;
23+ use std:: fs:: read_to_string;
2224
2325use crate :: { command_utils:: get_worker_api_direct, Cli } ;
2426
2527/// Forward IAS attestation report for verification.
2628#[ derive( Debug , Clone , Parser ) ]
2729pub struct SendIASAttestationReportCmd {
28- /// Hex encoded IAS attestation report.
30+ /// Hex encoded IAS attestation report filename .
2931 report : String ,
3032}
3133
3234impl 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