implements the AuthenticatorSelection command

This commit is contained in:
Fabian Kaczmarczyck
2020-06-09 12:07:00 +02:00
parent 0316d7f7e4
commit c3f57f0121
3 changed files with 39 additions and 1 deletions

View File

@@ -368,8 +368,10 @@ where
Command::AuthenticatorGetInfo => self.process_get_info(),
Command::AuthenticatorClientPin(params) => self.process_client_pin(params),
Command::AuthenticatorReset => self.process_reset(cid),
#[cfg(feature = "with_ctap2_1")]
Command::AuthenticatorSelection => self.process_selection(cid),
// TODO(kaczmarczyck) implement GetNextAssertion and FIDO 2.1 commands
_ => unimplemented!(),
_ => self.process_unknown_command(),
};
#[cfg(feature = "debug_ctap")]
writeln!(&mut Console::new(), "Sending response: {:#?}", response).unwrap();
@@ -1094,6 +1096,16 @@ where
Ok(ResponseData::AuthenticatorReset)
}
#[cfg(feature = "with_ctap2_1")]
fn process_selection(&self, cid: ChannelID) -> Result<ResponseData, Ctap2StatusCode> {
(self.check_user_presence)(cid)?;
Ok(ResponseData::AuthenticatorSelection)
}
fn process_unknown_command(&self) -> Result<ResponseData, Ctap2StatusCode> {
Err(Ctap2StatusCode::CTAP1_ERR_INVALID_COMMAND)
}
pub fn generate_auth_data(&self, rp_id_hash: &[u8], flag_byte: u8) -> Vec<u8> {
let mut auth_data = vec![];
auth_data.extend(rp_id_hash);