Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/bitwarden-send/src/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ impl Decryptable<KeyIds, SymmetricKeyId, SendView> for Send {
id: self.id,
access_id: self.access_id.clone(),

name: self.name.decrypt(ctx, key).ok().unwrap_or_default(),
notes: self.notes.decrypt(ctx, key).ok().flatten(),
name: self.name.decrypt(ctx, key)?,
notes: self.notes.decrypt(ctx, key)?,
key: Some(URL_SAFE_NO_PAD.encode(k)),
new_password: None,
has_password: self.password.is_some(),

r#type: self.r#type,
file: self.file.decrypt(ctx, key).ok().flatten(),
text: self.text.decrypt(ctx, key).ok().flatten(),
file: self.file.decrypt(ctx, key)?,
text: self.text.decrypt(ctx, key)?,

max_access_count: self.max_access_count,
access_count: self.access_count,
Expand Down
14 changes: 7 additions & 7 deletions crates/bitwarden-vault/src/cipher/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl Decryptable<KeyIds, SymmetricKeyId, CardListView> for Card {
key: SymmetricKeyId,
) -> Result<CardListView, CryptoError> {
Ok(CardListView {
brand: self.brand.decrypt(ctx, key).ok().flatten(),
brand: self.brand.decrypt(ctx, key)?,
})
}
}
Expand All @@ -102,12 +102,12 @@ impl Decryptable<KeyIds, SymmetricKeyId, CardView> for Card {
key: SymmetricKeyId,
) -> Result<CardView, CryptoError> {
Ok(CardView {
cardholder_name: self.cardholder_name.decrypt(ctx, key).ok().flatten(),
exp_month: self.exp_month.decrypt(ctx, key).ok().flatten(),
exp_year: self.exp_year.decrypt(ctx, key).ok().flatten(),
code: self.code.decrypt(ctx, key).ok().flatten(),
brand: self.brand.decrypt(ctx, key).ok().flatten(),
number: self.number.decrypt(ctx, key).ok().flatten(),
cardholder_name: self.cardholder_name.decrypt(ctx, key)?,
exp_month: self.exp_month.decrypt(ctx, key)?,
exp_year: self.exp_year.decrypt(ctx, key)?,
code: self.code.decrypt(ctx, key)?,
brand: self.brand.decrypt(ctx, key)?,
number: self.number.decrypt(ctx, key)?,
})
}
}
Expand Down
22 changes: 11 additions & 11 deletions crates/bitwarden-vault/src/cipher/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,23 +354,23 @@ impl Decryptable<KeyIds, SymmetricKeyId, CipherView> for Cipher {
folder_id: self.folder_id,
collection_ids: self.collection_ids.clone(),
key: self.key.clone(),
name: self.name.decrypt(ctx, ciphers_key).ok().unwrap_or_default(),
notes: self.notes.decrypt(ctx, ciphers_key).ok().flatten(),
name: self.name.decrypt(ctx, ciphers_key)?,
notes: self.notes.decrypt(ctx, ciphers_key)?,
r#type: self.r#type,
login: self.login.decrypt(ctx, ciphers_key).ok().flatten(),
identity: self.identity.decrypt(ctx, ciphers_key).ok().flatten(),
card: self.card.decrypt(ctx, ciphers_key).ok().flatten(),
secure_note: self.secure_note.decrypt(ctx, ciphers_key).ok().flatten(),
ssh_key: self.ssh_key.decrypt(ctx, ciphers_key).ok().flatten(),
login: self.login.decrypt(ctx, ciphers_key)?,
identity: self.identity.decrypt(ctx, ciphers_key)?,
card: self.card.decrypt(ctx, ciphers_key)?,
secure_note: self.secure_note.decrypt(ctx, ciphers_key)?,
ssh_key: self.ssh_key.decrypt(ctx, ciphers_key)?,
favorite: self.favorite,
reprompt: self.reprompt,
organization_use_totp: self.organization_use_totp,
edit: self.edit,
permissions: self.permissions,
view_password: self.view_password,
local_data: self.local_data.decrypt(ctx, ciphers_key).ok().flatten(),
attachments: self.attachments.decrypt(ctx, ciphers_key).ok().flatten(),
fields: self.fields.decrypt(ctx, ciphers_key).ok().flatten(),
local_data: self.local_data.decrypt(ctx, ciphers_key)?,
attachments: self.attachments.decrypt(ctx, ciphers_key)?,
fields: self.fields.decrypt(ctx, ciphers_key)?,
password_history: self
.password_history
.decrypt(ctx, ciphers_key)
Expand Down Expand Up @@ -639,7 +639,7 @@ impl Decryptable<KeyIds, SymmetricKeyId, CipherListView> for Cipher {
folder_id: self.folder_id,
collection_ids: self.collection_ids.clone(),
key: self.key.clone(),
name: self.name.decrypt(ctx, ciphers_key).ok().unwrap_or_default(),
name: self.name.decrypt(ctx, ciphers_key)?,
subtitle: self
.decrypt_subtitle(ctx, ciphers_key)
.ok()
Expand Down
4 changes: 2 additions & 2 deletions crates/bitwarden-vault/src/cipher/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ impl Decryptable<KeyIds, SymmetricKeyId, FieldView> for Field {
key: SymmetricKeyId,
) -> Result<FieldView, CryptoError> {
Ok(FieldView {
name: self.name.decrypt(ctx, key).ok().flatten(),
value: self.value.decrypt(ctx, key).ok().flatten(),
name: self.name.decrypt(ctx, key)?,
value: self.value.decrypt(ctx, key)?,
r#type: self.r#type,
linked_id: self.linked_id,
})
Expand Down
36 changes: 18 additions & 18 deletions crates/bitwarden-vault/src/cipher/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,24 @@ impl Decryptable<KeyIds, SymmetricKeyId, IdentityView> for Identity {
key: SymmetricKeyId,
) -> Result<IdentityView, CryptoError> {
Ok(IdentityView {
title: self.title.decrypt(ctx, key).ok().flatten(),
first_name: self.first_name.decrypt(ctx, key).ok().flatten(),
middle_name: self.middle_name.decrypt(ctx, key).ok().flatten(),
last_name: self.last_name.decrypt(ctx, key).ok().flatten(),
address1: self.address1.decrypt(ctx, key).ok().flatten(),
address2: self.address2.decrypt(ctx, key).ok().flatten(),
address3: self.address3.decrypt(ctx, key).ok().flatten(),
city: self.city.decrypt(ctx, key).ok().flatten(),
state: self.state.decrypt(ctx, key).ok().flatten(),
postal_code: self.postal_code.decrypt(ctx, key).ok().flatten(),
country: self.country.decrypt(ctx, key).ok().flatten(),
company: self.company.decrypt(ctx, key).ok().flatten(),
email: self.email.decrypt(ctx, key).ok().flatten(),
phone: self.phone.decrypt(ctx, key).ok().flatten(),
ssn: self.ssn.decrypt(ctx, key).ok().flatten(),
username: self.username.decrypt(ctx, key).ok().flatten(),
passport_number: self.passport_number.decrypt(ctx, key).ok().flatten(),
license_number: self.license_number.decrypt(ctx, key).ok().flatten(),
title: self.title.decrypt(ctx, key)?,
first_name: self.first_name.decrypt(ctx, key)?,
middle_name: self.middle_name.decrypt(ctx, key)?,
last_name: self.last_name.decrypt(ctx, key)?,
address1: self.address1.decrypt(ctx, key)?,
address2: self.address2.decrypt(ctx, key)?,
address3: self.address3.decrypt(ctx, key)?,
city: self.city.decrypt(ctx, key)?,
state: self.state.decrypt(ctx, key)?,
postal_code: self.postal_code.decrypt(ctx, key)?,
country: self.country.decrypt(ctx, key)?,
company: self.company.decrypt(ctx, key)?,
email: self.email.decrypt(ctx, key)?,
phone: self.phone.decrypt(ctx, key)?,
ssn: self.ssn.decrypt(ctx, key)?,
username: self.username.decrypt(ctx, key)?,
passport_number: self.passport_number.decrypt(ctx, key)?,
license_number: self.license_number.decrypt(ctx, key)?,
})
}
}
Expand Down
12 changes: 6 additions & 6 deletions crates/bitwarden-vault/src/cipher/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,11 @@ impl Decryptable<KeyIds, SymmetricKeyId, LoginView> for Login {
key: SymmetricKeyId,
) -> Result<LoginView, CryptoError> {
Ok(LoginView {
username: self.username.decrypt(ctx, key).ok().flatten(),
password: self.password.decrypt(ctx, key).ok().flatten(),
username: self.username.decrypt(ctx, key)?,
password: self.password.decrypt(ctx, key)?,
password_revision_date: self.password_revision_date,
uris: self.uris.decrypt(ctx, key).ok().flatten(),
totp: self.totp.decrypt(ctx, key).ok().flatten(),
uris: self.uris.decrypt(ctx, key)?,
totp: self.totp.decrypt(ctx, key)?,
autofill_on_page_load: self.autofill_on_page_load,
fido2_credentials: self.fido2_credentials.clone(),
})
Expand All @@ -403,9 +403,9 @@ impl Decryptable<KeyIds, SymmetricKeyId, LoginListView> for Login {
.map(|fido2_credentials| fido2_credentials.decrypt(ctx, key))
.transpose()?,
has_fido2: self.fido2_credentials.is_some(),
username: self.username.decrypt(ctx, key).ok().flatten(),
username: self.username.decrypt(ctx, key)?,
totp: self.totp.clone(),
uris: self.uris.decrypt(ctx, key).ok().flatten(),
uris: self.uris.decrypt(ctx, key)?,
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bitwarden-vault/src/folder/folder_models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Decryptable<KeyIds, SymmetricKeyId, FolderView> for Folder {
) -> Result<FolderView, CryptoError> {
Ok(FolderView {
id: self.id,
name: self.name.decrypt(ctx, key).ok().unwrap_or_default(),
name: self.name.decrypt(ctx, key)?,
revision_date: self.revision_date,
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bitwarden-vault/src/password_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Decryptable<KeyIds, SymmetricKeyId, PasswordHistoryView> for PasswordHistor
key: SymmetricKeyId,
) -> Result<PasswordHistoryView, CryptoError> {
Ok(PasswordHistoryView {
password: self.password.decrypt(ctx, key).ok().unwrap_or_default(),
password: self.password.decrypt(ctx, key)?,
last_used_date: self.last_used_date,
})
}
Expand Down