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

feat: implemented biometrics authentication for SecureCredentialsManager using androidx.biometrics package #745

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

desusai7
Copy link
Contributor

@desusai7 desusai7 commented Jun 10, 2024

Migrated to use BioMetricManager for performing Authentication before accessing credentials via SecureCredentialsManager

Breaking Changes:

  • Removed the requireAuthentication API which used to be a pre-requisite previously for performing authentication while retrieving Credentials as it is no longer needed.

New API:

  • Added a new API getCredentialsWithAuthentication in SecureCredentialsManager which is responsible for performing authentication before retrieving credentials. It's no longer needed to call requireAuthentication before retrieving credentials.

Other changes:

  • We've added a optional dependency on androidx.biometrics package to use the BiometricsManager for authentication purposes and this dependency needs to be added only by the users who are using SecureCredentialsManager
  • Added class LocalAuthenticationManager which consolidates all the logic for interacting with the BiometricsManager
  • Added class LocalAuthenticationOptions which helps to configure the behaviour of the BiometricsManager like title, description displayed within in the biometric prompt and the level of authentication required.
  • Updated CredentialsManagerException to contain enum Code describing the reason for exception and allowing users to check all the cases of CredentialsManagerException and handle accordingly

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. Since this library has unit testing, tests should be added for new functionality and existing tests should complete without errors.

  • This change adds unit test coverage
  • This change adds integration test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

Comment on lines +73 to +76
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
callback.onSuccess(true)
}

Check warning

Code scanning / CodeQL

Insecure local authentication Medium

This authentication callback does not use its result for a cryptographic operation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant