Skip to content

Commit f986b43

Browse files
committed
Fix lints
1 parent 748f6d6 commit f986b43

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

crates/bitwarden-crypto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ no-memory-hardening = [] # Disable memory hardening features
2020
uniffi = [
2121
"bitwarden-encoding/uniffi",
2222
"dep:bitwarden-uniffi-error",
23-
"dep:uniffi"
23+
"dep:uniffi",
2424
] # Uniffi bindings
2525
wasm = ["dep:tsify", "dep:wasm-bindgen"] # WASM support
2626

crates/bitwarden-crypto/src/keys/prf.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ use crate::{CryptoError, SymmetricCryptoKey, utils::stretch_key};
44
///
55
/// The PRF output must be at least 32 bytes long.
66
pub fn derive_symmetric_key_from_prf(prf: &[u8]) -> Result<SymmetricCryptoKey, CryptoError> {
7-
let (secret, _) = prf
8-
.split_at_checked(32)
9-
.ok_or_else(|| CryptoError::InvalidKeyLen)?;
10-
let secret: [u8; 32] = secret.try_into().unwrap();
7+
let (secret, _) = prf.split_at_checked(32).ok_or(CryptoError::InvalidKeyLen)?;
8+
let secret: [u8; 32] = secret.try_into().expect("length to be 32 bytes");
119
// Don't allow uninitialized PRFs
1210
if secret.iter().all(|b| *b == b'\0') {
1311
return Err(CryptoError::ZeroNumber);

crates/bitwarden-crypto/src/store/key_rotation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ pub fn dangerous_get_v2_rotated_account_keys<Ids: KeyIds>(
5656
/// and the `PublicKey` is protected by the `DownstreamKey`. This setup allows:
5757
///
5858
/// - Access to `DownstreamKey` by knowing the `UpstreamKey`
59-
/// - Rotation to a `NewDownstreamKey` by knowing the current `DownstreamKey`, without needing access to
60-
/// the `UpstreamKey`
59+
/// - Rotation to a `NewDownstreamKey` by knowing the current `DownstreamKey`, without needing
60+
/// access to the `UpstreamKey`
6161
#[derive(Serialize, Deserialize, Debug)]
6262
#[serde(rename_all = "camelCase", deny_unknown_fields)]
6363
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
@@ -105,7 +105,7 @@ impl RotateableKeySet {
105105
let encrypted_encapsulation_key = key_pair
106106
.to_public_key()
107107
.to_der()?
108-
.encrypt_with_key(&downstream_key)?;
108+
.encrypt_with_key(downstream_key)?;
109109

110110
Ok(RotateableKeySet {
111111
encapsulated_downstream_key,

0 commit comments

Comments
 (0)