Skip to content

Don't use hybrid, if it is not available - #203

Merged
iinuwa merged 1 commit into
linux-credentials:mainfrom
msirringhaus:filter_available_transports
Aug 19, 2026
Merged

Don't use hybrid, if it is not available#203
iinuwa merged 1 commit into
linux-credentials:mainfrom
msirringhaus:filter_available_transports

Conversation

@msirringhaus

Copy link
Copy Markdown
Collaborator

Based on #135, because there I extended the blp-file quite a bit, and here I wanted to reformat it again, as there were some issues with closing brackets and wrong/misleading indentations.
Only the last commit right now is relevant. Will be rebased, once the other PR lands.

Using update_devices() to filter out hybrid from the UI, if it is not available, and also filter it out in get_available_public_key_devices() and start_discovery() (where it seems to me, we do sort of the same thing twice, but I haven't touched that yet).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the credentialsd ↔ UI D-Bus protocol to support “PIN not set” remediation (setting a new device PIN), and updates the GTK UI to hide Hybrid transport when it isn’t available, along with a substantial Blueprint UI reformat.

Changes:

  • Add a new PinNotSet background event + D-Bus method/signal pair to support “set device PIN” flows.
  • Update USB/NFC credential services to surface PinNotSet with a structured reason, and accept a newly provided PIN.
  • Update GTK UI + Blueprint to conditionally show Hybrid transport, and add a “Set PIN on device” UI flow.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
credentialsd/src/dbus/ui_control.rs Adds D-Bus surface for notify_pin_not_set and set_device_pin event wiring.
credentialsd/src/dbus/flow_control.rs Routes SetDevicePin UI events to the device state channels.
credentialsd/src/credential_service/usb.rs Adds USB PinNotSet state/reason propagation and PIN setup handling.
credentialsd/src/credential_service/nfc.rs Adds NFC PinNotSet state/reason propagation and PIN setup handling.
credentialsd/src/credential_service/mod.rs Filters transports for discovery and hides Hybrid when unavailable.
credentialsd-ui/src/gui/view_model/mod.rs Adds view event + update handling for setting a new device PIN.
credentialsd-ui/src/gui/view_model/gtk/window.rs Adds callbacks and stack navigation for the new PIN-setting UI.
credentialsd-ui/src/gui/view_model/gtk/mod.rs Adds view-model properties to drive Hybrid visibility and PIN-setting UI states.
credentialsd-ui/src/gui/mod.rs Introduces ViewUpdate::PinNotSet.
credentialsd-ui/src/dbus.rs Adds UI-side D-Bus handler for notify_pin_not_set and emits set_device_pin.
credentialsd-ui/src/client.rs Adds FlowControlClient::set_device_pin with length guarding and memfd transport.
credentialsd-ui/po/de_DE.po Minor translation file formatting change.
credentialsd-ui/data/resources/ui/window.blp Reformat + adds Hybrid-visibility gating and new “set PIN” pages/buttons.
credentialsd-common/src/model.rs Adds shared PinNotSetError, NotifyPinNotSetOptions, and SetDevicePin event types.
Suppressed comments (2)

credentialsd/src/dbus/flow_control.rs:243

  • This log message is in the SetDevicePin path but still says “client PIN”, which is misleading (this is the new device PIN being set).
                            tracing::error!("Failed to send client PIN to device");

credentialsd/src/dbus/flow_control.rs:248

  • The “Invalid state” message in the SetDevicePin path still refers to “client PIN”, which makes diagnosing the set-PIN flow harder.
                        tracing::error!(
                            "Invalid state: received a client PIN with no pending request."
                        );

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread credentialsd/src/credential_service/mod.rs Outdated
Comment thread credentialsd-ui/src/gui/view_model/gtk/window.rs
Comment thread credentialsd-ui/src/gui/view_model/gtk/mod.rs Outdated
Comment thread credentialsd/src/dbus/flow_control.rs Outdated
Comment thread credentialsd/src/credential_service/usb.rs Outdated
@msirringhaus
msirringhaus requested a review from iinuwa August 11, 2026 09:11
id: String::from("0"),
transport: Transport::Usb,
}];
if libwebauthn::transport::ble::is_available().await {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though BLE availability is the same thing as hybrid availability right now, for semantics, let's check hybrid transport explicitly. (Soon, there will be other ways to use hybrid that don't involve BLE.)

Suggested change
if libwebauthn::transport::ble::is_available().await {
if libwebauthn::transport::cable::is_available().await {

Comment on lines +269 to +274
self.set_hybrid_transport_available(false);
for dev in devices {
if dev.transport == Transport::HybridLinked || dev.transport == Transport::HybridQr {
self.set_hybrid_transport_available(true);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.set_hybrid_transport_available(false);
for dev in devices {
if dev.transport == Transport::HybridLinked || dev.transport == Transport::HybridQr {
self.set_hybrid_transport_available(true);
}
}
let hybrid_available = devices.any(|dev| dev.transport == Transport::HybridLinked || dev.transport == Transport::HybridQr);
self.set_hybrid_transport_available(hybrid_available);

Comment thread credentialsd-ui/data/resources/ui/window.blp

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (2)

credentialsd/src/credential_service/mod.rs:227

  • This re-checks transport availability after get_available_public_key_devices() has already sent a snapshot to the UI. If Bluetooth is enabled or disabled between session creation and DiscoveryRequested, the UI and discovery streams diverge: hybrid can remain visible with no hybrid stream, or its stream can run while the hybrid UI is hidden. Use the same availability snapshot for both operations, or propagate an updated device list whenever discovery re-probes transports.
        let available_transports = available_transports().await;

.editorconfig:19

  • A single extension should not use the brace-alternation form: many EditorConfig glob implementations treat {blp} literally because it contains no alternatives, so this section will not apply to .blp files. Use a direct extension glob.
[*.{blp}]

@msirringhaus
msirringhaus requested a review from iinuwa August 19, 2026 06:25

@iinuwa iinuwa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this works well!

@iinuwa

iinuwa commented Aug 19, 2026

Copy link
Copy Markdown
Member

I think it would be good to have a mechanism to update the list of devices/authenticator sources again once hybrid becomes available again. Once we have that, the backend should prompt the user to turn on Bluetooth to connect to another device. The backend would have to know whether hybrid could ever be available though... I don't think we can distinguish between the case where someone has Bluetooth turned off in hardware vs not having Bluetooth at all, so maybe we should just assume that they could have Bluetooth and prompt them to turn it on.

The backend spec does not currently have a method to notify that the authenticator sources have changed. I'll add an issue to track that.

@iinuwa
iinuwa merged commit 8945c6a into linux-credentials:main Aug 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants