Skip to main content

osdp/reply/
piv.rs

1//! `osdp_PIVDATAR` (`0x80`) — PIV data response. Opaque body.
2//!
3//! # Spec: §7.20
4
5use crate::error::Error;
6use alloc::vec::Vec;
7
8/// `osdp_PIVDATAR` body.
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct PivDataR {
11    /// Raw PIV data (often multi-part).
12    pub data: Vec<u8>,
13}
14
15impl PivDataR {
16    /// Encode.
17    pub fn encode(&self) -> Result<Vec<u8>, Error> {
18        Ok(self.data.clone())
19    }
20
21    /// Decode.
22    pub fn decode(data: &[u8]) -> Result<Self, Error> {
23        Ok(Self {
24            data: data.to_vec(),
25        })
26    }
27}