example/ctap2: allow changing user_verification_req, check UV bit - #372
Merged
Conversation
micolous
force-pushed
the
ctap2/example-uv
branch
from
August 14, 2026 01:56
f73efeb to
365aeb9
Compare
7 tasks
jschanck
approved these changes
Aug 17, 2026
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.
Currently, the
ctap2example always usesuv = preferred, and can't test the other options without changing the code.The
ctap2_discoverable_credsexample always usesuv = required, but that uses resident keys, which risks bricking CTAP 2.0-only authenticators1. I haven't touched that at all.This change adds a
--uvflag to thectap2example, which defaults topreferred(ie: current behaviour).While we're here, this also makes the
ctap2example check theUVbit of the authenticator's response. Whenuv = required, the example will now reject registration and authentication responses with theUVbit unset, like an RP needs to do.This doesn't set the CredProtect extension or anything like that.
This makes it easy and safe to demonstrate #371, and that it'd be fixed by #370, but this PR is really an enhancement rather than a bugfix.
This also lets the
ctap2example demonstrate self-contained multi-factor authentication without requiring resident keys.Footnotes
Resident keys require storage space, which is extremely limited on hardware authenticators (generally less than 10 slots with undefined size limits). CTAP 2.0 supports adding resident keys, but only CTAP 2.1 can manage and remove them individually. Therefore, the only way to remove a resident key on a CTAP 2.0-only authenticator is with a factory reset, which destroys all key material. ↩