Skip to main content

bitwarden_api_api/models/
two_factor_authenticator_update_request_model.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15/// TwoFactorAuthenticatorUpdateRequestModel : Request model for setting up or updating a user's
16/// Authenticator (TOTP) two-factor configuration.
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
18pub struct TwoFactorAuthenticatorUpdateRequestModel {
19    /// Six-digit TOTP code from the authenticator app, proving the user enrolled
20    /// Bit.Api.Auth.Models.Request.TwoFactorAuthenticatorUpdateRequestModel.Key.
21    #[serde(rename = "token", alias = "Token")]
22    pub token: String,
23    /// TOTP shared secret that the token was minted against; must match the token's bound Key.
24    #[serde(rename = "key", alias = "Key")]
25    pub key: String,
26    /// User-verification token bound to `UserId + Key`. Minted by `GetAuthenticator` and replayed
27    /// on subsequent management calls so the user does not have to re-verify.
28    #[serde(rename = "userVerificationToken", alias = "UserVerificationToken")]
29    pub user_verification_token: String,
30}
31
32impl TwoFactorAuthenticatorUpdateRequestModel {
33    /// Request model for setting up or updating a user's Authenticator (TOTP) two-factor
34    /// configuration.
35    pub fn new(
36        token: String,
37        key: String,
38        user_verification_token: String,
39    ) -> TwoFactorAuthenticatorUpdateRequestModel {
40        TwoFactorAuthenticatorUpdateRequestModel {
41            token,
42            key,
43            user_verification_token,
44        }
45    }
46}