Skip to main content

osdp/reply/
crauth.rs

1//! `osdp_CRAUTHR` (`0x82`) — challenge response.
2//!
3//! # Spec: §7.22
4
5use crate::error::Error;
6use alloc::vec::Vec;
7
8/// `osdp_CRAUTHR` body.
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct CrAuthR {
11    /// Challenge response payload.
12    pub response: Vec<u8>,
13}
14
15impl CrAuthR {
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}