Don't use hybrid, if it is not available - #203
Conversation
There was a problem hiding this comment.
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
PinNotSetbackground event + D-Bus method/signal pair to support “set device PIN” flows. - Update USB/NFC credential services to surface
PinNotSetwith 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
SetDevicePinpath 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
SetDevicePinpath 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.
| id: String::from("0"), | ||
| transport: Transport::Usb, | ||
| }]; | ||
| if libwebauthn::transport::ble::is_available().await { |
There was a problem hiding this comment.
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.)
| if libwebauthn::transport::ble::is_available().await { | |
| if libwebauthn::transport::cable::is_available().await { |
| 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); | ||
| } | ||
| } |
There was a problem hiding this comment.
| 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); |
fb5138d to
7ad3a93
Compare
There was a problem hiding this comment.
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 andDiscoveryRequested, 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.blpfiles. Use a direct extension glob.
[*.{blp}]
|
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. |
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 inget_available_public_key_devices()andstart_discovery()(where it seems to me, we do sort of the same thing twice, but I haven't touched that yet).