Skip to content

Commit 3d8f13c

Browse files
committed
Follow the same logic as on android
1 parent d5006d7 commit 3d8f13c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/windows.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ fn nudge_hello_dialog_focus_async(retries: u32, delay_ms: u64) {
7575
}
7676

7777
/// Create or open a Windows Hello credential
78-
fn get_credential(name: &str, create_if_missing: bool) -> Result<KeyCredentialRetrievalResult> {
79-
let credential_name = HSTRING::from(name);
78+
fn get_credential(domain: &str, create_if_missing: bool) -> Result<KeyCredentialRetrievalResult> {
79+
let credential_name = HSTRING::from(domain);
8080

8181
// Focus the Hello dialog
8282
nudge_hello_dialog_focus_async(5, 250);
@@ -344,7 +344,7 @@ impl<R: Runtime> Biometry<R> {
344344
}
345345

346346
// Try to open the credential (without creating)
347-
let credential_result = match get_credential(&name, false) {
347+
let credential_result = match get_credential(&domain, false) {
348348
Ok(result) => result,
349349
Err(_) => return Ok(false),
350350
};
@@ -370,8 +370,8 @@ impl<R: Runtime> Biometry<R> {
370370
}))
371371
})?;
372372

373-
let resource = HSTRING::from(&name);
374-
let username = HSTRING::from(&domain);
373+
let resource = HSTRING::from(&domain);
374+
let username = HSTRING::from(&name);
375375

376376
// Try to retrieve the credential without the password
377377
match vault.Retrieve(&resource, &username) {
@@ -395,7 +395,7 @@ impl<R: Runtime> Biometry<R> {
395395
}
396396

397397
// Try to open the credential (without creating)
398-
let credential_result = get_credential(&name, false).map_err(|e| {
398+
let credential_result = get_credential(&domain, false).map_err(|e| {
399399
crate::Error::PluginInvoke(PluginInvokeError::InvokeRejected(ErrorResponse {
400400
code: Some("credentialNotFound".to_string()),
401401
message: Some(format!("Failed to open credential: {:?}", e)),
@@ -430,8 +430,8 @@ impl<R: Runtime> Biometry<R> {
430430
}))
431431
})?;
432432

433-
let resource = HSTRING::from(&name);
434-
let username = HSTRING::from(&domain);
433+
let resource = HSTRING::from(&domain);
434+
let username = HSTRING::from(&name);
435435

436436
// Retrieve the credential with password
437437
let credential = vault.Retrieve(&resource, &username).map_err(|e| {
@@ -501,7 +501,7 @@ impl<R: Runtime> Biometry<R> {
501501
}
502502

503503
// Create or replace the credential
504-
let credential_result = get_credential(&name, true).map_err(|e| {
504+
let credential_result = get_credential(&domain, true).map_err(|e| {
505505
crate::Error::PluginInvoke(PluginInvokeError::InvokeRejected(ErrorResponse {
506506
code: Some("credentialCreationFailed".to_string()),
507507
message: Some(format!("Failed to create credential: {:?}", e)),
@@ -546,8 +546,8 @@ impl<R: Runtime> Biometry<R> {
546546
}))
547547
})?;
548548

549-
let resource = HSTRING::from(&name);
550-
let username = HSTRING::from(&domain);
549+
let resource = HSTRING::from(&domain);
550+
let username = HSTRING::from(&name);
551551
let password = HSTRING::from(&encrypted_data);
552552

553553
// Try to remove existing credential if it exists
@@ -602,8 +602,8 @@ impl<R: Runtime> Biometry<R> {
602602
}))
603603
})?;
604604

605-
let resource = HSTRING::from(&name);
606-
let username = HSTRING::from(&domain);
605+
let resource = HSTRING::from(&domain);
606+
let username = HSTRING::from(&name);
607607

608608
// Try to retrieve and remove the credential
609609
match vault.Retrieve(&resource, &username) {

0 commit comments

Comments
 (0)