-
Notifications
You must be signed in to change notification settings - Fork 19
Moves UX updates to Channel #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the UX updates system by moving responsibility from the Device trait to the Channel trait. The main goal is to eliminate the need for Device::channel() to return a tuple and enable multiple subscribers to UX updates.
Key changes:
- Refactors Device::channel() to return only the channel instead of a (Channel, Receiver) tuple
- Switches from multi-producer single-consumer (mpsc) to broadcast channels for UX updates
- Wraps PIN entry callbacks with Arc to satisfy Clone requirements for broadcast messages
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| libwebauthn/src/transport/device.rs | Updates Device trait to return only Channel from channel() method |
| libwebauthn/src/transport/channel.rs | Adds broadcast sender/receiver methods and updates UX update handling |
| libwebauthn/src/transport/hid/device.rs | Implements simplified channel() method for HID devices |
| libwebauthn/src/transport/hid/channel.rs | Updates HID channel to use broadcast for UX updates |
| libwebauthn/src/transport/cable/*.rs | Updates Cable transport implementation for broadcast UX updates |
| libwebauthn/src/transport/ble/*.rs | Updates BLE transport implementation for broadcast UX updates |
| libwebauthn/src/lib.rs | Makes UX update types Clone and wraps PIN callback with Arc |
| libwebauthn/examples/*.rs | Updates examples to use new channel API pattern |
7d2e6cf to
00f1293
Compare
00f1293 to
24fce64
Compare
|
Rebased. |
msirringhaus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one small comment/question about the Arc-usage.
Otherwise looking good.
Requires #128. * Surfaces asynchronous transport errors via `CableUxUpdate::Error`. * All Cable errors to use `TransportError`, rather than the generic `Error`.
Requires #126.
Changes:
Channel, so thatDevice::channel()no longer needs to return a tuple (Channel, Channel::UxUpdate)mpsctobroadcast, allowing subscribing more than once. This allows subscribing to events without borrowing the channel mutablyArc, and makes allUxUpdatesClone, asbroadcastrequires the message to beClone