Make device pin-protocol support optional

This commit is contained in:
Shimun 2020-01-07 21:59:38 +01:00
parent 9b663ed7e9
commit 61d81bda87
Signed by: shimun
GPG Key ID: E81D8382DC2F971B

View File

@ -145,7 +145,12 @@ impl FidoDevice {
if !response.versions.iter().any(|ver| ver == "FIDO_2_0") {
Err(FidoErrorKind::DeviceUnsupported)?
}
if !response.pin_protocols.iter().any(|ver| *ver == 1) {
// Require pin protocol version 1, only if pin-protocol is supported at all
if !response
.pin_protocols
.iter()
.fold(true, |supported, ver| *ver == 1 && supported)
{
Err(FidoErrorKind::DeviceUnsupported)?
}
self.needs_pin = response.options.client_pin == Some(true);