Skip to content

Commit

Permalink
Fix handling of residentKey "preferred"
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Nov 18, 2024
1 parent 2deef9b commit 7dfaffb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fido2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
AuthenticatorAttestationResponse,
AuthenticatorAssertionResponse,
AttestationConveyancePreference,
ResidentKeyRequirement,
_as_cbor,
)
from .cose import ES256
Expand Down Expand Up @@ -631,7 +632,6 @@ def do_make_credential(
exclude_list = options.exclude_credentials
extensions = options.extensions
selection = options.authenticator_selection or AuthenticatorSelectionCriteria()
rk = selection.require_resident_key
user_verification = selection.user_verification

on_keepalive = _user_keepalive(self.user_interaction)
Expand Down Expand Up @@ -693,6 +693,18 @@ def _do_make():
except ValueError as e:
raise ClientError.ERR.CONFIGURATION_UNSUPPORTED(e)

can_rk = self.info.options.get("rk", False)
if selection.resident_key == ResidentKeyRequirement.REQUIRED:
if not can_rk:
raise ClientError.ERR.CONFIGURATION_UNSUPPORTED(
"Resident key not supported"
)
rk = True
elif selection.resident_key == ResidentKeyRequirement.PREFERRED:
rk = can_rk
else:
rk = False

if not (rk or internal_uv):
options = None
else:
Expand Down

0 comments on commit 7dfaffb

Please sign in to comment.