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] [biometric] Allow using biometric authentication to encrypt/decrypt sensitive data #2306

Open
charlesschaefer opened this issue Jan 11, 2025 · 0 comments
Labels
enhancement New feature or request plugin: biometric

Comments

@charlesschaefer
Copy link

charlesschaefer commented Jan 11, 2025

It would be great to biometric plugin to allow to encrypt/decrypt sensitive data using the biometric authentication.
I.e. let's think of an app that encrypts some user's sensitive data using a secret key generated based on a password provided by the user. (password-based-key) To access the data, the user must always type the password (that we can use to regenerate the key and decrypt the data).

To improve the experience, the app can store the password-based-key somewhere and, when the user authenticates using the biometric plugin, it reads the key and uses it to decrypt the needed data. But this is insecure because the password-based-key would be stored in a way that someone could read it.

In android (I don't know about iOS), we can create a CryptoObject that can use biometric data to encrypt some data. We could, then, use the cipher provided by Android to encrypt our password-based-key (ensuring it won't be readable by anyone) and we would be able to decrypt it only when the biometric authentication is successful. And if the user cancels the biometric authentication (or registers a new biometric credential), we can just delete the key (because we can regenerate it if the user provides the correct password).

To allow the code to be consistent between platforms, the plugin could receive a modified AuthOptions with fields to configure to use the encryption and a flag to tell if it must encrypt (and the data to be encrypted) or decrypt the data. And the Result returned by the authenticate() could be filled with the data (encrypted or decrypted). Thus, the plugin consumer won't need to deal with different APIs depending on the platform.

Do you think this can be implemented in a way that can be used both on Android and iOS?

@FabianLars FabianLars added enhancement New feature or request plugin: biometric labels Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin: biometric
Projects
None yet
Development

No branches or pull requests

2 participants