use super::{AuthenticationState, Card, CardIoDefault};
use crate::{Error, StatusCode, io};
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Unauthenticated;
impl AuthenticationState for Unauthenticated {}
impl<'card, IoBackendT> CardIoDefault<IoBackendT> for Card<'card, IoBackendT, Unauthenticated>
where
IoBackendT: io::Backend,
{
async fn default_exchange_multi<'a>(
&mut self,
output: &'a mut [u8],
header: &[u8],
data: &[&[u8]],
) -> Result<(StatusCode, &'a [u8]), Error<IoBackendT::Error>> {
io::plain_multi(&self.card, output, header, data).await
}
}
impl<'card, IoBackendT> Card<'card, IoBackendT, Unauthenticated>
where
IoBackendT: io::Backend,
{
pub fn new(card: &'card IoBackendT) -> Self {
Self {
card,
application_id: [0x00, 0x00, 0x00],
authentication: Unauthenticated,
}
}
}