use async_trait::async_trait;
use uuid::Uuid;
use crate::{
prelude::WebauthnCError, transport::solokey::SoloKeyToken, transport::Token, ui::UiCallback,
};
use super::Ctap20Authenticator;
#[async_trait]
pub trait SoloKeyAuthenticator {
async fn get_solokey_lock(&mut self) -> Result<bool, WebauthnCError>;
async fn get_solokey_random(&mut self) -> Result<[u8; 57], WebauthnCError>;
async fn get_solokey_uuid(&mut self) -> Result<Uuid, WebauthnCError>;
async fn get_solokey_version(&mut self) -> Result<u32, WebauthnCError>;
}
#[async_trait]
impl<'a, T: Token + SoloKeyToken, U: UiCallback> SoloKeyAuthenticator
for Ctap20Authenticator<'a, T, U>
{
#[inline]
async fn get_solokey_lock(&mut self) -> Result<bool, WebauthnCError> {
self.token.get_solokey_lock().await
}
#[inline]
async fn get_solokey_random(&mut self) -> Result<[u8; 57], WebauthnCError> {
self.token.get_solokey_random().await
}
#[inline]
async fn get_solokey_uuid(&mut self) -> Result<Uuid, WebauthnCError> {
self.token.get_solokey_uuid().await
}
#[inline]
async fn get_solokey_version(&mut self) -> Result<u32, WebauthnCError> {
self.token.get_solokey_version().await
}
}