shadow_crypt_shell/listing/
file.rs

1use std::path::PathBuf;
2
3use shadow_crypt_core::version::Version;
4
5use crate::memory::SecureString;
6
7pub struct ListingInput {
8    pub password: SecureString,
9    pub work_dir: PathBuf,
10}
11impl ListingInput {
12    pub fn new(password: SecureString, work_dir: PathBuf) -> Self {
13        Self { password, work_dir }
14    }
15}
16
17#[derive(Debug)]
18pub struct ShadowFile {
19    pub path: PathBuf,
20    pub filename: String,
21    pub version: Version,
22    /// Size of the file in bytes
23    pub size: u64,
24}
25impl ShadowFile {
26    pub fn new(path: PathBuf, filename: String, version: Version, size: u64) -> Self {
27        Self {
28            path,
29            filename,
30            version,
31            size,
32        }
33    }
34}
35
36#[derive(Debug, Clone)]
37pub struct ShadowFileInfo {
38    pub original_filename: Option<SecureString>,
39    pub obfuscated_filename: String,
40    pub version: Version,
41    pub size: u64,
42}
43impl ShadowFileInfo {
44    pub fn new(
45        original_filename: Option<SecureString>,
46        obfuscated_filename: String,
47        version: Version,
48        size: u64,
49    ) -> Self {
50        Self {
51            original_filename,
52            obfuscated_filename,
53            version,
54            size,
55        }
56    }
57}
58
59pub struct FileInfoList {
60    pub items: Vec<ShadowFileInfo>,
61}
62impl FileInfoList {
63    pub fn new(items: Vec<ShadowFileInfo>) -> Self {
64        Self { items }
65    }
66}