@@ -97,7 +97,7 @@ def requires_ssl(self) -> bool:
97
97
98
98
def get_assertion_response (
99
99
self , credential_id : Optional [bytearray ] = None
100
- ) -> bytearray :
100
+ ) -> bytes :
101
101
"""Get assertion from authenticator and return the response.
102
102
103
103
Args:
@@ -165,7 +165,7 @@ def get_assertion_response(
165
165
logger .debug ("WebAuthn - payload response packet: %s" , packet )
166
166
return packet
167
167
168
- def auth_response (self , auth_data : bytes , ** kwargs : Any ) -> int :
168
+ def auth_response (self , auth_data : bytes , ** kwargs : Any ) -> Optional [ bytes ] :
169
169
"""Find authenticator device and check if supports resident keys.
170
170
171
171
It also creates a Fido2Client using the relying party ID from the server.
@@ -194,7 +194,7 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> int:
194
194
if device is not None :
195
195
logger .debug ("WebAuthn - Use USB HID channel" )
196
196
elif CTAP_PCSC_DEVICE_AVAILABLE :
197
- device = next (CtapPcscDevice .list_devices (), None ) # type: ignore[arg-type]
197
+ device = next (CtapPcscDevice .list_devices (), None )
198
198
199
199
if device is None :
200
200
raise errors .InterfaceError ("No FIDO device found" )
@@ -208,10 +208,10 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> int:
208
208
209
209
if not self .client .info .options .get ("rk" ):
210
210
logger .debug ("WebAuthn - Authenticator doesn't support resident keys" )
211
- return 1
211
+ return b"1"
212
212
213
213
logger .debug ("WebAuthn - Authenticator with support for resident key found" )
214
- return 2
214
+ return b"2"
215
215
216
216
def auth_more_response (
217
217
self , sock : "MySQLSocket" , auth_data : bytes , ** kwargs : Any
@@ -271,10 +271,10 @@ def auth_switch_response(
271
271
response = self .auth_response (auth_data )
272
272
credential_id = None
273
273
274
- if response == 1 :
274
+ if response == b"1" :
275
275
# Authenticator doesn't support resident keys, request credential_id
276
276
logger .debug ("WebAuthn - request credential_id" )
277
- sock .send (utils .lc_int (response ))
277
+ sock .send (utils .lc_int (int ( response ) ))
278
278
279
279
# return a packet representing an `auth more data` response
280
280
return bytes (sock .recv ())
0 commit comments