shadow_crypt_core/v1/
file.rs

1use crate::memory::{SecureBytes, SecureString};
2
3use super::header::FileHeader;
4
5/// Represents a complete encrypted file with header and content
6#[derive(Debug)]
7pub struct EncryptedFile {
8    header: FileHeader,
9    ciphertext: Vec<u8>,
10}
11
12impl EncryptedFile {
13    pub fn new(header: FileHeader, ciphertext: Vec<u8>) -> Self {
14        Self { header, ciphertext }
15    }
16    pub fn header(&self) -> &FileHeader {
17        &self.header
18    }
19    pub fn ciphertext(&self) -> &Vec<u8> {
20        &self.ciphertext
21    }
22}
23
24/// Represents a plaintext file with filename and content
25#[derive(Debug)]
26pub struct PlaintextFile {
27    filename: SecureString, // Decrypted filename
28    content: SecureBytes,   // Decrypted file content
29}
30
31impl PlaintextFile {
32    pub fn new(filename: SecureString, content: SecureBytes) -> Self {
33        Self { filename, content }
34    }
35    pub fn filename(&self) -> &SecureString {
36        &self.filename
37    }
38    pub fn content(&self) -> &SecureBytes {
39        &self.content
40    }
41}