Support configure via the Vendor interface (#524)

* Support configure via the Vendor interface

* Adjust tests now that GetInfo is supported on vendor_hid

* Add test for vendor_hid not supporting FIDO command
This commit is contained in:
Liam Murphy
2022-08-08 21:54:46 +10:00
committed by GitHub
parent 4a2217f025
commit 262e505ef7
3 changed files with 40 additions and 8 deletions

View File

@@ -714,6 +714,7 @@ impl CtapState {
}
Command::AuthenticatorVendorUpgrade(params) => self.process_vendor_upgrade(env, params),
Command::AuthenticatorVendorUpgradeInfo => self.process_vendor_upgrade_info(env),
Command::AuthenticatorGetInfo => self.process_get_info(env),
_ => Err(Ctap2StatusCode::CTAP1_ERR_INVALID_COMMAND),
}
}
@@ -3865,8 +3866,7 @@ mod test {
}
#[test]
#[cfg(feature = "vendor_hid")]
fn test_main_hid() {
fn test_get_info_command() {
let mut env = TestEnv::new();
let mut ctap_state = CtapState::new(&mut env, CtapInstant::new(0));
@@ -3880,9 +3880,29 @@ mod test {
response,
Ok(ResponseData::AuthenticatorGetInfo(_))
));
#[cfg(feature = "vendor_hid")]
{
let response = ctap_state.process_parsed_command(
&mut env,
Command::AuthenticatorGetInfo,
VENDOR_CHANNEL,
CtapInstant::new(0),
);
assert!(matches!(
response,
Ok(ResponseData::AuthenticatorGetInfo(_))
));
}
}
#[test]
#[cfg(feature = "vendor_hid")]
fn test_vendor_hid_does_not_support_fido_command() {
let mut env = TestEnv::new();
let mut ctap_state = CtapState::new(&mut env, CtapInstant::new(0));
let response = ctap_state.process_parsed_command(
&mut env,
Command::AuthenticatorGetInfo,
Command::AuthenticatorGetNextAssertion,
VENDOR_CHANNEL,
CtapInstant::new(0),
);