-
Notifications
You must be signed in to change notification settings - Fork 526
Expand file tree
/
Copy pathcommands.rs
More file actions
39 lines (35 loc) · 1.05 KB
/
commands.rs
File metadata and controls
39 lines (35 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri::{command, AppHandle, Runtime, State};
use crate::{models::*, Biometric, Result};
#[command]
pub(crate) async fn status<R: Runtime>(
_app: AppHandle<R>,
biometric: State<'_, Biometric<R>>,
) -> Result<Status> {
biometric.status()
}
#[command]
#[allow(clippy::too_many_arguments)]
pub(crate) async fn authenticate<R: Runtime>(
_app: AppHandle<R>,
biometric: State<'_, Biometric<R>>,
reason: String,
allow_device_credential: Option<bool>,
cancel_title: Option<String>,
fallback_title: Option<String>,
title: Option<String>,
subtitle: Option<String>,
confirmation_required: Option<bool>,
) -> Result<()> {
let options = AuthOptions {
allow_device_credential: allow_device_credential.unwrap_or(false),
cancel_title,
fallback_title,
title,
subtitle,
confirmation_required,
};
biometric.authenticate(reason, options)
}