diff --git a/apps/desktop/desktop_native/core/src/biometric/macos.rs b/apps/desktop/desktop_native/core/src/biometric/macos.rs index de5a8d1e02..ec09d566e1 100644 --- a/apps/desktop/desktop_native/core/src/biometric/macos.rs +++ b/apps/desktop/desktop_native/core/src/biometric/macos.rs @@ -14,7 +14,7 @@ impl super::BiometricTrait for Biometric { bail!("platform not supported"); } - async fn derive_key_material(_iv_str: Option<&str>) -> Result { + fn derive_key_material(_iv_str: Option<&str>) -> Result { bail!("platform not supported"); } diff --git a/apps/desktop/desktop_native/core/src/biometric/mod.rs b/apps/desktop/desktop_native/core/src/biometric/mod.rs index f41a319385..79be43b1bf 100644 --- a/apps/desktop/desktop_native/core/src/biometric/mod.rs +++ b/apps/desktop/desktop_native/core/src/biometric/mod.rs @@ -31,7 +31,7 @@ pub struct OsDerivedKey { pub trait BiometricTrait { async fn prompt(hwnd: Vec, message: String) -> Result; async fn available() -> Result; - async fn derive_key_material(secret: Option<&str>) -> Result; + fn derive_key_material(secret: Option<&str>) -> Result; async fn set_biometric_secret( service: &str, account: &str, diff --git a/apps/desktop/desktop_native/core/src/biometric/unix.rs b/apps/desktop/desktop_native/core/src/biometric/unix.rs index 85bbd7b2ed..e57b77515e 100644 --- a/apps/desktop/desktop_native/core/src/biometric/unix.rs +++ b/apps/desktop/desktop_native/core/src/biometric/unix.rs @@ -53,7 +53,7 @@ impl super::BiometricTrait for Biometric { Ok(false) } - async fn derive_key_material(challenge_str: Option<&str>) -> Result { + fn derive_key_material(challenge_str: Option<&str>) -> Result { let challenge: [u8; 16] = match challenge_str { Some(challenge_str) => base64_engine .decode(challenge_str)? diff --git a/apps/desktop/desktop_native/core/src/biometric/windows.rs b/apps/desktop/desktop_native/core/src/biometric/windows.rs index a68ba397a3..632755e883 100644 --- a/apps/desktop/desktop_native/core/src/biometric/windows.rs +++ b/apps/desktop/desktop_native/core/src/biometric/windows.rs @@ -73,7 +73,7 @@ impl super::BiometricTrait for Biometric { /// /// Windows will only sign the challenge if the user has successfully authenticated with Windows, /// ensuring user presence. - async fn derive_key_material(challenge_str: Option<&str>) -> Result { + fn derive_key_material(challenge_str: Option<&str>) -> Result { let challenge: [u8; 16] = match challenge_str { Some(challenge_str) => base64_engine .decode(challenge_str)? @@ -103,7 +103,7 @@ impl super::BiometricTrait for Biometric { let done = Arc::new(AtomicBool::new(false)); let done_clone = done.clone(); - let focus_future = tokio::task::spawn_blocking(move || loop { + let focus_future = std::thread::spawn(move || loop { if !done_clone.load(std::sync::atomic::Ordering::Relaxed) { focus_security_prompt(); std::thread::sleep(std::time::Duration::from_millis(500)); @@ -114,7 +114,7 @@ impl super::BiometricTrait for Biometric { let signature = async_operation.get(); done.store(true, std::sync::atomic::Ordering::Relaxed); - focus_future.await?; + focus_future.join().unwrap(); let signature = signature?; if signature.Status()? != KeyCredentialStatus::Success { diff --git a/apps/desktop/desktop_native/napi/src/lib.rs b/apps/desktop/desktop_native/napi/src/lib.rs index caf92e3131..3ceef666d8 100644 --- a/apps/desktop/desktop_native/napi/src/lib.rs +++ b/apps/desktop/desktop_native/napi/src/lib.rs @@ -104,7 +104,6 @@ pub mod biometrics { #[napi] pub async fn derive_key_material(iv: Option) -> napi::Result { Biometric::derive_key_material(iv.as_deref()) - .await .map(|k| k.into()) .map_err(|e| napi::Error::from_reason(e.to_string())) }