INNER CODE UNIT · Rust
wink_packet
google/OpenSK · libraries/opensk/src/lib.rs:159
fn wink_packet(cid: &[u8; 4]) -> HidPacket {
assemble_packet(cid, 0x08, &[])
}
#[test]
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);