Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bit of a refactor #1

Merged
merged 10 commits into from
Oct 24, 2022
Prev Previous commit
Next Next commit
smol things
  • Loading branch information
Speykious committed Oct 24, 2022
commit 7f7661343e24e4c73fa85f295dfbb55934fec2a0
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async fn main() {
let mut folder_path = String::new();
let mut output_path = String::new();
let mut file_path = String::new();
let mut encrypted: bool = false;
let mut encrypted = false;

{
let mut ap = ArgumentParser::new();
Expand Down Expand Up @@ -57,7 +57,7 @@ async fn main() {
if file_path.is_empty() {
if encrypted {
// Create a new keypair
let mut keypair: Keys = Keys::new();
let mut keypair = Keys::new();

// Get the path to which the keypair is to be written on the disk
let mut keypair_path = String::new();
Expand All @@ -73,7 +73,7 @@ async fn main() {
create_combined_file(&folder_path, &output_path, Some(&mut keypair));

// write the keypair to disk
keypair.save_keypair(Path::new(&format!("{}.sfkp", keypair_path.trim())).to_path_buf());
keypair.save_keypair(Path::new(&format!("{}.sfkp", keypair_path.trim())));
} else {
// Create a combined file from the folder without encryption
create_combined_file(&folder_path, &output_path, None);
Expand All @@ -83,12 +83,12 @@ async fn main() {
let mut keys_path = String::new();

print!("Path to keys: ");
std::io::stdout().flush().expect("Failed to flush stdio.");
std::io::stdout().flush().expect("Failed to flush stdout.");
std::io::stdin()
.read_line(&mut keys_path)
.expect("Failed to read from stdin");

let keys: Keys = Keys::from(Path::new(keys_path.trim()).to_path_buf());
let keys = Keys::from(Path::new(keys_path.trim()));

// Recreate the file structure that was combined
let combined_data = read_combined_file(file_path);
Expand Down