tauri_plugin_biometry/
models.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Default, Serialize, Deserialize)]
4#[serde(rename_all = "camelCase")]
5pub struct AuthOptions {
6 pub allow_device_credential: Option<bool>,
8 pub cancel_title: Option<String>,
10 pub fallback_title: Option<String>,
12 pub title: Option<String>,
14 pub subtitle: Option<String>,
16 pub confirmation_required: Option<bool>,
18}
19
20#[derive(Serialize)]
21pub struct AuthenticatePayload {
22 pub reason: String,
23 #[serde(flatten)]
24 pub options: AuthOptions,
25}
26
27#[derive(Debug, Clone, serde_repr::Deserialize_repr, serde_repr::Serialize_repr)]
28#[repr(u8)]
29pub enum BiometryType {
30 None = 0,
31 Auto = 1,
32 TouchID = 2,
33 FaceID = 3,
34}
35
36#[derive(Debug, Clone, Deserialize, Serialize)]
37#[serde(rename_all = "camelCase")]
38pub struct Status {
39 pub is_available: bool,
40 pub biometry_type: BiometryType,
41 pub error: Option<String>,
42 pub error_code: Option<String>,
43}
44
45#[derive(Debug, Clone, Deserialize, Serialize)]
46#[serde(rename_all = "camelCase")]
47pub struct HasDataResponse {
48 pub has_data: bool,
49}
50
51#[derive(Debug, Clone, Deserialize, Serialize)]
52#[serde(rename_all = "camelCase")]
53pub struct DataOptions {
54 pub domain: String,
55 pub name: String,
56}
57
58#[derive(Debug, Clone, Deserialize, Serialize)]
59#[serde(rename_all = "camelCase")]
60pub struct DataResponse {
61 pub domain: String,
62 pub name: String,
63 pub data: String,
64}
65
66#[derive(Debug, Clone, Deserialize, Serialize)]
67#[serde(rename_all = "camelCase")]
68pub struct GetDataOptions {
69 pub domain: String,
70 pub name: String,
71 pub reason: String,
72 pub cancel_title: Option<String>,
73}
74
75#[derive(Debug, Clone, Deserialize, Serialize)]
76#[serde(rename_all = "camelCase")]
77pub struct SetDataOptions {
78 pub domain: String,
79 pub name: String,
80 pub data: String,
81}
82
83pub type RemoveDataOptions = DataOptions;