Skip to content

Commit

Permalink
Added Clone to Cocoon and MiniCocoon
Browse files Browse the repository at this point in the history
  • Loading branch information
Deaths-Door committed Aug 29, 2024
1 parent c8460f6 commit 9f0f549
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/mini.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9f0f549

Please sign in to comment.