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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[secure-store] Add canUseBiometricAuthentication function #26767

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

behenate
Copy link
Member

@behenate behenate commented Jan 29, 2024

Why

fixes #26777

Secure-store will throw an error when trying to save a value with requireAuthentication set to true but no biometrics (or insufficient biometrics) are enrolled. This is good, but it's the only way (without using expo-local-authentication) of checking if the value can be saved. This is not ideal.
This PR adds a small convenience function that allows our users to check if requireAuthentication can be used before saving the value.

Any suggestions for a better name for the method are appreciated! 馃槃

How

On Android used existing assertion function, handled the exception by returning false if it occurred, otherwise true. On iOS used LAContext to check currently enrolled biometrics.

Test Plan

Tested in BareExpo on iOS 16 and Android 13 devices.

@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jan 29, 2024
Copy link
Member

@amandeepmittal amandeepmittal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm 馃憤

Left a minor suggestion.

packages/expo-secure-store/src/SecureStore.ts Outdated Show resolved Hide resolved
Copy link
Member

@tsapeta tsapeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could use the new function in NCL example and test-suite

@behenate behenate merged commit f8d3020 into main Jan 31, 2024
1 check passed
@behenate behenate deleted the @behenate/secure-store-add-can-require-authentication branch January 31, 2024 13:33
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to determine Biometric Security Level
6 participants