Hybrid transport: Add state-assisted transactions#100
Merged
Conversation
msirringhaus
left a comment
Collaborator
There was a problem hiding this comment.
Only small comments so far
Member
Author
|
Connecting to a known device is now working on Android. I'll add handshake signature verification next, as part of this PR. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for state-assisted caBLE transactions by refactoring the tunnel API, making device storage thread-safe, and parsing/verifying update messages.
- Introduce
CableTunnelConnectionType, separate handshake (do_handshake) from channel setup (channel), and addconnection_recv_updateparsing with HMAC verification. - Make
CableKnownDeviceInfoStorethread-safe (usingArc<Mutex<_>>), defineCableKnownDeviceInfoandCableKnownDeviceflows, and update examples to use a persistent store. - Factor out BLE advertisement handling into
advertisement.rsand update QR code device logic to consume it.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| libwebauthn/src/transport/error.rs | Added UnknownDevice, InvalidKey, and InvalidSignature error variants |
| libwebauthn/src/transport/cable/tunnel.rs | Refactored tunnel connection, added state-assisted flow, parsing of update messages |
| libwebauthn/src/transport/cable/qr_code_device.rs | Switched to Arc store, removed embedded BLE logic, now uses advertisement module |
| libwebauthn/src/transport/cable/known_devices.rs | Thread-safe store implementation, new CableKnownDeviceInfo and CableKnownDevice types |
| libwebauthn/src/transport/cable/advertisement.rs | New BLE advertisement module, extracts and decrypts service data |
| libwebauthn/src/transport/cable/crypto.rs | Changed derive to return a fixed-size [u8; 64] instead of Vec<u8> |
| libwebauthn/src/transport/cable/channel.rs | Simplified CableChannel, removed device enum, added Drop impl to abort tasks |
| libwebauthn/src/transport/ble/btleplug/manager.rs | Updated discovery API to include Adapter in stream items |
| libwebauthn/src/transport/cable/mod.rs | Exposed the new advertisement submodule |
| libwebauthn/examples/webauthn_cable.rs | Example updated to demonstrate persistent known-device flow over QR and state-assisted paths |
Comments suppressed due to low confidence (2)
libwebauthn/src/transport/ble/btleplug/manager.rs:84
- The return type trait bound '+ use<'>' is invalid syntax; it should likely be '+ '', or a correct lifetime specifier.
)-> Result<impl Stream<Item = (Adapter, Peripheral, Vec<u8>)> + use<'_>, Error> {
libwebauthn/src/transport/cable/tunnel.rs:590
- The new function
connection_recv_updatecontains non-trivial parsing logic for CAble update messages but lacks corresponding unit tests. Consider adding tests that cover valid, missing-field, and error cases.
async fn connection_recv_update(message: &[u8]) -> Result<Option<CableLinkingInfo>, Error> {
msirringhaus
approved these changes
May 22, 2025
msirringhaus
left a comment
Collaborator
There was a problem hiding this comment.
Small nitpicks. I currently can't judge the overall spec compliance, but I think you know what you are doing :)
821e2aa to
3cff871
Compare
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
serde_cbor. To be fixed properly with Ignore unknown CTAP response fields #66.