Skip to content

Commit 625b830

Browse files
committed
Cargo fmt
1 parent 1920a49 commit 625b830

File tree

21 files changed

+131
-170
lines changed

21 files changed

+131
-170
lines changed

crates/bitwarden-core/src/auth/auth_request.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ mod tests {
111111
use std::num::NonZeroU32;
112112

113113
use bitwarden_crypto::{
114-
BitwardenLegacyKeyContentFormat, Kdf, MasterKey, Bytes,
115-
SpkiPublicKeyDerContentFormat,
114+
BitwardenLegacyKeyContentFormat, Bytes, Kdf, MasterKey, SpkiPublicKeyDerContentFormat,
116115
};
117116

118117
use super::*;

crates/bitwarden-core/src/auth/login/access_token.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
22

33
use base64::{engine::general_purpose::STANDARD, Engine};
44
use bitwarden_crypto::{
5-
BitwardenLegacyKeyContentFormat, EncString, KeyDecryptable, Bytes, SymmetricCryptoKey,
5+
BitwardenLegacyKeyContentFormat, Bytes, EncString, KeyDecryptable, SymmetricCryptoKey,
66
};
77
use chrono::Utc;
88
use schemars::JsonSchema;
@@ -69,8 +69,7 @@ pub(crate) async fn login_access_token(
6969

7070
let payload: Payload = serde_json::from_slice(&decrypted_payload)?;
7171
let encryption_key = STANDARD.decode(&payload.encryption_key)?;
72-
let encryption_key =
73-
Bytes::<BitwardenLegacyKeyContentFormat>::from(encryption_key);
72+
let encryption_key = Bytes::<BitwardenLegacyKeyContentFormat>::from(encryption_key);
7473
let encryption_key = SymmetricCryptoKey::try_from(&encryption_key)?;
7574

7675
let access_token_obj: JwtToken = r.access_token.parse()?;

crates/bitwarden-core/src/client/encryption_settings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl EncryptionSettings {
5858
use crate::key_management::{AsymmetricKeyId, SigningKeyId, SymmetricKeyId};
5959

6060
let private_key = {
61-
use bitwarden_crypto::{Pkcs8PrivateKeyDerContentFormat, Bytes};
61+
use bitwarden_crypto::{Bytes, Pkcs8PrivateKeyDerContentFormat};
6262

6363
let dec: Vec<u8> = private_key.decrypt_with_key(&user_key)?;
6464
let dec: Bytes<Pkcs8PrivateKeyDerContentFormat> = Bytes::from(dec);

crates/bitwarden-core/src/key_management/crypto.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use std::collections::HashMap;
88

99
use base64::{engine::general_purpose::STANDARD, Engine};
1010
use bitwarden_crypto::{
11-
AsymmetricCryptoKey, CoseSerializable, CryptoError, EncString, Kdf, KeyDecryptable,
11+
AsymmetricCryptoKey, Bytes, CoseSerializable, CryptoError, EncString, Kdf, KeyDecryptable,
1212
KeyEncryptable, MasterKey, Pkcs8PrivateKeyDerContentFormat, PrimitiveEncryptable,
13-
Bytes, SignatureAlgorithm, SignedPublicKey, SigningKey, SymmetricCryptoKey,
14-
UnsignedSharedKey, UserKey,
13+
SignatureAlgorithm, SignedPublicKey, SigningKey, SymmetricCryptoKey, UnsignedSharedKey,
14+
UserKey,
1515
};
1616
use bitwarden_error::bitwarden_error;
1717
use schemars::JsonSchema;

crates/bitwarden-crypto/examples/signature.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
//! This example demonstrates how to create signatures and countersignatures for a message, and how
22
//! to verify them.
33
4-
use bitwarden_crypto::{
5-
CoseSerializable, CoseSign1ContentFormat, Bytes, SigningNamespace,
6-
};
4+
use bitwarden_crypto::{Bytes, CoseSerializable, CoseSign1ContentFormat, SigningNamespace};
75
use serde::{Deserialize, Serialize};
86

97
const EXAMPLE_NAMESPACE: &SigningNamespace = &SigningNamespace::SignedPublicKey;

crates/bitwarden-crypto/src/cose.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use generic_array::GenericArray;
1111
use typenum::U32;
1212

1313
use crate::{
14-
content_format::{ConstContentFormat, CoseContentFormat, Bytes},
14+
content_format::{Bytes, ConstContentFormat, CoseContentFormat},
1515
error::{EncStringParseError, EncodingError},
1616
xchacha20, ContentFormat, CryptoError, SymmetricCryptoKey, XChaCha20Poly1305Key,
1717
};

crates/bitwarden-crypto/src/enc_string/asymmetric.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use crate::{
1010
error::{CryptoError, EncStringParseError, Result},
1111
rsa::encrypt_rsa2048_oaep_sha1,
1212
util::FromStrVisitor,
13-
AsymmetricCryptoKey, AsymmetricPublicCryptoKey, BitwardenLegacyKeyContentFormat, RawPrivateKey,
14-
RawPublicKey, Bytes, SymmetricCryptoKey,
13+
AsymmetricCryptoKey, AsymmetricPublicCryptoKey, BitwardenLegacyKeyContentFormat, Bytes,
14+
RawPrivateKey, RawPublicKey, SymmetricCryptoKey,
1515
};
1616
// This module is a workaround to avoid deprecated warnings that come from the ZeroizeOnDrop
1717
// macro expansion
@@ -217,9 +217,9 @@ impl UnsignedSharedKey {
217217
}
218218
}
219219
.map_err(|_| CryptoError::KeyDecrypt)?;
220-
SymmetricCryptoKey::try_from(
221-
&Bytes::<BitwardenLegacyKeyContentFormat>::from(key_data),
222-
)
220+
SymmetricCryptoKey::try_from(&Bytes::<BitwardenLegacyKeyContentFormat>::from(
221+
key_data,
222+
))
223223
}
224224
}
225225
}

