1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
5#[serde(untagged)]
6pub enum MFAData {
7 Password { password: String },
8 Recovery { recovery_code: String },
9 Totp { totp_code: String },
10}
11
12#[derive(Deserialize, Debug, Clone, Eq, PartialEq)]
14pub enum MFAMethod {
15 Password,
16 Recovery,
17 Totp,
18}
19
20pub type MFARecoveryCode = String;
22
23#[derive(Deserialize, Debug, Clone)]
25pub struct MFAStatus {
26 pub email_otp: bool,
27 pub trusted_handover: bool,
28 pub email_mfa: bool,
29 pub totp_mfa: bool,
30 pub security_key_mfa: bool,
31 pub recovery_active: bool,
32}
33
34#[derive(Deserialize, Debug, Clone)]
36pub struct TOTPSecret {
37 pub secret: String,
38}
39
40#[derive(Deserialize, Debug, Clone)]
42pub struct MFATicket {
43 #[serde(rename = "_id")]
45 pub id: String,
46
47 pub account_id: String,
49
50 pub token: String,
52
53 pub validated: bool,
56
57 pub authorised: bool,
60
61 pub last_totp_code: Option<String>,
63}