Skip to content

Commit b7804ac

Browse files
committed
Fix encoding of allowList in CTAP1
1 parent d116d9d commit b7804ac

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

fido2/client/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,9 @@ def do_get_assertion(
445445
app_param,
446446
cred.id,
447447
)
448-
assertions = [AssertionResponse.from_ctap1(app_param, cred, auth_resp)]
448+
assertions = [
449+
AssertionResponse.from_ctap1(app_param, _as_cbor(cred), auth_resp)
450+
]
449451
return AssertionSelection(client_data, assertions)
450452
except ClientError as e:
451453
if e.code == ClientError.ERR.TIMEOUT:

tests/device/conftest.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from fido2.hid import CtapHidDevice, list_descriptors, open_connection, open_device
22
from fido2.cose import CoseKey
3+
from fido2.hid import CAPABILITY
34
from fido2.ctap2 import Ctap2
45
from fido2.ctap2.pin import ClientPin, PinProtocolV1, PinProtocolV2
56
from fido2.ctap2.credman import CredentialManagement
@@ -47,9 +48,10 @@ def __init__(self, printer, reader_name):
4748
self._reader = None
4849
self._dev = self._select()
4950

50-
options = self.ctap2.info.options
51-
if options.get("clientPin") or options.get("uv"):
52-
pytest.exit("Authenticator must be in a newly-reset state!")
51+
if self.has_ctap2():
52+
options = Ctap2(self.device).info.options
53+
if options.get("clientPin") or options.get("uv"):
54+
pytest.exit("Authenticator must be in a newly-reset state!")
5355

5456
self.setup()
5557

@@ -145,9 +147,14 @@ def _connect():
145147
def device(self):
146148
return self._dev
147149

150+
def has_ctap2(self):
151+
return self.device.capabilities & CAPABILITY.CBOR
152+
148153
@property
149154
def ctap2(self):
150-
return Ctap2(self.device)
155+
if self.has_ctap2():
156+
return Ctap2(self.device)
157+
pytest.skip("Authenticator does not support CTAP 2")
151158

152159
@property
153160
def info(self):
@@ -217,7 +224,7 @@ def factory_reset(self, setup=False):
217224
self.setup()
218225

219226
def setup(self):
220-
if ClientPin.is_supported(self.info):
227+
if self.has_ctap2() and ClientPin.is_supported(self.info):
221228
ClientPin(self.ctap2).set_pin(TEST_PIN)
222229

223230

@@ -238,7 +245,8 @@ def dev_manager(pytestconfig, printer):
238245
yield manager
239246

240247
# after the test, reset the device
241-
manager.factory_reset()
248+
if manager.has_ctap2():
249+
manager.factory_reset()
242250

243251

244252
@pytest.fixture

0 commit comments

Comments
 (0)