crates/bitwarden-crypto/src/fingerprint.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use thiserror::Error;
1010

1111
use crate::{
1212
content_format::SpkiPublicKeyDerContentFormat, error::Result, wordlist::EFF_LONG_WORD_LIST,
13-
CryptoError, Bytes,
13+
Bytes, CryptoError,
1414
};
1515

1616
/// Computes a fingerprint of the given `fingerprint_material` using the given `public_key`.
@@ -93,8 +93,7 @@ mod tests {
9393
197, 3, 219, 56, 77, 109, 47, 72, 251, 131, 36, 240, 96, 169, 31, 82, 93, 166, 242, 3,
9494
33, 213, 2, 3, 1, 0, 1,
9595
];
96-
let key: Bytes<SpkiPublicKeyDerContentFormat> =
97-
Bytes::from(key.to_vec());
96+
let key: Bytes<SpkiPublicKeyDerContentFormat> = Bytes::from(key.to_vec());
9897
assert_eq!(
9998
"turban-deftly-anime-chatroom-unselfish",
10099
fingerprint(user_id, &key).unwrap()

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use serde_repr::{Deserialize_repr, Serialize_repr};
55

66
use super::key_encryptable::CryptoKey;
77
use crate::{
8-
content_format::{
9-
Pkcs8PrivateKeyDerContentFormat, Bytes, SpkiPublicKeyDerContentFormat,
10-
},
8+
content_format::{Bytes, Pkcs8PrivateKeyDerContentFormat, SpkiPublicKeyDerContentFormat},
119
error::{CryptoError, Result},
1210
};
1311

@@ -167,7 +165,7 @@ mod tests {
167165
use base64::{engine::general_purpose::STANDARD, Engine};
168166

169167
use crate::{
170-
content_format::{Pkcs8PrivateKeyDerContentFormat, Bytes},
168+
content_format::{Bytes, Pkcs8PrivateKeyDerContentFormat},
171169
AsymmetricCryptoKey, AsymmetricPublicCryptoKey, SymmetricCryptoKey, UnsignedSharedKey,
172170
};
173171

@@ -206,9 +204,9 @@ DnqOsltgPomWZ7xVfMkm9niL2OA=
206204

207205
// Load the two different formats and check they are the same key
208206
let pem_key = AsymmetricCryptoKey::from_pem(pem_key_str).unwrap();
209-
let der_key = AsymmetricCryptoKey::from_der(&Bytes::<
210-
Pkcs8PrivateKeyDerContentFormat,
211-
>::from(der_key_vec.clone()))
207+
let der_key = AsymmetricCryptoKey::from_der(
208+
&Bytes::<Pkcs8PrivateKeyDerContentFormat>::from(der_key_vec.clone()),
209+
)
212210
.unwrap();
213211
assert_eq!(pem_key.to_der().unwrap(), der_key.to_der().unwrap());
214212

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use super::{
1212
};
1313
use crate::{
1414
util::{self},
15-
BitwardenLegacyKeyContentFormat, CryptoError, EncString, KeyDecryptable, Result,
16-
Bytes, SymmetricCryptoKey, UserKey,
15+
BitwardenLegacyKeyContentFormat, Bytes, CryptoError, EncString, KeyDecryptable, Result,
16+
SymmetricCryptoKey, UserKey,
1717
};
1818

1919
#[allow(missing_docs)]
@@ -160,9 +160,7 @@ pub(super) fn decrypt_user_key(
160160
}
161161
};
162162

163-
SymmetricCryptoKey::try_from(&Bytes::<BitwardenLegacyKeyContentFormat>::from(
164-
dec,
165-
))
163+
SymmetricCryptoKey::try_from(&Bytes::<BitwardenLegacyKeyContentFormat>::from(dec))
166164
}
167165

168166
/// Generate a new random user key and encrypt it with the master key.

0 commit comments

Comments
 (0)