chore: opt_result!
This commit is contained in:
@@ -23,7 +23,7 @@ impl Command for CommandImpl {
|
||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||
let json_output = sub_arg_matches.is_present("json");
|
||||
if json_output { rust_util::util_msg::set_logger_std_out(false); }
|
||||
|
||||
|
||||
let sha256_output = sub_arg_matches.is_present("sha256");
|
||||
let sha384_output = sub_arg_matches.is_present("sha384");
|
||||
let sha512_output = sub_arg_matches.is_present("sha512");
|
||||
@@ -54,7 +54,7 @@ impl Command for CommandImpl {
|
||||
.set_slot(Slot::Slot2);
|
||||
|
||||
// In HMAC Mode, the result will always be the SAME for the SAME provided challenge
|
||||
let hmac_result = yubi.challenge_response_hmac(&challenge_bytes, config).unwrap();
|
||||
let hmac_result = opt_result!(yubi.challenge_response_hmac(&challenge_bytes, config), "Challenge HMAC failed: {}");
|
||||
|
||||
// Just for debug, lets check the hex
|
||||
let v: &[u8] = hmac_result.deref();
|
||||
@@ -71,7 +71,7 @@ impl Command for CommandImpl {
|
||||
hex_sha384.map(|hex_sha384| json.insert("response_sha384_hex", hex::encode(hex_sha384)));
|
||||
hex_sha512.map(|hex_sha512| json.insert("response_sha512_hex", hex::encode(hex_sha512)));
|
||||
|
||||
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
||||
println!("{}", serde_json::to_string_pretty(&json).expect("Convert to JSON failed!"));
|
||||
} else {
|
||||
success!("Challenge HEX: {}", hex::encode(challenge_bytes));
|
||||
success!("Response HEX: {}", hex_string);
|
||||
|
||||
Reference in New Issue
Block a user