diff --git a/libwebauthn/src/transport/ble/btleplug/manager.rs b/libwebauthn/src/transport/ble/btleplug/manager.rs index 37ce0c4..832c7c6 100644 --- a/libwebauthn/src/transport/ble/btleplug/manager.rs +++ b/libwebauthn/src/transport/ble/btleplug/manager.rs @@ -49,6 +49,11 @@ impl SupportedRevisions { } } } + + pub fn select_best(&self) -> Option { + self.select_protocol(FidoProtocol::FIDO2) + .or_else(|| self.select_protocol(FidoProtocol::U2F)) + } } async fn on_peripheral_service_data( @@ -244,3 +249,59 @@ async fn discover_services(peripheral: &Peripheral) -> Result BleChannel<'a> { let (ux_update_sender, _) = broadcast::channel(16); let revision = revisions - .select_protocol(FidoProtocol::U2F) + .select_best() .ok_or(Error::Transport(TransportError::NegotiationFailed))?; let connection = btleplug::connect(&device.btleplug_device.peripheral, &revision) .await