File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
crates/bitwarden-crypto/src/keys Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,22 @@ impl<T: KeyContainer> KeyContainer for Arc<T> {
19
19
#[ allow( missing_docs) ]
20
20
pub trait CryptoKey { }
21
21
22
- #[ allow( missing_docs) ]
22
+ /// An encryption operation that takes the input value and encrypts it into the output value
23
+ /// using a key reference. Implementing this requires a content type to be specified in
24
+ /// the implementation.
23
25
pub trait KeyEncryptable < Key : CryptoKey , Output > {
26
+ /// Encrypts a value using the provided key reference.
24
27
fn encrypt_with_key ( self , key : & Key ) -> Result < Output > ;
25
28
}
26
29
30
+ /// An encryption operation that takes the input value and encrypts it into the output value
31
+ /// using a key reference, with an externally provided content type.
32
+ ///
33
+ /// In contrast to `KeyEncryptable`, this trait allows the caller to specify the content format.
34
+ /// Because of this, it is not exposed outside of the crate, because outside callers should
35
+ /// not make a choice about the content format. Where possible, the content format is
36
+ /// ensured at compile time by the type system, not at runtime by the caller passing
37
+ /// in a parameter.
27
38
pub ( crate ) trait KeyEncryptableWithContentType < Key : CryptoKey , Output > {
28
39
fn encrypt_with_key ( self , key : & Key , content_format : ContentFormat ) -> Result < Output > ;
29
40
}
You can’t perform that action at this time.
0 commit comments