Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Onboarding] Integrate the biometrics #17085

Open
jrainville opened this issue Jan 16, 2025 · 3 comments
Open

[Onboarding] Integrate the biometrics #17085

jrainville opened this issue Jan 16, 2025 · 3 comments

Comments

@jrainville
Copy link
Member

Description

Found here at point 14. #17045 (comment)

The biometrics need to be hooked correctly to the UI

Acceptance Criteria

  • when using a Mac, the prompt to use the biometrics shows when the design shows it
@igor-sirotin
Copy link
Contributor

Keychain component being is implemented here:

For the integration, this has to be done:

  • Instantiate Keychain item:
    Keychain {
        id: keychain
        service: "StatusDesktop"
        reason: qsTr("authenticate you")
    }
  • Call keychain.getCredential(keyUid) to get the password
  • Call keychain.saveCredential(keyUid, password) to save the password
  • keychain.loading property will be true when waiting for user's fingerprint
  • On non-MacOS systems all methods will return false or an empty string.

cc @micieslak

@caybro
Copy link
Member

caybro commented Jan 30, 2025

In the UI we have these props in LoginScreen:

property bool biometricsAvailable: Qt.platform.os === Constants.mac
property bool isBiometricsLogin // old code: `localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store`

// emitted when the user wants to try the biometrics prompt again
signal biometricsRequested()

Then we need to figure out the moment/place where to ask the keychain for the credentials. Additionally we should invoke/display the OS biometrics popup again when the user requests it explicitely via the biometricsRequested() signal.

Furthermore, the LoginScreen expects and reacts to these signals coming from the OnboardingStore:

// biometrics
signal obtainingPasswordSuccess(string password)
signal obtainingPasswordError(string errorDescription, string errorType /* Constants.keychain.errorType.* */, bool wrongFingerprint)

and uses those to either fill the UI with password/pin, or to display an error

@igor-sirotin
Copy link
Contributor

As for the isBiometricsLogin, it seems that MacOS API provides a way to check if the item exists (not read it's value) in the Keychain without prompting for Biometrics/password. If yes, we should reuse it to check if the biometrics is available for the account.

didn't test this:

#import <Security/Security.h>

BOOL keychainItemExists(NSString *service, NSString *account) {
    NSDictionary *query = @{
        (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
        (__bridge id)kSecAttrService: service,
        (__bridge id)kSecAttrAccount: account,
        (__bridge id)kSecReturnAttributes: @NO // Do not return sensitive data
    };
    
    OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, NULL);
    
    return (status == errSecSuccess);
}

@micieslak micieslak self-assigned this Feb 3, 2025
micieslak added a commit that referenced this issue Feb 4, 2025
micieslak added a commit that referenced this issue Feb 4, 2025
micieslak added a commit that referenced this issue Feb 5, 2025
micieslak added a commit that referenced this issue Feb 5, 2025
micieslak added a commit that referenced this issue Feb 5, 2025
micieslak added a commit that referenced this issue Feb 5, 2025
micieslak added a commit that referenced this issue Feb 5, 2025
micieslak added a commit that referenced this issue Feb 6, 2025
micieslak added a commit that referenced this issue Feb 6, 2025
micieslak added a commit that referenced this issue Feb 6, 2025
@iurimatias iurimatias moved this from In Progress to Code Review in Status Desktop/Mobile Board Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Code Review
Development

No branches or pull requests

4 participants