diff --git a/src/lib.rs b/src/lib.rs index b3fce84..7a03060 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -292,6 +292,7 @@ use header::{CocoonConfig, CocoonHeader}; // Enumeration is needed to avoid dynamic allocation (important for "nostd" build). #[allow(clippy::large_enum_variant)] +#[derive(Clone)] enum RngVariant { #[cfg(feature = "std")] Thread(ThreadRng), @@ -422,6 +423,7 @@ pub use mini::*; /// [^1]: [`from_entropy`](Cocoon::from_entropy) is enabled when `getrandom` feature is enabled. /// /// [^2]: [`parse_only`](Cocoon::parse_only) makes decryption API accessible only. +#[derive(Clone)] pub struct Cocoon<'a, M> { password: &'a [u8], rng: RngVariant, diff --git a/src/mini.rs b/src/mini.rs index 23cdd4c..6635512 100644 --- a/src/mini.rs +++ b/src/mini.rs @@ -21,6 +21,7 @@ use super::{ pub const MINI_PREFIX_SIZE: usize = MiniFormatPrefix::SERIALIZE_SIZE; /// This is a mini cocoon for a convenient and cool encryption. +#[derive(Clone)] pub struct MiniCocoon { key: Zeroizing<[u8; KEY_SIZE]>, rng: StdRng,