Skip to content
Tauri

Biometric

Prompt the user for biometric authentication on Android and iOS.

Supported Platforms

This plugin requires a Rust version of at least 1.77.2

Platform Level Notes
windows
linux
macos
android
ios

Setup

Install the biometric plugin to get started.

Use your project’s package manager to add the dependency:

npm run tauri add biometric

Configuration

On iOS the biometric plugin requires the NSFaceIDUsageDescription information property list value, which should describe why your app needs to use biometric authentication.

In the src-tauri/Info.ios.plist file, add the following snippet:

src-tauri/Info.ios.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSFaceIDUsageDescription</key>
<string>Authenticate with biometric</string>
</dict>
</plist>

Usage

This plugin enables you to verify the availability of Biometric Authentication on a device, prompt the user for biometric authentication, and check the result to determine if the authentication was successful or not. On Android, it also allows you to encrypt/decrypt data using assymmetric keys that can be accessed only if the user authenticates using their registered biometric authentication method.

Check Status

You can check the status of Biometric Authentication, including its availability and the types of biometric authentication methods supported.

import { checkStatus } from '@tauri-apps/plugin-biometric';
const status = await checkStatus();
if (status.isAvailable) {
console.log('Yes! Biometric Authentication is available');
} else {
console.log(
'No! Biometric Authentication is not available due to ' + status.error
);
}

Authenticate

To prompt the user for Biometric Authentication, utilize the authenticate() method.

import { authenticate } from '@tauri-apps/plugin-biometric';
const options = {
// Set true if you want the user to be able to authenticate using phone password
allowDeviceCredential: false,
cancelTitle: "Feature won't work if Canceled",
// iOS only feature
fallbackTitle: 'Sorry, authentication failed',
// Android only features
title: 'Tauri feature',
subtitle: 'Authenticate to access the locked Tauri function',
confirmationRequired: true,
};
try {
await authenticate('This feature is locked', options);
console.log(
'Hooray! Successfully Authenticated! We can now perform the locked Tauri function!'
);
} catch (err) {
console.log('Oh no! Authentication failed because ' + err.message);
}

Biometric protected cryptography

To encrypt/decrypt data using an asymmetric cryptography method that is protected behind the user Biometric Authentication, utilize the biometricCipher() method.

import { biometricCipher } from '@tauri-apps/plugin-biometric';
// Encrypts data
const encryptOptions = {
// ... other options
dataToEncrypt: getOriginalData(),
};
try {
const encrypted = await biometricCipher(
'Passwordless authentication',
encryptOptions
);
console.log(
'Hooray! Successfully encrypted data! We can now store it to decrypt later, when needed'
);
} catch (err) {
console.log('Oh no! Authentication failed because ' + err.message);
}
// Decrypts data back to the original
const decryptOptions = {
// ... other options
dataToDecrypt: encrypted.data,
};
try {
const original = await biometricCipher(
'Passwordless authentication',
decryptOptions
);
console.log(
'Hooray! Successfully decrypted data after the user authenticated with their biometric method.'
);
const valid = originalData() == dataToDecrypt.data;
} catch (err) {
console.log('Oh no! Authentication failed because ' + err.message);
}

Permissions

By default all potentially dangerous plugin commands and scopes are blocked and cannot be accessed. You must modify the permissions in your capabilities configuration to enable these.

See the Capabilities Overview for more information and the step by step guide to use plugin permissions.

src-tauri/capabilities/default.json
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "main-capability",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": ["biometric:default"]
}

Default Permission

This permission set configures which biometric features are by default exposed.

Granted Permissions

It allows acccess to all biometric commands.

  • allow-authenticate
  • allow-status

Permission Table

Identifier Description

biometric:allow-authenticate

Enables the authenticate command without any pre-configured scope.

biometric:deny-authenticate

Denies the authenticate command without any pre-configured scope.

biometric:allow-status

Enables the status command without any pre-configured scope.

biometric:deny-status

Denies the status command without any pre-configured scope.


© 2025 Tauri Contributors. CC-BY / MIT