ctap_types/
authenticator.rs

1//! The FIDO CTAP Authenticator API in terms of RPC with our types.
2
3use crate::ctap1;
4use crate::ctap2;
5
6pub use ctap1::Authenticator as Ctap1Authenticator;
7pub use ctap2::Authenticator as Ctap2Authenticator;
8
9#[derive(Clone, Debug, PartialEq)]
10#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
11// clippy says (2022-02-26): large size difference
12// - first is 88 bytes
13// - second is 10456 bytes
14#[allow(clippy::large_enum_variant)]
15pub enum Request<'a> {
16    Ctap1(ctap1::Request<'a>),
17    Ctap2(ctap2::Request<'a>),
18}
19
20#[derive(Clone, Debug, PartialEq)]
21// clippy says...large size difference
22// - first is 0 bytes
23// - second is 1880 bytes
24#[allow(clippy::large_enum_variant)]
25pub enum Response {
26    Ctap1(ctap1::Response),
27    Ctap2(ctap2::Response),
28}
29
30/// Authenticator which supports both CTAP1 and CTAP2.
31pub trait Authenticator: ctap1::Authenticator + ctap2::Authenticator {}
32
33impl<A: ctap1::Authenticator + ctap2::Authenticator> Authenticator for A {}