Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
### UI Controller API

- Renamed the `username` field of `Credential` to `display_name`, matching WebAuthn's `user.displayName`.
- `CreateSession` takes the list of available transports (`as`) instead of placeholder devices (`a(ss)`).
- daemon/ui: Add `TransportUnavailable` restart reason, sent when a transport stops after repeated failures; the UI then stops offering it.

## Improvements

- ui: Display restart reason in case of premature failure
- daemon: Stop retrying a transport after 5 consecutive failures before user interaction; other transports keep running.
- daemon: Build the list of devices offered to the user from libwebauthn's `available_transports()`, the same source discovery uses (#32)
- ui: Pass the caller's activation token to the compositor when showing the dialog, so it can take focus when the requesting window is in the background (#152)
- ui: Disable core dumps for the UI process, which handles typed PINs. Build with `-Denable_core_dumps=true` to allow them for debugging (#209)
Expand Down
56 changes: 44 additions & 12 deletions credentialsd-common/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ pub const BACKGROUND_EVENT_ERROR_INTERNAL: u32 = 0x80000001;
pub const BACKGROUND_EVENT_ERROR_TIMED_OUT: u32 = 0x80000002;
pub const BACKGROUND_EVENT_ERROR_CANCELLED: u32 = 0x80000003;
pub const BACKGROUND_EVENT_ERROR_AUTHENTICATOR: u32 = 0x80000004;
pub const BACKGROUND_EVENT_ERROR_NO_CREDENTIALS: u32 = 0x80000005;
pub const BACKGROUND_EVENT_ERROR_CREDENTIAL_EXCLUDED: u32 = 0x80000006;
pub const BACKGROUND_EVENT_ERROR_PIN_ATTEMPTS_EXHAUSTED: u32 = 0x80000007;
pub const BACKGROUND_EVENT_ERROR_PIN_NOT_SET: u32 = 0x80000008;

/// Credential service events intended to inform the UI.
#[derive(Debug, PartialEq)]
Expand All @@ -37,34 +34,40 @@ pub enum BackgroundEvent {
HybridConnected,
/// The hybrid ceremony was interrupted by a non-terminating error and a new
/// QR code is about to be issued. The UI should navigate back to the start
/// page so the new QR becomes visible.
HybridRestarting,
/// page so the new QR becomes visible. With `TransportUnavailable`, hybrid
/// stopped instead and the UI should stop offering it.
HybridRestarting {
reason: TransportRestartReason,
},

NfcIdle,
NfcWaiting,
NfcConnected,
/// The NFC ceremony was interrupted by a non-terminating error and the
/// transport is polling for a new device tap. The UI should navigate back
/// to the start page.
NfcRestarting,
/// to the start page. With `TransportUnavailable`, NFC stopped instead and
/// the UI should stop offering it.
NfcRestarting {
reason: TransportRestartReason,
},

UsbIdle,
UsbWaiting,
UsbSelectingDevice,
UsbConnected,
/// The USB ceremony was interrupted by a non-terminating error and the
/// transport is polling for a device. The UI should navigate back to the
/// start page.
UsbRestarting,
/// start page. With `TransportUnavailable`, USB stopped instead and the UI
/// should stop offering it.
UsbRestarting {
reason: TransportRestartReason,
},

ErrorInternal,
ErrorTimedOut,
ErrorCancelled,
ErrorAuthenticator,
ErrorNoCredentials,
ErrorCredentialExcluded,
ErrorPinAttemptsExhausted,
ErrorPinNotSet,
}

/// Emitted when a client enters a PIN for the selected authenticator.
Expand Down Expand Up @@ -252,6 +255,35 @@ impl Transport {
}
}

/// Machine-readable reason for a transport restart. Shared across all transports.
/// Human-readable strings are built by the UI (gettext).
///
/// Sent over D-Bus as the PascalCase variant name (signature `s`), so variant
/// names must remain stable across releases. Unknown strings deserialize to
/// `Interrupted`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Type)]
#[zvariant(signature = "s")]
#[serde(rename_all = "PascalCase")]
pub enum TransportRestartReason {
/// No matching credentials were found on the device. The user should try
/// a different authenticator.
NoCredentials,
/// Too many incorrect PIN attempts on this device — it is now locked. The
/// user should remove and reinsert the device, or use a different authenticator.
PinAttemptsExhausted,
/// The transport failed repeatedly before the user interacted with it and
/// stopped for the rest of this request; it will not restart. The UI should
/// stop offering it. The other transports keep running.
TransportUnavailable,
/// The ceremony was interrupted before completing — transport error,
/// user cancelled on their phone/device, or an unrecoverable authenticator
/// error. The user should follow the new prompts to retry.
/// Also used when dbus receives an unknown string. Must stay the last
/// variant (`#[serde(other)]` requirement).
#[serde(other)]
Interrupted,
}

pub enum UserInteractedEvent {
/// Start discovery
DiscoveryRequested,
Expand Down
12 changes: 12 additions & 0 deletions credentialsd-ui/data/resources/ui/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ template $CredentialsUiWindow: ApplicationWindow {
Box {
orientation: vertical;
halign: start;
visible: bind template.view-model as <$CredentialManagerViewModel>.security_key_transport_available;

styles [
"cred-source-header",
Expand Down Expand Up @@ -154,6 +155,17 @@ template $CredentialsUiWindow: ApplicationWindow {
wrap: true;
}
}

Label {
label: bind template.view-model as <$CredentialManagerViewModel>.restart_message;
visible: bind template.view-model as <$CredentialManagerViewModel>.restart_message_visible;
margin-top: 16;
margin-start: 24;
margin-end: 24;
margin-bottom: 8;
wrap: true;
styles ["error"]
}
};
}

Expand Down
Loading