INNER CODE UNIT · Rust
test_wink
google/OpenSK · libraries/opensk/src/lib.rs:164
fn test_wink() {
let env = TestEnv::default();
let mut ctap = Ctap::<TestEnv>::new(env);
// Send Init, receive Init response and check wink if disabled.
let mut init_response = ctap.process_hid_packet(&init_packet(), Transport::MainHid);
let response_packet = init_response.next().unwrap();
assert_eq!(response_packet[4], 0x86);
let cid = *array_ref!(response_packet, 15, 4);
assert!(!ctap.should_wink());
// Send Wink, receive Wink response and check wink is enabled.
let mut lock_response = ctap.process_hid_packet(&wink_packet(&cid), Transport::MainHid);
let response_packet = lock_response.next().unwrap();
assert_eq!(response_packet[4], 0x88);
assert!(ctap.should_wink());
}