Skip to content

Commit

Permalink
FMP v1.2.22
Browse files Browse the repository at this point in the history
Added support for vault password change.
  • Loading branch information
TT1882 authored Jan 28, 2025
1 parent 7079800 commit ebdc488
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fmp"
version = "1.2.21"
version = "1.2.22"
edition = "2021"
authors = ["Luke Wilkinson <wilkinsonluke@proton.me>"]
license = "GPL-3.0"
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ cargo install --path .

## Flags:
```flags
-a, --add Add an account to vault. used as: -a, --add
-b, --backup Backup vault or install backup user as -b, --backup
-c, --create-vault Create vault. used as -c --create-vault
-d, --delete Delete account from vault. used as: -d, --delete
-D, --delete-vault Delete vault. used as: -D, --delete
-e, --entropy Calculate password entropy. used as -e --entropy
-g, --generate-password Generate new password. used as -g --generate-password
-E, --encrypt Encrypt vault. used as -E, --encrypt
-p, --change-password Change password for an account. used as: -p , --change-password
-u, --change-username Change username for an account. used as: -u , --change-username
-h, --help Print help
-a, --add Add an account to vault. used as: -a, --add
-b, --backup Backup vault or install backup user as -b, --backup
-c, --create-vault Create vault. used as -c --create-vault
-C, --change-vault-password Change vault password. used as -C --change-vault-password
-d, --delete Delete account from vault. used as: -d, --delete
-D, --delete-vault Delete vault. used as: -D, --delete
-e, --entropy Calculate password entropy. used as -e --entropy
-E, --encrypt Encrypt vault. used as -E, --encrypt
-g, --generate-password Generate new password. used as -g --generate-password
-p, --change-password Change password for an account. used as: -p , --change-password
-r, --rename-vault Rename vault. used as: -r , --rename-vault
-u, --change-username Change username for an account. used as: -u , --change-username
-h, --help Print help
```
###

Expand Down Expand Up @@ -55,4 +57,6 @@ The user is asked what account they would like to remove, and the corrosponing v
### Generate Password:
The user is asked for the length of the password they want to generate. Random characters are generated and concatenated to form a password of the specified length. The user is asked if they would like to add it to an account
### Rename Vault:
Asks user what vault name to change and what they whant to change it to. Decrypts vault, changes its name then re-encrypts it. Old vault files are removed.
Asks user what vault name to change and what they whant to change it to. Decrypts vault, changes its name then re-encrypts it. Old vault files are removed.
### Change Vault Password:
Simply decrypts user specified vault and encrypts with the password they want to change it to.
9 changes: 8 additions & 1 deletion src/flags.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use input_handle::{get_string_input, get_u32_input};
use std::{path::Path, process::{Command, exit}};
use crate::{account::{get_account_location, read_account}, json::{change_password, change_username, new_json_account, read_json, remove_account, UserPass}, password::{calculate_entropy, generate_password}, vault::{decrypt_vault, delete_vault, delete_vault_full, encrypt_and_exit, exit_vault, get_vault_location, print_vault_entries}};
use crate::{account::{get_account_location, read_account}, json::{change_password, change_username, new_json_account, read_json, remove_account, UserPass}, password::{calculate_entropy, generate_password}, vault::{decrypt_vault, delete_vault, delete_vault_full, encrypt_and_exit, encrypt_vault, exit_vault, get_vault_location, print_vault_entries}};

pub fn create() {
println!("FMP SETUP\n");
Expand Down Expand Up @@ -280,6 +280,13 @@ pub fn rename(vault: &String) {
encrypt_and_exit(&vault_new_directory);
}

pub fn change_vault_password(vault: &String) {
decrypt_vault(vault);
println!("\nEnter new password:\n");
encrypt_vault(vault);
exit_vault(vault);
}

pub fn no_flags(vault: &String) {
decrypt_vault(vault);
print_vault_entries(vault);
Expand Down
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod json;
mod password;
mod vault; use vault::{vault_to_access, encrypt_and_exit};
mod checks; use checks::os_check;
mod flags; use flags::{add, backup, change_account_password, change_account_username, create, delete, entropy, gen_password, decrypt_vault_all_files, rename, no_flags};
mod flags; use flags::{add, backup, change_account_password, change_account_username, change_vault_password, create, delete, entropy, gen_password, decrypt_vault_all_files, rename, no_flags};
#[derive(Debug, Parser)]
struct Options {

Expand All @@ -24,6 +24,11 @@ struct Options {
#[clap(short = 'c', long = "create-vault")]
flag_c: bool,

/// Change vault password.
/// used as -C --change-vault-password
#[clap(short = 'C', long = "change-vault-password")]
flag_cvp: bool,

/// Delete account from vault.
/// used as: -d, --delete
#[clap(short = 'd', long = "delete")]
Expand Down Expand Up @@ -129,6 +134,10 @@ fn main() {
rename(&vault_location)
}

// If flag -C or --change-vault-password
if opts.flag_cvp == true {
change_vault_password(&vault_location);
}
// If no flags are supplied
no_flags(&vault_location);
}

0 comments on commit ebdc488

Please sign in to comment.