Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions libwebauthn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ path = "src/lib.rs"

[features]
default = []
nfc = ["apdu-core", "apdu"]
pcsc = [ "nfc", "dep:pcsc" ]
libnfc = [
"nfc",
"nfc1-sys",
"nfc1",
]

[dependencies]
base64-url = "3.0.0"
Expand Down Expand Up @@ -64,6 +71,11 @@ snow = { version = "0.10", features = ["use-p256"] }
ctap-types = { version = "0.4.0" }
btleplug = "0.11.7"
thiserror = "2.0.12"
apdu-core = { version = "0.4.0", optional = true }
apdu = { version = "0.4.0", optional = true }
pcsc = { version = "2.9.0", optional = true }
nfc1 = { version = "0.6.0", optional = true, default-features = false }
nfc1-sys = { version = "0.3.9", optional = true, default-features = false }

[dev-dependencies]
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
Expand Down
3 changes: 3 additions & 0 deletions libwebauthn/examples/u2f_hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use tokio::sync::broadcast::Receiver;
use tracing_subscriber::{self, EnvFilter};

use libwebauthn::ops::u2f::{RegisterRequest, SignRequest};
#[cfg(not(feature = "nfc"))]
use libwebauthn::transport::hid::list_devices;
#[cfg(feature = "nfc")]
use libwebauthn::transport::nfc::list_devices;
use libwebauthn::transport::{Channel as _, Device};
use libwebauthn::u2f::U2F;

Expand Down
3 changes: 3 additions & 0 deletions libwebauthn/examples/webauthn_hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ use libwebauthn::proto::ctap2::{
Ctap2CredentialType, Ctap2PublicKeyCredentialDescriptor, Ctap2PublicKeyCredentialRpEntity,
Ctap2PublicKeyCredentialUserEntity,
};
#[cfg(not(feature = "nfc"))]
use libwebauthn::transport::hid::list_devices;
#[cfg(feature = "nfc")]
use libwebauthn::transport::nfc::list_devices;
use libwebauthn::transport::{Channel as _, Device};
use libwebauthn::webauthn::{Error as WebAuthnError, WebAuthn};

Expand Down
7 changes: 5 additions & 2 deletions libwebauthn/examples/webauthn_preflight_hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ use libwebauthn::proto::ctap2::{
Ctap2CredentialType, Ctap2PublicKeyCredentialDescriptor, Ctap2PublicKeyCredentialRpEntity,
Ctap2PublicKeyCredentialType, Ctap2PublicKeyCredentialUserEntity,
};
#[cfg(not(feature = "nfc"))]
use libwebauthn::transport::hid::list_devices;
#[cfg(feature = "nfc")]
use libwebauthn::transport::nfc::list_devices;
use libwebauthn::transport::{Channel as _, Device};
use libwebauthn::webauthn::{CtapError, Error as WebAuthnError, WebAuthn};

Expand Down Expand Up @@ -156,7 +159,7 @@ pub async fn main() -> Result<(), Box<dyn Error>> {
}

async fn make_credential_call(
channel: &mut HidChannel<'_>,
channel: &mut impl Channel,
user_id: &[u8],
exclude_list: Option<Vec<Ctap2PublicKeyCredentialDescriptor>>,
) -> Result<Ctap2PublicKeyCredentialDescriptor, WebAuthnError> {
Expand Down Expand Up @@ -194,7 +197,7 @@ async fn make_credential_call(
}

async fn get_assertion_call(
channel: &mut HidChannel<'_>,
channel: &mut impl Channel,
allow_list: Vec<Ctap2PublicKeyCredentialDescriptor>,
) -> Result<GetAssertionResponse, WebAuthnError> {
let challenge: [u8; 32] = thread_rng().gen();
Expand Down
2 changes: 2 additions & 0 deletions libwebauthn/src/transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pub mod device;
pub mod hid;
#[cfg(test)]
pub mod virt;
#[cfg(feature = "nfc")]
pub mod nfc;

mod channel;
mod transport;
Expand Down
Loading
Loading