new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Plugins and security · all subjects

biometric

12 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Biometric plugin installation commands

The biometric plugin can be installed using: npm run tauri add biometric, yarn run tauri add biometric, pnpm tauri add biometric, deno task tauri add biometric, bun tauri add biometric, or cargo tauri add biometric.

Biometric plugin manual installation Cargo.toml

To manually add the biometric plugin to Cargo.toml, run: cargo add tauri-plugin-biometric --target 'cfg(any(target_os = "android", target_os = "ios"))'

Biometric plugin initialization in lib.rs

To initialize the biometric plugin in src-tauri/src/lib.rs, add the following in the setup closure: #[cfg(mobile)] app.handle().plugin(tauri_plugin_biometric::Builder::new().build());

Biometric plugin JavaScript bindings installation

Install the JavaScript bindings using: npm install @tauri-apps/plugin-biometric, yarn add @tauri-apps/plugin-biometric, pnpm add @tauri-apps/plugin-biometric, deno add npm:@tauri-apps/plugin-biometric, or bun add @tauri-apps/plugin-biometric.

Biometric plugin iOS NSFaceIDUsageDescription requirement

On iOS, the biometric plugin requires the NSFaceIDUsageDescription information property list value in src-tauri/Info.ios.plist to describe why the app needs biometric authentication. The example configuration includes: <key>NSFaceIDUsageDescription</key><string>Authenticate with biometric</string>

Biometric checkStatus JavaScript example

To check biometric authentication status in JavaScript, use: 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); }

Biometric checkStatus Rust example

To check biometric authentication status in Rust, use: use tauri_plugin_biometric::BiometricExt; let status = app_handle.biometric().status().unwrap(); if status.is_available { println!("Yes! Biometric Authentication is available"); } else { println!("No! Biometric Authentication is not available due to: {}", status.error.unwrap()); }

Biometric authenticate options structure

The authenticate() method accepts an options object with the following fields: allowDeviceCredential (boolean, allows authentication using phone password), cancelTitle (string, cancellation button title), fallbackTitle (string, iOS only feature for failed authentication message), title (string, Android only feature for authentication prompt title), subtitle (string, Android only feature for authentication prompt subtitle), and confirmationRequired (boolean, Android only feature).

Biometric authenticate JavaScript example

To prompt the user for biometric authentication in JavaScript, use: import { authenticate } from '@tauri-apps/plugin-biometric'; const options = { allowDeviceCredential: false, cancelTitle: "Feature won't work if Canceled", fallbackTitle: 'Sorry, authentication failed', 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!'); } catch (err) { console.log('Oh no! Authentication failed because ' + err.message); }

Biometric authenticate Rust example

To prompt the user for biometric authentication in Rust, use: use tauri_plugin_biometric::{BiometricExt, AuthOptions}; let options = AuthOptions { allow_device_credential: false, cancel_title: Some("Feature won't work if Canceled".to_string()), fallback_title: Some("Sorry, authentication failed".to_string()), title: Some("Tauri feature".to_string()), subtitle: Some("Authenticate to access the locked Tauri function".to_string()), confirmation_required: Some(true) }; match app_handle.biometric().authenticate("This feature is locked".to_string(), options) { Ok(_) => { println!("Hooray! Successfully Authenticated!"); } Err(e) => { println!("Oh no! Authentication failed because : {e}"); } }

Biometric plugin permission capability configuration

The biometric plugin requires the permission "biometric:default" to be added to the permissions array in the capability configuration file (e.g., src-tauri/capabilities/default.json).

Biometric plugin supported platforms

The biometric plugin supports Android and iOS platforms.

Give your agent this brain