Crate databoxer

Source
Expand description

§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.

Modules§

app
Contains app-wide information and states, like run modes
cli
Contains everything related to the CLI wrapper around the Databoxer API
options
Provides structs which hold optional parameters for the API functions for easier option supply

Macros§

err_cmp
Macro used as a shortcut for comparing errors by their type and kind.
exits_on
Macro to specify on which error kind the program will exit with an error code. Additionally, calls error::print_error() to log error and provide detailed information if needed
log
new_err
Macro used as a shortcut for creating a new Databoxer Error.
output
Macro used for better data output. Acts like a wrapper above print! in order to produce a more suitable output based on the logger mode (cleaner and simpler output when in quiet mode). Add the list keyword to suggest that the data provided should be outputted as a list

Structs§

Boxfile
Struct representing a boxfile structure. A “boxfile” is the custom file format for databoxer which contains the encrypted data of a file, alongside header with extra information and random padding. It is generated as a result of file encryption operation and has a .box extension.

Enums§

Error
Custom Databoxer error type. Contains different kinds of errors for each category, both simple errors with a single message and complex enum errors with different kinds. These custom error types should cover most of the possible program errors

Functions§

create_profile
Creates a new profile with the provided password and profile name. Will not automatically switch to the new profile
decrypt
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.
delete_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
encrypt
Encrypts the file at the given path. Extra options can be provided to control the process.
get_info
Parses the provided boxfile and retrieves original metadata from the header.
get_key
Returns the encryption key being used by the current profile in a hex format
get_profile
Returns the name of the currently selected profile
get_profiles
Returns the names of all currently available profiles
new_key
Generates a new encryption key for the current profile
select_profile
Select (set as the current) the profile with the corresponding name
set_key
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, ...])

Type Aliases§

Checksum
Type representing a 32-byte checksum hash used to validate data integrity
Key
Type representing a basic 32-byte encryption key
Nonce
Type representing a 12-byte nonce used for encryption in combination with an encryption key
Result
Custom result type which should be used throughout the codebase for consistency and better error handling