Add aaguid to FidoDevice

This commit is contained in:
Arda Xi 2018-12-28 11:43:44 +01:00
parent af79332fb9
commit 8678eccb9a

View File

@ -102,6 +102,7 @@ pub struct FidoDevice {
needs_pin: bool, needs_pin: bool,
shared_secret: Option<crypto::SharedSecret>, shared_secret: Option<crypto::SharedSecret>,
pin_token: Option<crypto::PinToken>, pin_token: Option<crypto::PinToken>,
aaguid: [u8; 16],
} }
impl FidoDevice { impl FidoDevice {
@ -121,6 +122,7 @@ impl FidoDevice {
needs_pin: false, needs_pin: false,
shared_secret: None, shared_secret: None,
pin_token: None, pin_token: None,
aaguid: [0; 16],
}; };
dev.init()?; dev.init()?;
Ok(dev) Ok(dev)
@ -145,9 +147,16 @@ impl FidoDevice {
Err(FidoErrorKind::DeviceUnsupported)? Err(FidoErrorKind::DeviceUnsupported)?
} }
self.needs_pin = response.options.client_pin == Some(true); self.needs_pin = response.options.client_pin == Some(true);
self.aaguid = response.aaguid;
Ok(()) Ok(())
} }
/// Get the authenticator's AAGUID. This is not unique to an authenticator,
/// but it is unique to the specific brand and model.
pub fn aaguid(&self) -> &[u8] {
&self.aaguid
}
fn init_shared_secret(&mut self) -> FidoResult<()> { fn init_shared_secret(&mut self) -> FidoResult<()> {
let mut request = cbor::ClientPinRequest::default(); let mut request = cbor::ClientPinRequest::default();
request.pin_protocol = 1; request.pin_protocol = 1;