Skip to content

Commit e095fc4

Browse files
committed
Pass ClientPin.PERMISSIONS when 0.
This will most likely be rejected by the Authenticator, but it seems more correct to pass the value rather than ignore it.
1 parent cd5fe1f commit e095fc4

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

fido2/ctap2/pin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def get_pin_token(
304304
pin_hash = sha256(pin.encode())[:16]
305305
pin_hash_enc = self.protocol.encrypt(shared_secret, pin_hash)
306306

307-
if ClientPin.is_token_supported(self.ctap.info) and permissions:
307+
if ClientPin.is_token_supported(self.ctap.info) and permissions is not None:
308308
cmd = ClientPin.CMD.GET_TOKEN_USING_PIN
309309
else:
310310
cmd = ClientPin.CMD.GET_TOKEN_USING_PIN_LEGACY

tests/device/test_credman.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def test_missing_permissions(ctap2, pin_protocol):
155155
if not ClientPin.is_token_supported(ctap2.info):
156156
pytest.skip("Permissions not supported")
157157

158-
credman = get_credman(ctap2, pin_protocol, ClientPin.PERMISSION(0))
158+
credman = get_credman(ctap2, pin_protocol, ClientPin.PERMISSION.LARGE_BLOB_WRITE)
159159

160160
with pytest.raises(CtapError, match="PIN_AUTH_INVALID"):
161161
credman.get_metadata()

0 commit comments

Comments
 (0)