webauthn_authenticator_rs/ctap2/
solokey.rs1use async_trait::async_trait;
2use uuid::Uuid;
3
4use crate::{
5 prelude::WebauthnCError, transport::solokey::SoloKeyToken, transport::Token, ui::UiCallback,
6};
7
8use super::Ctap20Authenticator;
9
10#[async_trait]
21pub trait SoloKeyAuthenticator {
22 async fn get_solokey_lock(&mut self) -> Result<bool, WebauthnCError>;
24
25 async fn get_solokey_random(&mut self) -> Result<[u8; 57], WebauthnCError>;
27
28 async fn get_solokey_uuid(&mut self) -> Result<Uuid, WebauthnCError>;
30
31 async fn get_solokey_version(&mut self) -> Result<u32, WebauthnCError>;
33}
34
35#[async_trait]
36impl<'a, T: Token + SoloKeyToken, U: UiCallback> SoloKeyAuthenticator
37 for Ctap20Authenticator<'a, T, U>
38{
39 #[inline]
40 async fn get_solokey_lock(&mut self) -> Result<bool, WebauthnCError> {
41 self.token.get_solokey_lock().await
42 }
43
44 #[inline]
45 async fn get_solokey_random(&mut self) -> Result<[u8; 57], WebauthnCError> {
46 self.token.get_solokey_random().await
47 }
48
49 #[inline]
50 async fn get_solokey_uuid(&mut self) -> Result<Uuid, WebauthnCError> {
51 self.token.get_solokey_uuid().await
52 }
53
54 #[inline]
55 async fn get_solokey_version(&mut self) -> Result<u32, WebauthnCError> {
56 self.token.get_solokey_version().await
57 }
58}