Skip to content

virt: Simplify UserInterface struct#231

Merged
robin-nitrokey merged 2 commits into
mainfrom
virt-ui
Jun 8, 2026
Merged

virt: Simplify UserInterface struct#231
robin-nitrokey merged 2 commits into
mainfrom
virt-ui

Conversation

@robin-nitrokey

@robin-nitrokey robin-nitrokey commented Jun 8, 2026

Copy link
Copy Markdown
Member

This fixes two ergonomic problems with the virt::UserInterface struct that we saw in trussed-dev/fido-authenticator#69:

  • The impl Into<...> wrapper for UserInterface::set_inner does not work as expected. Callers have to add type annotations to make it work, so it is easier to just pass the box directly.
  • To simulate a different user presence level, users have to implement the full UserInterface trait. This PR adds a UserInterface::set_user_presence_level method to override the default Level::Normal.

In practice, the impl Into only makes things more complicated because
type inference does not work and users need to add type annotations:
https://github.com/trussed-dev/fido-authenticator/blob/4bd3629b6695c10152796f9e9d5d5f9583b43a6a/tests/virt/mod.rs#L327
So we can also just pass the box directly.
This makes it easier to test different user presence levels without
having to implement the full UserInterface trait.
@robin-nitrokey robin-nitrokey merged commit 72e8e5e into main Jun 8, 2026
3 checks passed
@robin-nitrokey robin-nitrokey deleted the virt-ui branch June 8, 2026 14:36
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.

2 participants