File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -20,24 +20,31 @@ enum Cli {
2020 /// Inspects COSE document
2121 Inspect {
2222 /// Path to the fully formed (should has at least one signature) COSE document
23- cose_sign : PathBuf ,
23+ cose_sign_path : PathBuf ,
24+ } ,
25+ /// Inspect COSE document hex-formatted bytes
26+ InspectBytes {
27+ /// Hex-formatted COSE SIGN Bytes
28+ cose_sign_str : String ,
2429 } ,
2530}
2631
2732impl Cli {
2833 /// Execute Cli command
2934 fn exec ( self ) -> anyhow:: Result < ( ) > {
30- match self {
31- Self :: Inspect { cose_sign } => {
32- //
33- let mut cose_file = File :: open ( cose_sign) ?;
35+ let cose_bytes = match self {
36+ Self :: Inspect { cose_sign_path } => {
37+ let mut cose_file = File :: open ( cose_sign_path) ?;
3438 let mut cose_file_bytes = Vec :: new ( ) ;
3539 cose_file. read_to_end ( & mut cose_file_bytes) ?;
36- let cat_signed_doc: CatalystSignedDocument = cose_file_bytes. try_into ( ) ?;
37- println ! ( "{cat_signed_doc}" ) ;
38- Ok ( ( ) )
40+ cose_file_bytes
3941 } ,
40- }
42+ Self :: InspectBytes { cose_sign_str } => hex:: decode ( & cose_sign_str) ?,
43+ } ;
44+ println ! ( "Bytes read:\n {}\n " , hex:: encode( & cose_bytes) ) ;
45+ let cat_signed_doc: CatalystSignedDocument = cose_bytes. try_into ( ) ?;
46+ println ! ( "{cat_signed_doc}" ) ;
47+ Ok ( ( ) )
4148 }
4249}
4350
You can’t perform that action at this time.
0 commit comments