Skip to content

Commit 532882a

Browse files
committed
Add some comments
1 parent b9353ea commit 532882a

File tree

2 files changed

+13
-0
lines changed
  • xyz-iinuwa-credential-manager-portal-gtk/src/credential_service

2 files changed

+13
-0
lines changed

xyz-iinuwa-credential-manager-portal-gtk/src/credential_service/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,18 @@ enum AuthenticatorResponse {
196196

197197
#[derive(Debug, Clone)]
198198
pub enum Error {
199+
/// Some unknown error with the authenticator occurred.
199200
AuthenticatorError,
201+
/// No matching credentials were found on the device.
200202
NoCredentials,
203+
/// Too many incorrect PIN attempts, and authenticator must be removed and
204+
/// reinserted to continue any more PIN attempts.
205+
///
206+
/// Note that this is different than exhausting the PIN count that fully
207+
/// locks out the device.
201208
PinAttemptsExhausted,
202209
// TODO: We may want to hide the details on this variant from the public API.
210+
/// Something went wrong with the credential service itself, not the authenticator.
203211
Internal(String),
204212
}
205213

xyz-iinuwa-credential-manager-portal-gtk/src/credential_service/usb.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ impl InProcessUsbHandler {
4040
let (cred_tx, mut cred_rx) = mpsc::channel(1);
4141
debug!("polling for USB status");
4242
let mut failures = 0;
43+
// act on current USB USB state, send state changes to the stream, and
44+
// loop until a credential or error is returned.
4345
loop {
4446
tracing::debug!("current usb state: {:?}", state);
4547
let prev_usb_state = state;
@@ -177,6 +179,9 @@ impl InProcessUsbHandler {
177179
None => Err(Error::Internal("Channel disconnected".to_string())),
178180
}
179181
}
182+
// TODO: This match arm does basically the same thing as above, we
183+
// should refactor this so we don't have to update things in two
184+
// places.
180185
UsbStateInternal::NeedsPin { .. }
181186
| UsbStateInternal::NeedsUserVerification { .. }
182187
| UsbStateInternal::NeedsUserPresence => match signal_rx.recv().await {

0 commit comments

Comments
 (0)