1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! # Databoxer API
//!
//! This library functions like an API between the CLI and GUI wrappers and the rest of the core
//! program code. It contains all the main functions related to the Databoxer's functionality, like
//! encryption, decryption, key and profile management.
pub use ;
pub use options;
pub use ;
use ;
/// Encrypts the file at the given path. Extra options can be provided to control the process
///
/// Requires the password for the current profile in order to authenticate user and start the
/// encryption process
///
/// # Errors
/// Most errors can be safely handled without an unsuccessful exit (e.g. file can just be skipped).
/// Although it is better to exit on errors related with user authentication and profiles, as the
/// program will simply not work without a user profile
/// Decrypts the file at the given path. Extra options can be provided to control the process.
/// Works similarly to the `encrypt` function just the other way around
///
/// Requires the password for the current profile in order to authenticate user and start the
/// decryption process
///
/// # Errors
/// Most errors can be safely handled without an unsuccessful exit (e.g. file can just be skipped).
/// Although it is better to exit on errors related with user authentication and profiles, as the
/// program will simply not work without a user profile
/// Parses the provided boxfile and retrieves original metadata from the header.
///
/// Returns a vector which contains strings with retrieved information about original file name,
/// extension, create, modify and access time. Will skip the unknown metadata unless optionally
/// specified not to
/// Creates a new profile with the provided password and profile name. Will **not** automatically
/// switch to the new profile
///
/// No user authentication needed, as it just creates a new profile
/// Deletes the profile with the corresponding name. After deletion will switch back to the first
/// profile in the list or if there are no profiles left set the current profile to `None`
///
/// Needs the target profile's password to authenticate
/// Select (set as the current) the profile with the corresponding name
///
/// Needs the target profile's password to authenticate
/// Returns the name of the currently selected profile
///
/// No authentication needed, as it just returns the name
/// Returns the names of all currently available profiles
///
/// No authentication needed, as it just returns the names
/// Generates a new encryption key for the current profile
///
/// **Warning:** this will replace the current encryption key, meaning that currently encrypted
/// files will no longer be able to be decrypted due to a different key being used
///
/// Needs the current profile's password to authenticate
/// Returns the encryption key being used by the current profile in a hex format
///
/// Needs the current profile's password to authenticate
/// Sets a new encryption key for the current profile. The input key has to be a valid 32-byte long
/// hex key for it to work (e.g. input key of `"0128AE1005..."` translates to `[1, 40, 174, 16, 5,
/// ...]`)
///
/// Needs the current profile's password to authenticate