Skip to main content

bitwarden_auth/login/models/
key_connector_user_decryption_option.rs

1use serde::{Deserialize, Serialize};
2
3use crate::login::api::response::KeyConnectorUserDecryptionOptionApiResponse;
4
5/// SDK domain model for Key Connector user decryption option.
6#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
7#[serde(rename_all = "camelCase")]
8#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
9#[bitwarden_ffi::wasm_record]
10pub struct KeyConnectorUserDecryptionOption {
11    /// URL of the Key Connector server to use for decryption.
12    pub key_connector_url: String,
13}
14
15impl From<KeyConnectorUserDecryptionOptionApiResponse> for KeyConnectorUserDecryptionOption {
16    fn from(api: KeyConnectorUserDecryptionOptionApiResponse) -> Self {
17        Self {
18            key_connector_url: api.key_connector_url,
19        }
20    }
21}
22
23#[cfg(test)]
24mod tests {
25    use super::*;
26
27    #[test]
28    fn test_key_connector_conversion() {
29        let api = KeyConnectorUserDecryptionOptionApiResponse {
30            key_connector_url: "https://key-connector.example.com".to_string(),
31        };
32
33        let domain: KeyConnectorUserDecryptionOption = api.clone().into();
34
35        assert_eq!(domain.key_connector_url, api.key_connector_url);
36    }
37}