diff --git a/crates/bitwarden/src/vault/cipher/cipher.rs b/crates/bitwarden/src/vault/cipher/cipher.rs index 49586028d..9bf4bbd25 100644 --- a/crates/bitwarden/src/vault/cipher/cipher.rs +++ b/crates/bitwarden/src/vault/cipher/cipher.rs @@ -59,9 +59,9 @@ pub struct Cipher { pub view_password: bool, pub local_data: Option, - pub attachments: Vec, - pub fields: Vec, - pub password_history: Vec, + pub attachments: Option>, + pub fields: Option>, + pub password_history: Option>, pub creation_date: DateTime, pub deleted_date: Option>, @@ -93,9 +93,9 @@ pub struct CipherView { pub view_password: bool, pub local_data: Option, - pub attachments: Vec, - pub fields: Vec, - pub password_history: Vec, + pub attachments: Option>, + pub fields: Option>, + pub password_history: Option>, pub creation_date: DateTime, pub deleted_date: Option>, @@ -202,7 +202,7 @@ impl Cipher { let Some(login) = &self.login else { return Ok(String::new()); }; - login.username.decrypt(enc, org_id).unwrap_or_default() + login.username.decrypt(enc, org_id)?.unwrap_or_default() } CipherType::SecureNote => String::new(), CipherType::Card => { @@ -273,7 +273,11 @@ impl Decryptable for Cipher { reprompt: self.reprompt, edit: self.edit, view_password: self.view_password, - attachments: self.attachments.len() as u32, + attachments: self + .attachments + .as_ref() + .map(|a| a.len() as u32) + .unwrap_or(0), creation_date: self.creation_date, deleted_date: self.deleted_date, revision_date: self.revision_date, diff --git a/crates/bitwarden/src/vault/cipher/field.rs b/crates/bitwarden/src/vault/cipher/field.rs index df492eac6..9fa05257a 100644 --- a/crates/bitwarden/src/vault/cipher/field.rs +++ b/crates/bitwarden/src/vault/cipher/field.rs @@ -24,8 +24,8 @@ pub enum FieldType { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct Field { - name: EncString, - value: EncString, + name: Option, + value: Option, r#type: FieldType, linked_id: Option, @@ -35,8 +35,8 @@ pub struct Field { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct FieldView { - name: String, - value: String, + name: Option, + value: Option, r#type: FieldType, linked_id: Option, diff --git a/crates/bitwarden/src/vault/cipher/login.rs b/crates/bitwarden/src/vault/cipher/login.rs index bbcb7b232..941aed221 100644 --- a/crates/bitwarden/src/vault/cipher/login.rs +++ b/crates/bitwarden/src/vault/cipher/login.rs @@ -27,7 +27,7 @@ pub enum UriMatchType { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct LoginUri { - pub uri: EncString, + pub uri: Option, pub r#match: Option, } @@ -35,7 +35,7 @@ pub struct LoginUri { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct LoginUriView { - pub uri: String, + pub uri: Option, pub r#match: Option, } @@ -43,11 +43,11 @@ pub struct LoginUriView { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct Login { - pub username: EncString, - pub password: EncString, + pub username: Option, + pub password: Option, pub password_revision_date: Option>, - pub uris: Vec, + pub uris: Option>, pub totp: Option, pub autofill_on_page_load: Option, } @@ -56,11 +56,11 @@ pub struct Login { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct LoginView { - pub username: String, - pub password: String, + pub username: Option, + pub password: Option, pub password_revision_date: Option>, - pub uris: Vec, + pub uris: Option>, pub totp: Option, pub autofill_on_page_load: Option, } diff --git a/crates/bitwarden/src/vault/send.rs b/crates/bitwarden/src/vault/send.rs index 8a8fba147..124b9dc2f 100644 --- a/crates/bitwarden/src/vault/send.rs +++ b/crates/bitwarden/src/vault/send.rs @@ -36,7 +36,7 @@ pub struct SendFileView { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct SendText { - pub text: EncString, + pub text: Option, pub hidden: bool, } @@ -44,7 +44,7 @@ pub struct SendText { #[serde(rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "mobile", derive(uniffi::Record))] pub struct SendTextView { - pub text: String, + pub text: Option, pub hidden: bool, }