pub struct FileKey(/* private fields */);Expand description
A random 32-byte key for one immutable file, erased on drop. Never reuse this key and a chunk index with different plaintext.
Implementations§
Source§impl FileKey
impl FileKey
Sourcepub fn generate() -> Result<Self, CryptoError>
pub fn generate() -> Result<Self, CryptoError>
Generate a file key independently of store and circle keys.
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Import the key carried in a row’s where-column.
Sourcepub fn to_secret_bytes(&self) -> SecretBytes
pub fn to_secret_bytes(&self) -> SecretBytes
Export the key for its where-column; the returned bytes erase on drop.
Sourcepub fn seal_chunk(
&self,
path: &str,
header: &[u8],
index: u64,
plaintext: &[u8],
) -> Vec<u8> ⓘ
pub fn seal_chunk( &self, path: &str, header: &[u8], index: u64, plaintext: &[u8], ) -> Vec<u8> ⓘ
Seal a chunk, binding the path, whole cleartext header and index. The output is ciphertext and tag; its nonce is not stored. Panics if the storage path is empty.
Sourcepub fn open_chunk(
&self,
path: &str,
header: &[u8],
index: u64,
sealed: &[u8],
) -> Result<Vec<u8>, CryptoError>
pub fn open_chunk( &self, path: &str, header: &[u8], index: u64, sealed: &[u8], ) -> Result<Vec<u8>, CryptoError>
Open only at the authenticated file path, header and chunk index. Panics if the storage path is empty.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileKey
impl RefUnwindSafe for FileKey
impl Send for FileKey
impl Sync for FileKey
impl Unpin for FileKey
impl UnsafeUnpin for FileKey
impl UnwindSafe for FileKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more