nectar_primitives/chunk/encryption/
mod.rs1mod chunk;
4mod cipher;
5mod error;
6mod key;
7mod reference;
8
9pub(crate) use chunk::decrypt_chunk_data;
10#[cfg(feature = "encryption")]
11pub(crate) use chunk::encrypt_chunk;
12pub use cipher::{transcrypt, transcrypt_in_place};
13pub use error::EncryptionError;
14pub use key::EncryptionKey;
15pub use reference::EncryptedChunkRef;
16
17#[cfg(feature = "encryption")]
19pub trait ChunkEncrypt {
20 type Encrypted;
22
23 fn encrypt_with(&self, key: &EncryptionKey) -> crate::error::Result<Self::Encrypted>;
25
26 fn encrypt(&self) -> crate::error::Result<Self::Encrypted> {
28 self.encrypt_with(&EncryptionKey::generate())
29 }
30}