1#[cfg(target_os = "linux")]
2mod u2fhid;
3#[cfg(target_os = "linux")]
4use u2fhid::get_authenticator_backend;
56#[cfg(target_os = "macos")]
7mod mozilla;
8#[cfg(target_os = "macos")]
9use mozilla::get_authenticator_backend;
1011#[cfg(target_os = "freebsd")]
12mod mozilla;
13#[cfg(target_os = "freebsd")]
14use mozilla::get_authenticator_backend;
1516#[cfg(target_os = "openbsd")]
17mod mozilla;
18#[cfg(target_os = "openbsd")]
19use mozilla::get_authenticator_backend;
2021#[cfg(target_os = "windows")]
22mod win10;
23#[cfg(target_os = "windows")]
24use win10::get_authenticator_backend;
2526use webauthn_authenticator_rs::{AuthenticatorBackend, WebauthnAuthenticator};
2728/// Gets a [WebauthnAuthenticator] with an appropriate backend for the current platform:
29///
30/// * On Windows, this uses the platform WebAuthn API, available on Windows 10
31/// build 1903 and later.
32///
33/// This supports BLE, NFC and USB tokens.
34///
35/// * On other platforms, this uses Mozilla's `authenticator-rs`.
36///
37/// This only supports USB tokens, and doesn't work on Windows systems which
38/// have the platform WebAuthn API available.
39pub(crate) fn get_authenticator() -> WebauthnAuthenticator<impl AuthenticatorBackend> {
40 WebauthnAuthenticator::new(get_authenticator_backend())
41}