Skip to content

Commit b2f5211

Browse files
committed
Fix encryptable docs
1 parent 948baa5 commit b2f5211

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

crates/bitwarden-crypto/src/traits/encryptable.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88
//! Encrypting data directly, a content type must be provided, since an encrypted byte array alone
99
//! is not enough to tell the decryption code how to interpret the decrypted bytes. For this, there
1010
//! are two traits, `PrimitiveEncryptable` and `PrimitiveEncryptableWithContentType`. The former
11-
//! assumes that the caller provides the content format when encrypting. The latter is a convenience
12-
//! trait that pre-defines the content format based on the type of data that is encrypted. This is
13-
//! currently done exactly for `String` and `&str`, which are encrypted as UTF-8,
11+
//! assumes that the implementation provides content format when encrypting, based on the type
12+
//! of struct that is being encrypted. The latter allows the caller to specify the content format
13+
//! at runtime, which is only allowed within the crypto crate.
14+
//!
15+
//! `PrimitiveEncryptable` is implemented for `crate::content_format::Bytes<C>` types, where `C` is
16+
//! a type that implements the `ConstContentFormat` trait. This allows for compile-time type
17+
//! checking of the content format, and the risk of using the wrong content format is limited to
18+
//! converting untyped bytes into a `Bytes<C>` type
1419
1520
use crate::{store::KeyStoreContext, ContentFormat, CryptoError, EncString, KeyId, KeyIds};
1621

0 commit comments

Comments
 (0)