bitwarden_core/auth/api/response/
identity_two_factor_response.rs

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
use std::collections::HashMap;

use serde::{Deserialize, Serialize};
use serde_json::Value;

use crate::auth::api::response::two_factor_providers::TwoFactorProviders;

#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct IdentityTwoFactorResponse {
    pub error: String,
    pub error_description: String,
    #[serde(rename = "twoFactorProviders2", alias = "TwoFactorProviders2")]
    pub two_factor_providers: TwoFactorProviders,
    #[serde(rename = "captchaBypassToken", alias = "CaptchaBypassToken")]
    pub captcha_token: Option<String>,

    /// Stores unknown api response fields
    extra: Option<HashMap<String, Value>>,
}

#[cfg(test)]
mod test {
    use super::*;

    impl Default for IdentityTwoFactorResponse {
        fn default() -> Self {
            Self {
                error: "invalid_grant".into(),
                error_description: "Two factor required.".into(),
                two_factor_providers: Default::default(),
                captcha_token: Default::default(),
                extra: Default::default(),
            }
        }
    }
}