use crate::PrivateKey;
#[cfg(any(feature = "fido-support"))]
mod ctap2_hid;
#[cfg(any(feature = "fido-support"))]
pub use ctap2_hid::generate_new_ssh_key;
#[cfg(any(feature = "fido-support-mozilla"))]
mod mozilla;
#[cfg(any(feature = "fido-support-mozilla"))]
pub use mozilla::generate_new_ssh_key;
use super::verification::{verify_auth_data, ValidAttestation};
#[derive(Debug)]
pub struct U2FAttestation {
pub auth_data: Vec<u8>,
pub auth_data_sig: Vec<u8>,
pub intermediate: Vec<u8>,
pub challenge: Vec<u8>,
pub alg: i32,
}
#[derive(Debug)]
pub struct FIDOSSHKey {
pub private_key: PrivateKey,
pub attestation: U2FAttestation,
}
impl U2FAttestation {
pub fn verify(&self) -> Result<ValidAttestation, crate::error::Error> {
verify_auth_data(
&self.auth_data,
&self.auth_data_sig,
&self.challenge,
self.alg,
&self.intermediate,
None,
)
}
}