/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #[macro_use] mod util; #[cfg(any(target_os = "linux"))] extern crate libudev; #[cfg(any(target_os = "freebsd"))] extern crate devd_rs; #[cfg(any(target_os = "macos"))] extern crate core_foundation; extern crate libc; #[macro_use] extern crate log; extern crate rand; extern crate runloop; #[macro_use] extern crate bitflags; pub mod authenticatorservice; mod consts; mod statemachine; mod u2fprotocol; mod u2ftypes; mod manager; pub use crate::manager::U2FManager; mod capi; pub use crate::capi::*; pub mod ctap2; pub use ctap2::attestation::AttestationObject; pub use ctap2::client_data::{CollectedClientData, CollectedClientDataWrapper}; pub use ctap2::commands::client_pin::{Pin, PinError}; pub use ctap2::AssertionObject; mod ctap2_capi; pub use crate::ctap2_capi::*; pub mod errors; pub mod statecallback; mod transport; mod virtualdevices; mod status_update; pub use status_update::*; mod crypto; pub use crypto::COSEAlgorithm; // Keep this in sync with the constants in u2fhid-capi.h. bitflags! { pub struct RegisterFlags: u64 { const REQUIRE_RESIDENT_KEY = 1; const REQUIRE_USER_VERIFICATION = 2; const REQUIRE_PLATFORM_ATTACHMENT = 4; } } bitflags! { pub struct SignFlags: u64 { const REQUIRE_USER_VERIFICATION = 1; } } bitflags! { pub struct AuthenticatorTransports: u8 { const USB = 1; const NFC = 2; const BLE = 4; } } #[derive(Debug, Clone)] pub struct KeyHandle { pub credential: Vec, pub transports: AuthenticatorTransports, } pub type AppId = Vec; pub enum RegisterResult { CTAP1(Vec, u2ftypes::U2FDeviceInfo), CTAP2(AttestationObject, CollectedClientDataWrapper), } pub enum SignResult { CTAP1(AppId, Vec, Vec, u2ftypes::U2FDeviceInfo), CTAP2(AssertionObject, CollectedClientDataWrapper), } pub type ResetResult = (); pub type Result = std::result::Result; #[cfg(test)] #[macro_use] extern crate assert_matches; #[cfg(fuzzing)] pub use consts::*; #[cfg(fuzzing)] pub use u2fprotocol::*; #[cfg(fuzzing)] pub use u2ftypes::*;