File tree Expand file tree Collapse file tree
xyz-iinuwa-credential-manager-portal-gtk/src/credential_service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,18 +61,36 @@ impl InProcessUsbHandler {
6161 for mut device in hid_devices {
6262 let tx = blinking_tx. clone ( ) ;
6363 tokio:: spawn ( async move {
64- let ( mut channel, _state_rx) = device. channel ( ) . await . unwrap ( ) ;
65- let res = channel
66- . blink_and_wait_for_user_presence ( Duration :: from_secs ( 300 ) )
67- . await ;
68- drop ( channel) ;
69- match res {
70- Ok ( true ) => {
71- let _ = tx. send ( Some ( device) ) . await ;
72- }
73- Ok ( false ) | Err ( _) => {
74- let _ = tx. send ( None ) . await ;
75- }
64+ let res = match device. channel ( ) . await {
65+ Ok ( ( ref mut channel, _) ) => channel
66+ . blink_and_wait_for_user_presence ( Duration :: from_secs ( 300 ) )
67+ . await
68+ . map_err ( |err| {
69+ format ! (
70+ "Failed to send wink request to authenticator: {:?}" ,
71+ err
72+ )
73+ } )
74+ . and_then ( |blinking| {
75+ if blinking {
76+ Ok ( ( ) )
77+ } else {
78+ Err ( "Authenticator was not able to blink" . to_string ( ) )
79+ }
80+ } ) ,
81+ Err ( err) => Err ( format ! (
82+ "Failed to create channel for USB authenticator: {:?}" ,
83+ err
84+ ) ) ,
85+ }
86+ . inspect_err ( |err| tracing:: warn!( err) )
87+ . ok ( ) ;
88+
89+ if let Err ( err) = tx. send ( res. map ( |_| device) ) . await {
90+ tracing:: error!(
91+ "Failed to send notification of wink response: {:?}" ,
92+ err,
93+ ) ;
7694 }
7795 } ) ;
7896 }
You can’t perform that action at this time.
0 commit comments