webauthn_authenticator_rs/ui/
mod.rs

1use crate::types::{CableRequestType, CableState, EnrollSampleStatus};
2use std::fmt::Debug;
3
4#[cfg(any(all(doc, not(doctest)), feature = "ui-cli"))]
5mod cli;
6
7#[cfg(any(all(doc, not(doctest)), feature = "ui-cli"))]
8#[doc(inline)]
9pub use self::cli::Cli;
10
11pub trait UiCallback: Sync + Send + Debug {
12    /// Prompts the user to enter their PIN.
13    fn request_pin(&self) -> Option<String>;
14
15    /// Prompts the user to interact with their authenticator, normally by
16    /// pressing or touching its button.
17    ///
18    /// This method will be called synchronously, and must not block.
19    fn request_touch(&self);
20
21    /// Tell the user that the key is currently processing a request.
22    fn processing(&self);
23
24    /// Provide the user feedback when they are enrolling fingerprints.
25    ///
26    /// This method will be called synchronously, and must not block.
27    fn fingerprint_enrollment_feedback(
28        &self,
29        remaining_samples: u32,
30        feedback: Option<EnrollSampleStatus>,
31    );
32
33    /// Prompt the user to scan a QR code with their mobile device to start the
34    /// caBLE linking process.
35    ///
36    /// This method will be called synchronously, and must not block.
37    fn cable_qr_code(&self, request_type: CableRequestType, url: String);
38
39    /// Dismiss a displayed QR code from the screen.
40    ///
41    /// This method will be called synchronously, and must not block.
42    fn dismiss_qr_code(&self);
43
44    fn cable_status_update(&self, state: CableState);
45}