chore: opt_result!

This commit is contained in:
2022-03-27 12:11:12 +08:00
parent 939ea56b21
commit 4be7e880c2

View File

@@ -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);