bitwarden_core/auth/login/response/two_factor/
two_factor_providers.rs1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use crate::auth::login::response::two_factor::{
5 authenticator::Authenticator, duo::Duo, email::Email, remember::Remember, web_authn::WebAuthn,
6 yubi_key::YubiKey,
7};
8
9#[allow(missing_docs)]
10#[derive(Serialize, Deserialize, Debug, JsonSchema)]
11#[serde(rename_all = "camelCase", deny_unknown_fields)]
12pub struct TwoFactorProviders {
13 pub authenticator: Option<Authenticator>,
14 pub email: Option<Email>,
16 pub duo: Option<Duo>,
18 pub organization_duo: Option<Duo>,
20 pub yubi_key: Option<YubiKey>,
22 pub remember: Option<Remember>,
24 pub web_authn: Option<WebAuthn>,
26}
27
28impl From<crate::auth::api::response::TwoFactorProviders> for TwoFactorProviders {
29 fn from(api: crate::auth::api::response::TwoFactorProviders) -> Self {
30 Self {
31 authenticator: api.authenticator.map(|_| Authenticator {}),
32 email: api.email.map(Into::into),
33 duo: api.duo.map(Into::into),
34 organization_duo: api.organization_duo.map(Into::into),
35 yubi_key: api.yubi_key.map(Into::into),
36 remember: api.remember.map(Into::into),
37 web_authn: api.web_authn.map(Into::into),
38 }
39 }
40}