Skip to content

Commit 7ee0278

Browse files
committed
Cleanup
1 parent fd22ded commit 7ee0278

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

crates/bitwarden-crypto/src/content_format.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ use crate::{
1414
/// a Pkcs8 private key, or a COSE key. Specifically, for COSE keys, this allows distinguishing
1515
/// between the old symmetric key format, represented as `ContentFormat::OctetStream`, and the new
1616
/// COSE key format, represented as `ContentFormat::CoseKey`.
17-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
18-
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
19-
pub enum ContentFormat {
17+
#[derive(Clone, Copy, Debug, PartialEq)]
18+
pub(crate) enum ContentFormat {
2019
/// UTF-8 encoded text
2120
Utf8,
2221
/// Pkcs8 private key DER
@@ -35,8 +34,6 @@ pub enum ContentFormat {
3534
BitwardenLegacyKey,
3635
/// Stream of bytes
3736
OctetStream,
38-
/// CBOR serialized data
39-
Cbor,
4037
}
4138

4239
mod private {
@@ -51,6 +48,7 @@ mod private {
5148
/// which can still be mis-used, but has to be misused explicitly.
5249
pub trait ConstContentFormat: private::Sealed {
5350
/// Returns the content format as a `ContentFormat` enum.
51+
#[allow(private_interfaces)]
5452
fn content_format() -> ContentFormat;
5553
}
5654

@@ -123,6 +121,7 @@ pub type OctetStreamBytes = Bytes<OctetStreamContentFormat>;
123121
pub struct Pkcs8PrivateKeyDerContentFormat;
124122
impl private::Sealed for Pkcs8PrivateKeyDerContentFormat {}
125123
impl ConstContentFormat for Pkcs8PrivateKeyDerContentFormat {
124+
#[allow(exported_private_dependencies)]
126125
fn content_format() -> ContentFormat {
127126
ContentFormat::Pkcs8PrivateKey
128127
}

crates/bitwarden-crypto/src/cose.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ impl From<ContentFormat> for coset::HeaderBuilder {
176176
ContentFormat::OctetStream => {
177177
header_builder.content_format(CoapContentFormat::OctetStream)
178178
}
179-
ContentFormat::Cbor => header_builder.content_format(CoapContentFormat::Cbor),
180179
}
181180
}
182181
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ impl CryptoKey for PinKey {}
3434
impl KeyEncryptable<PinKey, EncString> for &SymmetricCryptoKey {
3535
fn encrypt_with_key(self, key: &PinKey) -> Result<EncString> {
3636
let stretched_key = SymmetricCryptoKey::Aes256CbcHmacKey(stretch_key(&key.0 .0)?);
37-
// The (stretched) pin key is currently always an AES-256-CBC-HMAC key, and wraps a bitwarden legacy encoded symmetric key
37+
// The (stretched) pin key is currently always an AES-256-CBC-HMAC key, and wraps a
38+
// bitwarden legacy encoded symmetric key
3839
self.to_encoded().encrypt_with_key(&stretched_key)
3940
}
4041
}

0 commit comments

Comments
 (0)