1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-24 21:41:33 +01:00

Fix clippy warning

This commit is contained in:
Bernd Schoolmann 2024-12-23 12:22:42 +01:00
parent d40df36167
commit 75b0a3693e
No known key found for this signature in database
5 changed files with 7 additions and 5 deletions

View File

@ -14,7 +14,7 @@ impl super::BiometricTrait for Biometric {
bail!("platform not supported"); bail!("platform not supported");
} }
fn derive_key_material(_iv_str: Option<&str>) -> Result<OsDerivedKey> { async fn derive_key_material(_iv_str: Option<&str>) -> Result<OsDerivedKey> {
bail!("platform not supported"); bail!("platform not supported");
} }

View File

@ -31,7 +31,7 @@ pub struct OsDerivedKey {
pub trait BiometricTrait { pub trait BiometricTrait {
async fn prompt(hwnd: Vec<u8>, message: String) -> Result<bool>; async fn prompt(hwnd: Vec<u8>, message: String) -> Result<bool>;
async fn available() -> Result<bool>; async fn available() -> Result<bool>;
fn derive_key_material(secret: Option<&str>) -> Result<OsDerivedKey>; async fn derive_key_material(secret: Option<&str>) -> Result<OsDerivedKey>;
async fn set_biometric_secret( async fn set_biometric_secret(
service: &str, service: &str,
account: &str, account: &str,

View File

@ -53,7 +53,7 @@ impl super::BiometricTrait for Biometric {
Ok(false) Ok(false)
} }
fn derive_key_material(challenge_str: Option<&str>) -> Result<OsDerivedKey> { async fn derive_key_material(challenge_str: Option<&str>) -> Result<OsDerivedKey> {
let challenge: [u8; 16] = match challenge_str { let challenge: [u8; 16] = match challenge_str {
Some(challenge_str) => base64_engine Some(challenge_str) => base64_engine
.decode(challenge_str)? .decode(challenge_str)?

View File

@ -73,7 +73,7 @@ impl super::BiometricTrait for Biometric {
/// ///
/// Windows will only sign the challenge if the user has successfully authenticated with Windows, /// Windows will only sign the challenge if the user has successfully authenticated with Windows,
/// ensuring user presence. /// ensuring user presence.
fn derive_key_material(challenge_str: Option<&str>) -> Result<OsDerivedKey> { async fn derive_key_material(challenge_str: Option<&str>) -> Result<OsDerivedKey> {
let challenge: [u8; 16] = match challenge_str { let challenge: [u8; 16] = match challenge_str {
Some(challenge_str) => base64_engine Some(challenge_str) => base64_engine
.decode(challenge_str)? .decode(challenge_str)?
@ -103,7 +103,7 @@ impl super::BiometricTrait for Biometric {
let done = Arc::new(AtomicBool::new(false)); let done = Arc::new(AtomicBool::new(false));
let done_clone = done.clone(); let done_clone = done.clone();
let _ = tokio::task::spawn_blocking(move || loop { let focus_future = tokio::task::spawn_blocking(move || loop {
if !done_clone.load(std::sync::atomic::Ordering::Relaxed) { if !done_clone.load(std::sync::atomic::Ordering::Relaxed) {
focus_security_prompt(); focus_security_prompt();
std::thread::sleep(std::time::Duration::from_millis(500)); std::thread::sleep(std::time::Duration::from_millis(500));
@ -114,6 +114,7 @@ impl super::BiometricTrait for Biometric {
let signature = async_operation.get(); let signature = async_operation.get();
done.store(true, std::sync::atomic::Ordering::Relaxed); done.store(true, std::sync::atomic::Ordering::Relaxed);
focus_future.await?;
let signature = signature?; let signature = signature?;
if signature.Status()? != KeyCredentialStatus::Success { if signature.Status()? != KeyCredentialStatus::Success {

View File

@ -106,6 +106,7 @@ pub mod biometrics {
Biometric::derive_key_material(iv.as_deref()) Biometric::derive_key_material(iv.as_deref())
.map(|k| k.into()) .map(|k| k.into())
.map_err(|e| napi::Error::from_reason(e.to_string())) .map_err(|e| napi::Error::from_reason(e.to_string()))
.await
} }
#[napi(object)] #[napi(object)]