Skip to content

Commit

Permalink
Show "processing" status for BTLE and USB keys
Browse files Browse the repository at this point in the history
  • Loading branch information
micolous committed Oct 25, 2023
1 parent 2218d20 commit 0172a9a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions webauthn-authenticator-rs/src/bluetooth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,10 @@ impl Token for BluetoothToken {

if let Response::KeepAlive(r) = resp {
trace!("waiting for {:?}", r);
if r == KeepAliveStatus::UserPresenceNeeded {
ui.request_touch();
match r {
KeepAliveStatus::UserPresenceNeeded => ui.request_touch(),
KeepAliveStatus::Processing => ui.processing(),
_ => (),
}
// TODO: maybe time out at some point
// thread::sleep(Duration::from_millis(100));
Expand Down
5 changes: 5 additions & 0 deletions webauthn-authenticator-rs/src/ui/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ impl UiCallback for Cli {
writeln!(stderr, "Touch the authenticator").ok();
}

fn processing(&self) {
let mut stderr = stderr();
writeln!(stderr, "Processing...").ok();
}

fn fingerprint_enrollment_feedback(
&self,
remaining_samples: u32,
Expand Down
3 changes: 3 additions & 0 deletions webauthn-authenticator-rs/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ pub trait UiCallback: Sync + Send + Debug {
/// This method will be called synchronously, and must not block.
fn request_touch(&self);

/// Tell the user that the key is currently processing a request.
fn processing(&self);

/// Provide the user feedback when they are enrolling fingerprints.
///
/// This method will be called synchronously, and must not block.
Expand Down
6 changes: 4 additions & 2 deletions webauthn-authenticator-rs/src/usb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ impl Token for USBToken {

if let Response::KeepAlive(r) = resp {
trace!("waiting for {:?}", r);
if r == KeepAliveStatus::UserPresenceNeeded {
ui.request_touch();
match r {
KeepAliveStatus::UserPresenceNeeded => ui.request_touch(),
KeepAliveStatus::Processing => ui.processing(),
_ => (),
}
// TODO: maybe time out at some point
tokio::time::sleep(Duration::from_millis(100)).await;
Expand Down

0 comments on commit 0172a9a

Please sign in to comment.