Skip to content

[feat] [biometric] Adding the capability of encrypting/decrypting data using biometric authentication on Android (Ref. #2306) - #2454

Merged
lucasfernog merged 17 commits into
tauri-apps:v2from
charlesschaefer:v2
Oct 12, 2026
Merged

lucasfernog merged 17 commits into
tauri-apps:v2from
charlesschaefer:v2

Conversation

@charlesschaefer

Copy link
Copy Markdown
Contributor

I've used the current structure of the biometric plugin to use Android's capability of encrypting/decrypting data using a key that can only be accessible when the user successfully authenticates with their registered biometric methods.

More details on the need of this change can be found on the #2306 issue.

Summary of changes:
Kotlin

  • Created the command biometricCipher that will be responsible to encrypt/decrypt data by asking the user for their biometric authentication and, when successful, get a key from android device to make the cryptography process.
  • Extracted some common code to their own functions.
  • Changed the AuthOptions class to include the fields dataToEncrypt and dataToDecrypt
  • Changed the force of authentication methods when using cryptography. Android allows using this feature only when using STRONG methods. When not using cryptography, we'll keep allowing the use of WEAK methods.

JS

  • Added the method biometricCipher
  • Changed the AuthOptions interface to include the fields dataToEncrypt and dataToDecrypt

Rust

  • Changed the AuthOptions struct to include the fields data_to_encrypt and data_to_decrypt
  • Added the CipherResult struct
  • Added the method Biometric.biometric_cipher() to access the similar method on Kotlin's side.

Some implementation notes:

  • I've used a fixed crypto algorythm instead of allowing the consumer to define it (AED with GCM block mode).
  • I detect that the consumer wants to encrypt/decrypt data only by the presence of the fields dataToEncrypt/dataToDecrypt on the AuthOptions object sent by them.
  • The flow is: the consumer can use the authenticate command as usual (if doesn't want to use cryptography) or can use the biometricCipher command (both after checking with the status command) passing the raw data to encrypt or the encrypted data to decrypt.
  • If the key used before to encrypt some raw data is not valid anymore, it will return an error (using the same authenticateResult method that is used with authenticate command).

I'll need some guidance about where to change the site's documentation to include this new method.

…ric auth

Adding the method biometricCipher() that allows to use the biometric authentication to use a generated key from android that can be accessed only through the biometric authentication. The method uses this key to encrypt/decrypt the data provided by the caller in the "options" parameter, with "dataToEncrypt" or "dataToDecrypt" filled.

Changes were done both on Kotlin, Rust and JS sides.
@charlesschaefer

Copy link
Copy Markdown
Contributor Author

Hello guys, anyone available to review this?

@surkaa

surkaa commented Dec 18, 2025

Copy link
Copy Markdown

I am looking forward to this feature! Currently, the biometric plugin lacks the ability to handle cryptographic operations, which is essential for secure credential storage. This PR solves a major pain point for mobile security in Tauri.

@Legend-Master Legend-Master added the platform: android Android specific issues label Mar 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Changes Through d9fe886

There are 9 changes which include biometric with minor, biometric-js with minor, deep-link with patch, deep-link-js with patch, fs with patch, fs-js with patch, single-instance with patch, updater with minor, updater-js with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.55 2.0.56
api-example-js 2.0.51 2.0.52
deep-link-example-js 2.2.16 2.2.17
biometric 2.4.2 2.5.0
biometric-js 2.4.2 2.5.0
deep-link 2.6.1 2.6.2
deep-link-js 2.6.1 2.6.2
fs 2.7.0 2.7.1
fs-js 2.7.0 2.7.1
dialog 2.8.2 2.8.3
dialog-js 2.8.2 2.8.3
http 2.8.2 2.8.3
http-js 2.8.2 2.8.3
persisted-scope 2.4.1 2.4.2
single-instance 2.5.3 2.5.4
updater 2.13.3 2.14.0
updater-js 2.13.3 2.14.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@lucasfernog
lucasfernog merged commit 0374bec into tauri-apps:v2 Oct 12, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants