Skip to content

Commit 281ac79

Browse files
committed
fmt
1 parent 570281d commit 281ac79

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/content/docs/plugin/biometric.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ if (status.isAvailable) {
9999
```rust
100100
use tauri_plugin_biometric::BiometricExt;
101101

102-
fn check_biometric(app_handle: tauri::AppHandle){
103-
if app_handle.biometric().status().unwrap().is_available {
102+
fn check_biometric(app_handle: tauri::AppHandle) {
103+
let status = app_handle.biometric().status().unwrap();
104+
if status.is_available {
104105
println!("Yes! Biometric Authentication is available");
105106
} else {
106-
println!("No! Biometric Authentication is not available due to : {}", app_handle.biometric().status().unwrap().error.unwrap());
107+
println!("No! Biometric Authentication is not available due to: {}", status.error.unwrap());
107108
}
108109
}
109110
```
@@ -123,7 +124,7 @@ To prompt the user for Biometric Authentication, utilize the `authenticate()` me
123124
import { authenticate } from '@tauri-apps/plugin-biometric';
124125

125126
const options = {
126-
// Set True if you want the user to be able to authenticate using phone password
127+
// Set true if you want the user to be able to authenticate using phone password
127128
allowDeviceCredential: false,
128129
cancelTitle: "Feature won't work if Canceled",
129130

@@ -155,7 +156,7 @@ use tauri_plugin_biometric::{BiometricExt, AuthOptions};
155156

156157
fn bio_auth(app_handle: tauri::AppHandle) {
157158

158-
let options = AuthOptions{
159+
let options = AuthOptions {
159160
// Set True if you want the user to be able to authenticate using phone password
160161
allow_device_credential:false,
161162
cancel_title: Some("Feature won't work if Canceled".to_string()),
@@ -169,9 +170,9 @@ fn bio_auth(app_handle: tauri::AppHandle) {
169170
confirmation_required: Some(true),
170171
};
171172

172-
// If the authentication was succesfull, the function returns Result::Ok()
173-
// And Result::Error() otherwise
174-
match app_handle.biometric().authenticate("This feature is locked".to_string(), options){
173+
// if the authentication was succesfull, the function returns Result::Ok()
174+
// otherwise returns Result::Error()
175+
match app_handle.biometric().authenticate("This feature is locked".to_string(), options) {
175176
Ok(_) => {
176177
println!("Hooray! Successfully Authenticated! We can now perform the locked Tauri function!");
177178
}

0 commit comments

Comments
 (0)