Skip to content

daemon: Offer devices based on libwebauthn's available transports - #253

Merged
msirringhaus merged 1 commit into
linux-credentials:mainfrom
kpanuragh:available-transports-ui
Nov 10, 2026
Merged

msirringhaus merged 1 commit into
linux-credentials:mainfrom
kpanuragh:available-transports-ui

Conversation

@kpanuragh

Copy link
Copy Markdown
Contributor

Refs #32.

get_available_public_key_devices() now builds the device list shown in the UI from libwebauthn::available_transports(), the same source start_discovery() already uses. Before, USB was hard-coded and hybrid and NFC were checked separately.

  • The mapping is a small pure function (devices_for_transports) with unit tests.
  • Device IDs stay the same per transport ("0" USB, "1" hybrid QR, "2" NFC).
  • No change in what's offered today: in libwebauthn 0.11, hybrid::is_available() and the Hybrid entry of available_transports() both come from ble::is_available().

Tested with meson test --interactive (5/5 OK) and cargo clippy.

One question I didn't want to change silently: the device list offers NFC when a reader is present, but NFC discovery in start_discovery() is commented out (the SoloKey framing issue in the TODO). So choosing NFC in the UI currently can't find a device. Should NFC be left out of the list until discovery is re-enabled? Happy to add that here or in a follow-up.

Build the list of devices offered to the user from
libwebauthn::available_transports(), the same source start_discovery()
already uses, instead of hard-coding USB and checking hybrid and NFC
separately. The device selection and discovery can then no longer
disagree, and a transport libwebauthn reports in the future only needs
a mapping entry.

The mapping is a pure function with tests. Device IDs stay the same per
transport ("0" USB, "1" hybrid QR, "2" NFC). In libwebauthn 0.11,
hybrid::is_available() and the Hybrid entry of available_transports()
both come from ble::is_available(), so the offered devices don't change.

Refs linux-credentials#32
@msirringhaus

Copy link
Copy Markdown
Collaborator

This is similar to what I tried to do in #231 (amongst lots of other things, which I never finished...).
What I additionally did there was to get rid of the dummy devices completely and only send a list of available transports, which is all we care about on the UI-side anyways. At least I haven't seen an advantage to sending fake devices instead of simply a list of transports. @iinuwa Is there some reason to keep doing that?

Another duplication that could be addressed in this PR is to have only one place where available_transports() is called. Currently, I think there are two that serve basically the same purpose. In the mentioned PR, I added a list of available transports to the RequestContext, filled that once on create_session(). This list is then used in start_discovery() instead of calling available_transports() there again.
But I let @iinuwa also chime in here, as my PR never reached a state where a full review was made, so I don't know if this approach is desired.

@iinuwa

iinuwa commented Nov 10, 2026

Copy link
Copy Markdown
Member

At least I haven't seen an advantage to sending fake devices instead of simply a list of transports. @iinuwa Is there some reason to keep doing that?

No this was a placeholder for a implementation once we had persisted devices. We just haven't gotten there yet.

Another duplication that could be addressed in this PR is to have only one place where available_transports() is called. Currently, I think there are two that serve basically the same purpose. In the mentioned PR, I added a list of available transports to the RequestContext, filled that once on create_session(). This list is then used in start_discovery() instead of calling available_transports() there again.

yes, we should return the transports from init_request instead of flow_control retrieving it manually. But this can be a follow-up.

I'm fine to merge this as is and address the other concerns in another PR. @msirringhaus, if you're OK with addressing the merge conflicts later, could you merge?

@iinuwa
iinuwa requested a review from msirringhaus November 10, 2026 13:54

@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.

There are more follow-ups to this, but this is a good start on its own.

@msirringhaus

Copy link
Copy Markdown
Collaborator

Yes, I can address the other things later.
Thanks all!

@msirringhaus
msirringhaus merged commit 27b8e7d into linux-credentials:main Nov 10, 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