diff --git a/libwebauthn/examples/webauthn_cable.rs b/libwebauthn/examples/webauthn_cable.rs index 760d504..bce86a9 100644 --- a/libwebauthn/examples/webauthn_cable.rs +++ b/libwebauthn/examples/webauthn_cable.rs @@ -35,7 +35,7 @@ fn setup_logging() { pub async fn main() -> Result<(), Box> { setup_logging(); - let mut device_info_store: Box = + let _device_info_store: Box = Box::new(EphemeralDeviceInfoStore::default()); // Create QR code diff --git a/libwebauthn/src/proto/ctap2/model.rs b/libwebauthn/src/proto/ctap2/model.rs index 48728bb..ae3ff35 100644 --- a/libwebauthn/src/proto/ctap2/model.rs +++ b/libwebauthn/src/proto/ctap2/model.rs @@ -4,8 +4,6 @@ use std::convert::TryFrom; use std::io::Cursor as IOCursor; use byteorder::{BigEndian, ReadBytesExt}; -use ctap_types::ctap2::make_credential::AttestationStatement; -use futures::future::Map; use num_enum::{IntoPrimitive, TryFromPrimitive}; use serde_bytes::ByteBuf; use serde_cbor::Value; diff --git a/libwebauthn/src/transport/ble/bluez/manager.rs b/libwebauthn/src/transport/ble/bluez/manager.rs index fdef7a7..69c50b0 100644 --- a/libwebauthn/src/transport/ble/bluez/manager.rs +++ b/libwebauthn/src/transport/ble/bluez/manager.rs @@ -4,7 +4,6 @@ use std::thread::sleep; use std::time::Duration; use tracing::{debug, info, instrument, span, trace, warn, Level}; -use x509_parser::nom::bytes::complete::tag_no_case; use super::device::{FidoDevice as Device, FidoEndpoints as Endpoints}; use super::gatt::{get_gatt_characteristic, get_gatt_service}; diff --git a/libwebauthn/src/transport/cable/channel.rs b/libwebauthn/src/transport/cable/channel.rs index 381e1e4..bb6f1ad 100644 --- a/libwebauthn/src/transport/cable/channel.rs +++ b/libwebauthn/src/transport/cable/channel.rs @@ -1,19 +1,10 @@ -use core::error; use std::fmt::{Display, Formatter}; use std::time::Duration; use async_trait::async_trait; -use futures::stream::FusedStream; -use futures::SinkExt; -use snow::TransportState; -use tokio::net::TcpStream; use tokio::sync::mpsc; use tokio::task; -use tokio_stream::wrappers::ReceiverStream; -use tokio_stream::StreamExt; -use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; -use tracing::{debug, error, instrument, trace, warn}; -use tungstenite::protocol::Message; // This brings the `next()` method into scope +use tracing::error; use crate::proto::{ ctap1::apdu::{ApduRequest, ApduResponse}, @@ -70,24 +61,24 @@ impl<'d> Channel for CableChannel<'d> { // TODO Send CableTunnelMessageType#Shutdown and drop the connection } - async fn apdu_send(&self, request: &ApduRequest, timeout: Duration) -> Result<(), Error> { + async fn apdu_send(&self, _request: &ApduRequest, _timeout: Duration) -> Result<(), Error> { error!("APDU send not supported in caBLE transport"); Err(Error::Transport(TransportError::TransportUnavailable)) } - async fn apdu_recv(&self, timeout: Duration) -> Result { + async fn apdu_recv(&self, _timeout: Duration) -> Result { error!("APDU recv not supported in caBLE transport"); Err(Error::Transport(TransportError::TransportUnavailable)) } - async fn cbor_send(&mut self, request: &CborRequest, timeout: Duration) -> Result<(), Error> { + async fn cbor_send(&mut self, request: &CborRequest, _timeout: Duration) -> Result<(), Error> { self.cbor_sender .send(request.clone()) .await .or(Err(Error::Transport(TransportError::TransportUnavailable))) } - async fn cbor_recv(&mut self, timeout: Duration) -> Result { + async fn cbor_recv(&mut self, _timeout: Duration) -> Result { self.cbor_receiver .recv() .await diff --git a/libwebauthn/src/transport/cable/known_devices.rs b/libwebauthn/src/transport/cable/known_devices.rs index effb8ec..b2a56ea 100644 --- a/libwebauthn/src/transport/cable/known_devices.rs +++ b/libwebauthn/src/transport/cable/known_devices.rs @@ -61,7 +61,7 @@ pub struct CableKnownDeviceInfo { #[derive(Debug)] pub struct CableKnownDevice<'d> { pub device_info: CableKnownDeviceInfo, - store: &'d mut Box, + _store: &'d mut Box, } impl<'d> Display for CableKnownDevice<'d> { diff --git a/libwebauthn/src/transport/cable/qr_code_device.rs b/libwebauthn/src/transport/cable/qr_code_device.rs index a74a588..e4f0bb9 100644 --- a/libwebauthn/src/transport/cable/qr_code_device.rs +++ b/libwebauthn/src/transport/cable/qr_code_device.rs @@ -2,7 +2,6 @@ use std::fmt::{Debug, Display}; use std::time::{Duration, SystemTime}; use async_trait::async_trait; -use p256::ecdh::EphemeralSecret; use p256::elliptic_curve::sec1::ToEncodedPoint; use p256::{NonZeroScalar, SecretKey}; use rand::rngs::OsRng; @@ -239,7 +238,7 @@ impl Display for CableQrCodeDevice<'_> { #[async_trait] impl<'d> Device<'d, Cable, CableChannel<'d>> for CableQrCodeDevice<'_> { async fn channel(&'d mut self) -> Result, Error> { - let (device, advert) = self.await_advertisement().await?; + let (_device, advert) = self.await_advertisement().await?; let Some(tunnel_domain) = tunnel::decode_tunnel_server_domain(advert.encoded_tunnel_server_domain) diff --git a/libwebauthn/src/transport/cable/tunnel.rs b/libwebauthn/src/transport/cable/tunnel.rs index 18fd89e..f5e56a6 100644 --- a/libwebauthn/src/transport/cable/tunnel.rs +++ b/libwebauthn/src/transport/cable/tunnel.rs @@ -1,29 +1,23 @@ use ctap_types::serde::cbor_deserialize; -use futures::{Sink, SinkExt, StreamExt}; -use p256::ecdh::EphemeralSecret; -use p256::elliptic_curve::sec1::ToEncodedPoint; -use p256::elliptic_curve::FieldBytes; -use p256::{NonZeroScalar, SecretKey}; +use futures::{SinkExt, StreamExt}; +use p256::NonZeroScalar; use serde::Deserialize; use serde_bytes::ByteBuf; use serde_indexed::DeserializeIndexed; use sha2::{Digest, Sha256}; -use snow::params::NoiseParams; use snow::{Builder, TransportState}; -use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::TcpStream; use tokio::sync::mpsc::{self, Receiver, Sender}; use tokio::task::{self, JoinHandle}; use tokio_tungstenite::tungstenite::http::StatusCode; use tokio_tungstenite::tungstenite::Message; use tokio_tungstenite::{connect_async, MaybeTlsStream, WebSocketStream}; -use tracing::{debug, error, info, trace, warn}; +use tracing::{debug, error, trace, warn}; use super::channel::{CableChannel, CableChannelDevice}; use super::qr_code_device::CableQrCodeDevice; -use crate::proto::ctap2::cbor::{self, CborRequest, CborResponse}; +use crate::proto::ctap2::cbor::{CborRequest, CborResponse}; use crate::proto::ctap2::{Ctap2CommandCode, Ctap2GetInfoResponse}; -use crate::transport::error::CtapError; use crate::transport::error::Error; use crate::webauthn::TransportError; @@ -39,6 +33,7 @@ const PADDING_GRANULARITY: usize = 32; const CABLE_PROLOGUE_QR_INITIATED: &[u8] = &[1 as u8]; enum TransactionType { + #[allow(dead_code)] // TODO StateAssisted StateAssisted, QRInitiated, } @@ -161,7 +156,7 @@ pub async fn connect<'d>( } debug!("Tunnel server returned success"); - let mut noise_state = do_handshake( + let noise_state = do_handshake( &mut ws_stream, psk, private_key, @@ -309,7 +304,7 @@ async fn connection( mut ws_stream: WebSocketStream>, mut noise_state: TransportState, mut cbor_tx_recv: Receiver, - mut cbor_rx_send: Sender, + cbor_rx_send: Sender, ) { // Fetch the inital message let get_info_response_serialized: Vec = match ws_stream.next().await { @@ -343,7 +338,7 @@ async fn connection( Ok(message) => { debug!("Received WSS message"); trace!(?message); - connection_recv(message, &cbor_rx_send, &mut noise_state).await; + let _ = connection_recv(message, &cbor_rx_send, &mut noise_state).await; } }; } @@ -353,11 +348,11 @@ async fn connection( Ctap2CommandCode::AuthenticatorGetInfo => { debug!("Responding to GetInfo request with cached response"); let response = CborResponse::new_success_from_slice(&get_info_response_serialized); - cbor_rx_send.send(response).await; + let _ = cbor_rx_send.send(response).await; } _ => { debug!(?request.command, "Sending CBOR request"); - connection_send(request, &mut ws_stream, &mut noise_state).await; + let _ = connection_send(request, &mut ws_stream, &mut noise_state).await; } } } diff --git a/libwebauthn/src/transport/error.rs b/libwebauthn/src/transport/error.rs index bdea8d8..0794fd9 100644 --- a/libwebauthn/src/transport/error.rs +++ b/libwebauthn/src/transport/error.rs @@ -46,7 +46,7 @@ impl From for Error { } impl From for Error { - fn from(error: snow::Error) -> Self { + fn from(_error: snow::Error) -> Self { Error::Transport(TransportError::NegotiationFailed) } }