chore: u2fsign

This commit is contained in:
2022-03-27 13:07:19 +08:00
parent 0ea52ddfee
commit 83cf20fd39

View File

@@ -59,7 +59,8 @@ impl Command for CommandImpl {
information!("Start sign..."); information!("Start sign...");
information!("App id: {}", app_id); information!("App id: {}", app_id);
let mut manager = AuthenticatorService::new()?; let mut manager = opt_result!(
AuthenticatorService::new(), "Create authenticator service failed: {}");
manager.add_u2f_usb_hid_platform_transports(); manager.add_u2f_usb_hid_platform_transports();
if let Err(e) = manager.sign( if let Err(e) = manager.sign(
flags, flags,
@@ -70,13 +71,14 @@ impl Command for CommandImpl {
status_tx, status_tx,
callback, callback,
) { ) {
panic!("Couldn't register: {:?}", e); return simple_error!("Couldn't register: {:?}", e);
} }
let sign_result = sign_rx let sign_result = sign_rx
.recv() .recv()
.expect("Problem receiving, unable to continue"); .expect("Problem receiving, unable to continue");
let (_, handle_used, sign_data, device_info) = sign_result.expect("Sign failed"); let (_, handle_used, sign_data, device_info) =
opt_result!(sign_result, "Sign failed: {}");
success!("Device info: {}", &device_info); success!("Device info: {}", &device_info);
success!("Sign challenge: {}", u2fv2_challenge_str); success!("Sign challenge: {}", u2fv2_challenge_str);