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

Fix build

This commit is contained in:
Bernd Schoolmann 2024-12-23 03:42:14 -08:00
parent b83eb707b0
commit db5f0145aa
5 changed files with 6 additions and 7 deletions

View File

@ -14,7 +14,7 @@ impl super::BiometricTrait for Biometric {
bail!("platform not supported"); bail!("platform not supported");
} }
async fn derive_key_material(_iv_str: Option<&str>) -> Result<OsDerivedKey> { 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>;
async fn derive_key_material(secret: Option<&str>) -> Result<OsDerivedKey>; 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)
} }
async fn derive_key_material(challenge_str: Option<&str>) -> Result<OsDerivedKey> { 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.
async fn derive_key_material(challenge_str: Option<&str>) -> Result<OsDerivedKey> { 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 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) { 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,7 +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?; focus_future.join().unwrap();
let signature = signature?; let signature = signature?;
if signature.Status()? != KeyCredentialStatus::Success { if signature.Status()? != KeyCredentialStatus::Success {

View File

@ -104,7 +104,6 @@ pub mod biometrics {
#[napi] #[napi]
pub async fn derive_key_material(iv: Option<String>) -> napi::Result<OsDerivedKey> { pub async fn derive_key_material(iv: Option<String>) -> napi::Result<OsDerivedKey> {
Biometric::derive_key_material(iv.as_deref()) Biometric::derive_key_material(iv.as_deref())
.await
.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()))
} }