Skip to content
Open
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
16 changes: 13 additions & 3 deletions libwebauthn/src/management/bio_enrollment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
use async_trait::async_trait;
use serde_bytes::ByteBuf;
use std::time::Duration;
use tracing::info;
use tracing::{info, warn};

#[async_trait]
pub trait BioEnrollment {
Expand Down Expand Up @@ -81,7 +81,13 @@ where
let req = Ctap2BioEnrollmentRequest::new_get_modality();
// No UV needed
let resp = self.ctap2_bio_enrollment(&req, timeout).await?;
resp.modality.ok_or(Error::Ctap(CtapError::Other))
match resp.modality {
Some(modality) => Ok(modality),
None => {
warn!("Channel did not return modality.");
Err(Error::Ctap(CtapError::Other))
}
}
}

async fn get_fingerprint_sensor_info(
Expand All @@ -91,8 +97,12 @@ where
let req = Ctap2BioEnrollmentRequest::new_fingerprint_sensor_info();
// No UV needed
let resp = self.ctap2_bio_enrollment(&req, timeout).await?;
let Some(fingerprint_kind) = resp.fingerprint_kind else {
warn!("Channel did not return fingerprint_kind in sensor info.");
return Err(Error::Ctap(CtapError::Other))
};
Ok(Ctap2BioEnrollmentFingerprintSensorInfo {
fingerprint_kind: resp.fingerprint_kind.ok_or(Error::Ctap(CtapError::Other))?,
fingerprint_kind,
max_capture_samples_required_for_enroll: resp
.max_capture_samples_required_for_enroll
.clone(),
Expand Down