Repository navigation
daemon: Offer devices based on libwebauthn's available transports - #253
Conversation
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
|
This is similar to what I tried to do in #231 (amongst lots of other things, which I never finished...). Another duplication that could be addressed in this PR is to have only one place where |
No this was a placeholder for a implementation once we had persisted devices. We just haven't gotten there yet.
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
left a comment
There was a problem hiding this comment.
There are more follow-ups to this, but this is a good start on its own.
|
Yes, I can address the other things later. |
Refs #32.
get_available_public_key_devices()now builds the device list shown in the UI fromlibwebauthn::available_transports(), the same sourcestart_discovery()already uses. Before, USB was hard-coded and hybrid and NFC were checked separately.devices_for_transports) with unit tests.hybrid::is_available()and theHybridentry ofavailable_transports()both come fromble::is_available().Tested with
meson test --interactive(5/5 OK) andcargo 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.