1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
pub use ;
pub use Key;
// Re-exports
pub use ;
/// Encrypt the given plaintext using the provided key.
/// Any type that implements the [`Encrypt`] trait can be used.
///
/// # Return type
///
/// The return type is the encrypted form of the plaintext, which is determined by the
/// `Encrypt` trait implementation for the type of `plaintext`.
///
/// # Errors
///
/// If the encryption fails, an [`Unspecified`] error is returned.
/// Specific errors may reveal information about the failure, such as key length issues or nonce generation problems
/// which can lead to security vulnerabilities so they are not detailed here.
///
/// # Example
///
/// ```rust
/// # mod vitaminc { pub mod encrypt { pub use vitaminc_encrypt::*; } pub mod aead { pub use vitaminc_aead::*; } }
/// use vitaminc::encrypt::Key;
/// use vitaminc::aead::Encrypt;
/// let key = Key::from([0u8; 32]);
/// let encrypted = vitaminc::encrypt::encrypt(&key, "message").unwrap();
/// ```
///