Skip to main content

bitwarden_api_api/models/
change_kdf_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/// ChangeKdfRequestModel : Dual-shape request: validation accepts either the legacy
16/// (Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.NewMasterPasswordHash,
17/// Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.Key) or new
18/// (Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.AuthenticationData,
19/// Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.UnlockData) payload so the wire
20/// contract can stabilize ahead of caller wiring. `PostKdf` currently honors only the new shape;
21/// legacy-shape dispatch arrives with `ChangeKdfCommand`'s dual-path refactor. All legacy fields
22/// are removed in PM-33141.
23#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
24pub struct ChangeKdfRequestModel {
25    #[serde(rename = "masterPasswordHash", alias = "MasterPasswordHash")]
26    pub master_password_hash: String,
27    #[serde(
28        rename = "newMasterPasswordHash",
29        alias = "NewMasterPasswordHash",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub new_master_password_hash: Option<String>,
33    #[serde(rename = "key", alias = "Key", skip_serializing_if = "Option::is_none")]
34    pub key: Option<String>,
35    #[serde(
36        rename = "authenticationData",
37        alias = "AuthenticationData",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub authentication_data: Option<Box<models::MasterPasswordAuthenticationDataRequestModel>>,
41    #[serde(
42        rename = "unlockData",
43        alias = "UnlockData",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub unlock_data: Option<Box<models::MasterPasswordUnlockDataRequestModel>>,
47}
48
49impl ChangeKdfRequestModel {
50    /// Dual-shape request: validation accepts either the legacy
51    /// (Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.NewMasterPasswordHash,
52    /// Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.Key) or new
53    /// (Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.AuthenticationData,
54    /// Bit.Api.Auth.Models.Request.Accounts.ChangeKdfRequestModel.UnlockData) payload so the wire
55    /// contract can stabilize ahead of caller wiring. `PostKdf` currently honors only the new
56    /// shape; legacy-shape dispatch arrives with `ChangeKdfCommand`'s dual-path refactor. All
57    /// legacy fields are removed in PM-33141.
58    pub fn new(master_password_hash: String) -> ChangeKdfRequestModel {
59        ChangeKdfRequestModel {
60            master_password_hash,
61            new_master_password_hash: None,
62            key: None,
63            authentication_data: None,
64            unlock_data: None,
65        }
66    }
67}