Skip to content

Commit 9e7b0c6

Browse files
quextendani-garcia
andauthored
Update crates/bitwarden-vault/src/cipher/ssh_key.rs
Co-authored-by: Daniel García <[email protected]>
1 parent 6fceec3 commit 9e7b0c6

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

crates/bitwarden-vault/src/cipher/ssh_key.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,9 @@ impl KeyEncryptable<SymmetricCryptoKey, SshKey> for SshKeyView {
4141
impl KeyDecryptable<SymmetricCryptoKey, SshKeyView> for SshKey {
4242
fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result<SshKeyView, CryptoError> {
4343
Ok(SshKeyView {
44-
private_key: Some(self.private_key.clone())
45-
.decrypt_with_key(key)
46-
.ok()
47-
.flatten()
48-
.ok_or(CryptoError::MissingField("private_key"))?,
49-
public_key: Some(self.public_key.clone())
50-
.decrypt_with_key(key)
51-
.ok()
52-
.flatten()
53-
.ok_or(CryptoError::MissingField("public_key"))?,
54-
fingerprint: Some(self.fingerprint.clone())
55-
.decrypt_with_key(key)
56-
.ok()
57-
.flatten()
58-
.ok_or(CryptoError::MissingField("fingerprint"))?,
44+
private_key: self.private_key.decrypt_with_key(key)?,
45+
public_key: self.public_key.decrypt_with_key(key)?,
46+
fingerprint: self.fingerprint.decrypt_with_key(key)?,
5947
})
6048
}
6149
}

0 commit comments

Comments
 (0)