osdp/reply/genauth.rs
1//! `osdp_GENAUTHR` (`0x81`) — generic authenticate response (PIV).
2//!
3//! # Spec: §7.21
4
5use crate::error::Error;
6use alloc::vec::Vec;
7
8/// `osdp_GENAUTHR` body.
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct GenAuthR {
11 /// Authentication response template (TLV).
12 pub response: Vec<u8>,
13}
14
15impl GenAuthR {
16 /// Encode.
17 pub fn encode(&self) -> Result<Vec<u8>, Error> {
18 Ok(self.response.clone())
19 }
20
21 /// Decode.
22 pub fn decode(data: &[u8]) -> Result<Self, Error> {
23 Ok(Self {
24 response: data.to_vec(),
25 })
26 }
27}