tauri_plugin_biometric/models.rs
1// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2// SPDX-License-Identifier: Apache-2.0
3// SPDX-License-Identifier: MIT
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Default, Serialize)]
8#[serde(rename_all = "camelCase")]
9pub struct AuthOptions {
10 /// Enables authentication using the device's password. This feature is available on both Android and iOS.
11 pub allow_device_credential: bool,
12 /// Label for the Cancel button. This feature is available on both Android and iOS.
13 pub cancel_title: Option<String>,
14 /// Specifies the text displayed on the fallback button if biometric authentication fails. This feature is available iOS only.
15 pub fallback_title: Option<String>,
16 /// Title indicating the purpose of biometric verification. This feature is available Android only.
17 pub title: Option<String>,
18 /// SubTitle providing contextual information of biometric verification. This feature is available Android only.
19 pub subtitle: Option<String>,
20 /// Specifies whether additional user confirmation is required, such as pressing a button after successful biometric authentication. This feature is available Android only.
21 pub confirmation_required: Option<bool>,
22}
23
24#[derive(Debug, Clone, serde_repr::Deserialize_repr)]
25#[repr(u8)]
26pub enum BiometryType {
27 None = 0,
28 TouchID = 1,
29 FaceID = 2,
30}
31
32#[derive(Debug, Clone, Deserialize)]
33#[serde(rename_all = "camelCase")]
34pub struct Status {
35 pub is_available: bool,
36 pub biometry_type: BiometryType,
37 pub error: Option<String>,
38 pub error_code: Option<String>,
39}