From 7b4079e22c9fac9fea8ff91d1585f42b25edb1de Mon Sep 17 00:00:00 2001 From: Awiteb Date: Thu, 2 May 2024 11:12:33 +0300 Subject: [PATCH 1/4] chore: Remove the generic type from `Vault[s]` --- src/cli/add_command.rs | 6 ++-- src/cli/clean_command.rs | 7 ++-- src/cli/edit_command.rs | 6 ++-- src/cli/export_command.rs | 8 ++--- src/cli/gen_command.rs | 7 ++-- src/cli/import_command.rs | 4 +-- src/cli/list_command.rs | 7 ++-- src/cli/remove_command.rs | 7 ++-- src/macros.rs | 2 +- src/traits.rs | 7 ++-- src/vault/bitwarden.rs | 12 +++---- src/vault/mod.rs | 72 ++++++++++----------------------------- src/vault/validator.rs | 4 +-- 13 files changed, 48 insertions(+), 101 deletions(-) diff --git a/src/cli/add_command.rs b/src/cli/add_command.rs index 3f5a698..d8389a9 100644 --- a/src/cli/add_command.rs +++ b/src/cli/add_command.rs @@ -17,7 +17,7 @@ use clap::Args; use crate::{ - vault::{vault_state::*, Vault, Vaults}, + vault::{Vault, Vaults}, LprsCommand, LprsError, LprsResult, }; @@ -25,14 +25,14 @@ use crate::{ #[command(author, version, about, long_about = None)] pub struct Add { #[command(flatten)] - vault_info: Vault, + vault_info: Vault, /// The password, if there is no value for it you will prompt it #[arg(short, long)] password: Option>, } impl LprsCommand for Add { - fn run(mut self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(mut self, mut vault_manager: Vaults) -> LprsResult<()> { match self.password { Some(Some(password)) => { log::debug!("User provided a password"); diff --git a/src/cli/clean_command.rs b/src/cli/clean_command.rs index bc29626..88001f9 100644 --- a/src/cli/clean_command.rs +++ b/src/cli/clean_command.rs @@ -18,17 +18,14 @@ use std::fs; use clap::Args; -use crate::{ - vault::{vault_state::*, Vaults}, - LprsCommand, LprsError, LprsResult, -}; +use crate::{vault::Vaults, LprsCommand, LprsError, LprsResult}; #[derive(Debug, Args)] #[command(author, version, about, long_about = None)] pub struct Clean {} impl LprsCommand for Clean { - fn run(self, vault_manager: Vaults) -> LprsResult<()> { + fn run(self, vault_manager: Vaults) -> LprsResult<()> { log::info!( "Cleaning the vaults file: {:?}", vault_manager.vaults_file.display() diff --git a/src/cli/edit_command.rs b/src/cli/edit_command.rs index 443f248..fba2433 100644 --- a/src/cli/edit_command.rs +++ b/src/cli/edit_command.rs @@ -19,7 +19,7 @@ use std::num::NonZeroU64; use clap::Args; use crate::{ - vault::{vault_state::*, Vault, Vaults}, + vault::{Vault, Vaults}, LprsCommand, LprsError, LprsResult, }; @@ -47,7 +47,7 @@ pub struct Edit { } impl LprsCommand for Edit { - fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { let index = self.index.get() as usize; log::debug!("Editing vault at index: {index}"); @@ -73,7 +73,7 @@ impl LprsCommand for Edit { }; log::info!("Applying the new values to the vault"); - *vault = Vault::::new( + *vault = Vault::new( self.name.as_ref().unwrap_or(&vault.name), self.username.as_ref().or(vault.username.as_ref()), password.as_ref().or(vault.password.as_ref()), diff --git a/src/cli/export_command.rs b/src/cli/export_command.rs index fb5d701..3d576a6 100644 --- a/src/cli/export_command.rs +++ b/src/cli/export_command.rs @@ -19,7 +19,7 @@ use std::{fs, io::Error as IoError, io::ErrorKind as IoErrorKind, path::PathBuf} use clap::Args; use crate::{ - vault::{vault_state::*, BitWardenPasswords, Format, Vault, Vaults}, + vault::{BitWardenPasswords, Format, Vault, Vaults}, LprsCommand, LprsError, LprsResult, }; @@ -34,7 +34,7 @@ pub struct Export { } impl LprsCommand for Export { - fn run(self, vault_manager: Vaults) -> LprsResult<()> { + fn run(self, vault_manager: Vaults) -> LprsResult<()> { log::debug!( "Exporting vault {} to: {} with format: {}", vault_manager.vaults_file.display(), @@ -42,9 +42,7 @@ impl LprsCommand for Export { self.format ); let exported_data = match self.format { - Format::Lprs => { - serde_json::to_string::>>(&vault_manager.encrypt_vaults()?) - } + Format::Lprs => serde_json::to_string::>(&vault_manager.encrypt_vaults()?), Format::BitWarden => serde_json::to_string(&BitWardenPasswords::from(vault_manager)), }?; diff --git a/src/cli/gen_command.rs b/src/cli/gen_command.rs index 92dfae3..ba4ff5f 100644 --- a/src/cli/gen_command.rs +++ b/src/cli/gen_command.rs @@ -18,10 +18,7 @@ use std::num::NonZeroU64; use clap::Args; -use crate::{ - vault::{vault_state::*, Vaults}, - LprsCommand, LprsError, LprsResult, -}; +use crate::{vault::Vaults, LprsCommand, LprsError, LprsResult}; #[derive(Debug, Args)] #[command(author, version, about, long_about = None)] @@ -45,7 +42,7 @@ pub struct Gen { } impl LprsCommand for Gen { - fn run(self, _vault_manager: Vaults) -> LprsResult<()> { + fn run(self, _vault_manager: Vaults) -> LprsResult<()> { println!( "{}", passwords::PasswordGenerator::new() diff --git a/src/cli/import_command.rs b/src/cli/import_command.rs index 1e2b098..31ca224 100644 --- a/src/cli/import_command.rs +++ b/src/cli/import_command.rs @@ -19,7 +19,7 @@ use std::{fs::File, io::Error as IoError, io::ErrorKind as IoErrorKind, path::Pa use clap::Args; use crate::{ - vault::{vault_state::*, BitWardenPasswords, Format, Vault, Vaults}, + vault::{BitWardenPasswords, Format, Vault, Vaults}, LprsCommand, LprsError, LprsResult, }; @@ -35,7 +35,7 @@ pub struct Import { } impl LprsCommand for Import { - fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { log::debug!( "Importing vaults from: {} with format: {} to the vault: {}", self.path.display(), diff --git a/src/cli/list_command.rs b/src/cli/list_command.rs index 266f426..10e8bc3 100644 --- a/src/cli/list_command.rs +++ b/src/cli/list_command.rs @@ -19,10 +19,7 @@ use std::num::NonZeroU64; use clap::Args; use inquire::Select; -use crate::{ - vault::{vault_state::*, Vaults}, - LprsCommand, LprsError, LprsResult, -}; +use crate::{vault::Vaults, LprsCommand, LprsError, LprsResult}; #[derive(Debug, Args)] #[command(author, version, about, long_about = None)] @@ -39,7 +36,7 @@ pub struct List { } impl LprsCommand for List { - fn run(self, vault_manager: Vaults) -> LprsResult<()> { + fn run(self, vault_manager: Vaults) -> LprsResult<()> { if vault_manager.vaults.is_empty() { return Err(LprsError::Other( "Looks like there is no vaults to list".to_owned(), diff --git a/src/cli/remove_command.rs b/src/cli/remove_command.rs index d255e5b..df97091 100644 --- a/src/cli/remove_command.rs +++ b/src/cli/remove_command.rs @@ -18,10 +18,7 @@ use std::num::NonZeroU64; use clap::Args; -use crate::{ - vault::{vault_state::*, Vaults}, - LprsCommand, LprsError, LprsResult, -}; +use crate::{vault::Vaults, LprsCommand, LprsError, LprsResult}; #[derive(Debug, Args)] #[command(author, version, about, long_about = None)] @@ -35,7 +32,7 @@ pub struct Remove { } impl LprsCommand for Remove { - fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { + fn run(self, mut vault_manager: Vaults) -> LprsResult<()> { let index = (self.index.get() - 1) as usize; log::debug!("Removing vault at index: {index}"); diff --git a/src/macros.rs b/src/macros.rs index 1b19e23..7507f8d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -53,7 +53,7 @@ macro_rules! impl_commands { ($enum_name: ident, $($varint: ident)+) => { #[automatically_derived] impl $crate::LprsCommand for $enum_name{ - fn run(self, vault_manager: $crate::vault::Vaults<$crate::vault::vault_state::Plain>) -> $crate::LprsResult<()> { + fn run(self, vault_manager: $crate::vault::Vaults) -> $crate::LprsResult<()> { match self { $( Self::$varint(command) => command.run(vault_manager), diff --git a/src/traits.rs b/src/traits.rs index 708829a..4c7985e 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -14,15 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::{ - vault::{vault_state::*, Vaults}, - LprsResult, -}; +use crate::{vault::Vaults, LprsResult}; /// Trait to work with the commands pub trait LprsCommand { /// Run the command, should do all the logic, even the export - fn run(self, vault_manager: Vaults) -> LprsResult<()>; + fn run(self, vault_manager: Vaults) -> LprsResult<()>; /// Validate the gaiven args from the user. fn validate_args(&self) -> LprsResult<()> { diff --git a/src/vault/bitwarden.rs b/src/vault/bitwarden.rs index f287464..962127c 100644 --- a/src/vault/bitwarden.rs +++ b/src/vault/bitwarden.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use super::{vault_state::*, Vault, Vaults}; +use super::{Vault, Vaults}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct BitWardenLoginData { @@ -39,7 +39,7 @@ pub struct BitWardenPasswords { pub items: Vec, } -impl From for Vault { +impl From for Vault { fn from(value: BitWardenPassword) -> Self { Self::new( value.name, @@ -55,8 +55,8 @@ impl From for Vault { } } -impl From> for BitWardenPassword { - fn from(value: Vault) -> Self { +impl From for BitWardenPassword { + fn from(value: Vault) -> Self { Self { ty: 1, name: value.name, @@ -72,8 +72,8 @@ impl From> for BitWardenPassword { } } -impl From> for BitWardenPasswords { - fn from(value: Vaults) -> Self { +impl From for BitWardenPasswords { + fn from(value: Vaults) -> Self { Self { encrypted: false, folders: Vec::new(), diff --git a/src/vault/mod.rs b/src/vault/mod.rs index a7d2fef..1c3ea8e 100644 --- a/src/vault/mod.rs +++ b/src/vault/mod.rs @@ -14,13 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{fs, marker::PhantomData, path::PathBuf}; +use std::{fs, path::PathBuf}; use clap::{Parser, ValueEnum}; use serde::{Deserialize, Serialize}; use crate::{LprsError, LprsResult}; -use vault_state::*; pub mod cipher; @@ -36,23 +35,10 @@ pub enum Format { BitWarden, } -/// The states of the vaults -pub mod vault_state { - /// Means the vault is encrypted - #[derive(Clone, Debug, Default)] - pub struct Encrypted; - /// Means the vault is not encrypted - #[derive(Clone, Debug, Default)] - pub struct Plain; -} - /// The vault struct #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Deserialize, Serialize, Parser)] -pub struct Vault -where - T: std::fmt::Debug + Clone, -{ +pub struct Vault { /// The name of the vault #[arg(short, long)] pub name: String, @@ -68,31 +54,20 @@ where /// Add a note to the vault #[arg(short = 'o', long)] pub note: Option, - - /// State phantom - #[serde(skip)] - #[arg(skip)] - phantom: PhantomData, } /// The vaults manager #[derive(Default)] -pub struct Vaults -where - T: std::fmt::Debug + Clone, -{ +pub struct Vaults { /// Hash of the master password pub master_password: Vec, /// The json vaults file pub vaults_file: PathBuf, /// The vaults - pub vaults: Vec>, + pub vaults: Vec, } -impl Vault -where - T: std::fmt::Debug + Clone, -{ +impl Vault { /// Create new [`Vault`] instance pub fn new( name: impl Into, @@ -107,15 +82,12 @@ where password: password.map(Into::into), service: service.map(Into::into), note: note.map(Into::into), - phantom: std::marker::PhantomData, } } -} -impl Vault { /// Decrypt the vault - pub fn decrypt(&self, master_password: &[u8]) -> LprsResult> { - Ok(Vault::::new( + pub fn decrypt(&self, master_password: &[u8]) -> LprsResult { + Ok(Vault::new( cipher::decrypt(master_password, &self.name)?, cipher::decrypt_some(master_password, self.username.as_ref())?, cipher::decrypt_some(master_password, self.password.as_ref())?, @@ -123,12 +95,10 @@ impl Vault { cipher::decrypt_some(master_password, self.note.as_ref())?, )) } -} -impl Vault { /// Encrypt the vault - pub fn encrypt(&self, master_password: &[u8]) -> LprsResult> { - Ok(Vault::::new( + pub fn encrypt(&self, master_password: &[u8]) -> LprsResult { + Ok(Vault::new( cipher::encrypt(master_password, &self.name)?, cipher::encrypt_some(master_password, self.username.as_ref())?, cipher::encrypt_some(master_password, self.password.as_ref())?, @@ -154,23 +124,18 @@ impl Vault { } } -impl Vaults -where - T: std::fmt::Debug + Clone, -{ +impl Vaults { /// Create new [`Vaults`] instnce - pub fn new(master_password: Vec, vaults_file: PathBuf, vaults: Vec>) -> Self { + pub fn new(master_password: Vec, vaults_file: PathBuf, vaults: Vec) -> Self { Self { master_password, vaults_file, vaults, } } -} -impl Vaults { /// Encrypt the vaults - pub fn encrypt_vaults(&self) -> LprsResult>> { + pub fn encrypt_vaults(&self) -> LprsResult> { self.vaults .iter() .map(|p| p.encrypt(&self.master_password)) @@ -179,11 +144,10 @@ impl Vaults { /// Reload the vaults from the file then decrypt it pub fn try_reload(vaults_file: PathBuf, master_password: Vec) -> LprsResult { - let vaults = - serde_json::from_str::>>(&fs::read_to_string(&vaults_file)?)? - .into_iter() - .map(|p| p.decrypt(master_password.as_slice())) - .collect::>>>()?; + let vaults = serde_json::from_str::>(&fs::read_to_string(&vaults_file)?)? + .into_iter() + .map(|p| p.decrypt(master_password.as_slice())) + .collect::>>()?; Ok(Self::new(master_password, vaults_file, vaults)) } @@ -202,7 +166,7 @@ impl Vaults { } /// Add new vault - pub fn add_vault(&mut self, vault: Vault) { + pub fn add_vault(&mut self, vault: Vault) { self.vaults.push(vault) } } @@ -219,7 +183,7 @@ impl std::fmt::Display for Format { } } -impl std::fmt::Display for Vault { +impl std::fmt::Display for Vault { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Name: {}", self.name)?; if let Some(ref username) = self.username { diff --git a/src/vault/validator.rs b/src/vault/validator.rs index 784a84b..c29d69f 100644 --- a/src/vault/validator.rs +++ b/src/vault/validator.rs @@ -18,7 +18,7 @@ use std::{fs, path::Path}; use crate::LprsResult; -use super::{vault_state::*, Vault}; +use super::Vault; /// Return if the vaults file new file or not pub fn is_new_vaults_file(path: &Path) -> LprsResult { @@ -26,7 +26,7 @@ pub fn is_new_vaults_file(path: &Path) -> LprsResult { let file_content = fs::read_to_string(path)?; if !file_content.is_empty() && file_content.trim() != "[]" - && serde_json::from_str::>>(&file_content).is_ok() + && serde_json::from_str::>(&file_content).is_ok() { return Ok(false); } -- 2.45.2 From d3eee8c35b971745ba5b57843d3cf68803daf188 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Thu, 2 May 2024 21:28:51 +0300 Subject: [PATCH 2/4] chore(deps): Update and remove some deps --- Cargo.lock | 645 ++++++++++++++++++++++++----------------------------- Cargo.toml | 28 +-- 2 files changed, 303 insertions(+), 370 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe65e86..59ca8db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,19 +18,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "aho-corasick" -version = "1.1.2" +name = "aes" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -42,9 +53,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -74,28 +85,17 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "async-trait" -version = "0.1.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -108,9 +108,24 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] [[package]] name = "bitflags" @@ -120,9 +135,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "block-buffer" @@ -134,10 +149,19 @@ dependencies = [ ] [[package]] -name = "bumpalo" -version = "3.14.0" +name = "block-padding" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -147,18 +171,24 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] [[package]] name = "cc" -version = "1.0.83" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" [[package]] name = "cfg-if" @@ -167,10 +197,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "clap" -version = "4.4.11" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -178,9 +218,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", @@ -190,9 +230,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ "heck", "proc-macro2", @@ -202,9 +242,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -212,18 +252,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" -[[package]] -name = "comfy-table" -version = "7.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c64043d6c7b7a4c58e39e7efccfdea7b93d885a795d0c054a69dbbf4dd52686" -dependencies = [ - "crossterm 0.27.0", - "strum", - "strum_macros", - "unicode-width", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -242,9 +270,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -265,19 +293,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "crossterm" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" -dependencies = [ - "bitflags 2.4.1", - "crossterm_winapi", - "libc", - "parking_lot", - "winapi", -] - [[package]] name = "crossterm_winapi" version = "0.9.1" @@ -297,41 +312,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "darling" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "digest" version = "0.10.7" @@ -371,18 +351,18 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -409,9 +389,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fnv" @@ -521,9 +501,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", @@ -538,9 +518,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.22" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -557,33 +537,27 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -656,12 +630,6 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.5.0" @@ -674,22 +642,32 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", ] [[package]] -name = "inquire" -version = "0.7.4" +name = "inout" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe95f33091b9b7b517a5849bce4dce1b550b430fc20d58059fcaa319ed895d8b" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "bitflags 2.4.1", - "crossterm 0.25.0", + "block-padding", + "generic-array", +] + +[[package]] +name = "inquire" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a" +dependencies = [ + "bitflags 2.5.0", + "crossterm", "dyn-clone", "fuzzy-matcher", "fxhash", @@ -707,26 +685,26 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", - "windows-sys 0.48.0", + "libc", + "windows-sys 0.52.0", ] [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -739,32 +717,31 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "libc", - "redox_syscall", ] [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -772,38 +749,38 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lprs" version = "1.2.1" dependencies = [ - "base64", + "aes", + "base64 0.22.1", + "bincode", + "cbc", "clap", - "comfy-table", "directories", "inquire", "log", "passwords", "pretty_env_logger", + "rand", "regex", "reqwest", "serde", "serde_json", - "serde_with_macros", - "sha256", - "soft-aes", + "sha2", "thiserror", - "url", ] [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "mime" @@ -813,18 +790,18 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", @@ -859,16 +836,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "object" version = "0.32.2" @@ -886,11 +853,11 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.62" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -918,9 +885,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.98" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -936,9 +903,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -946,15 +913,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -974,9 +941,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -986,9 +953,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "ppv-lite86" @@ -1014,18 +981,18 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1093,18 +1060,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", ] [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom", "libredox", @@ -1113,9 +1080,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -1125,9 +1092,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1136,17 +1103,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.23" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -1164,9 +1131,11 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", @@ -1186,11 +1155,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -1198,16 +1167,19 @@ dependencies = [ ] [[package]] -name = "rustversion" -version = "1.0.14" +name = "rustls-pemfile" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schannel" @@ -1226,9 +1198,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -1239,9 +1211,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -1249,18 +1221,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" dependencies = [ "proc-macro2", "quote", @@ -1269,9 +1241,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -1290,18 +1262,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_with_macros" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sha2" version = "0.10.8" @@ -1313,18 +1273,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sha256" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7895c8ae88588ccead14ff438b939b0c569cd619116f14b4d13fdff7b8333386" -dependencies = [ - "async-trait", - "bytes", - "hex", - "sha2", -] - [[package]] name = "signal-hook" version = "0.3.17" @@ -1348,9 +1296,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -1366,62 +1314,43 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] -[[package]] -name = "soft-aes" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d33909ace50facaccea7c996cf623416b8426f249ca446db3d6a3f560ad84cc" - [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" - -[[package]] -name = "strum_macros" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn", -] +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.41" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "system-configuration" version = "0.5.1" @@ -1445,40 +1374,39 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.51" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.51" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", @@ -1512,15 +1440,14 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", "socket2", "windows-sys 0.48.0", @@ -1589,9 +1516,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -1601,9 +1528,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -1616,9 +1543,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "url" @@ -1629,7 +1556,6 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", - "serde", ] [[package]] @@ -1667,9 +1593,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1677,9 +1603,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -1692,9 +1618,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -1704,9 +1630,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1714,9 +1640,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -1727,15 +1653,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -1759,11 +1685,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -1787,7 +1713,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1807,17 +1733,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -1828,9 +1755,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -1840,9 +1767,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -1852,9 +1779,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -1864,9 +1797,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -1876,9 +1809,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -1888,9 +1821,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -1900,9 +1833,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winreg" diff --git a/Cargo.toml b/Cargo.toml index e61fb16..46bd098 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,23 +12,23 @@ keywords = ["password", "manager", "CLI"] categories = ["command-line-utilities"] [dependencies] -base64 = "0.21.5" -clap = { version = "4.4.11", features = ["derive"] } -comfy-table = "7.1.0" +clap = { version = "4.5.4", features = ["derive"] } directories = "5.0.1" -log = "0.4.20" +log = "0.4.21" passwords = { version = "3.1.16", features = ["common-password"] } pretty_env_logger = "0.5.0" -regex = "1.10.2" -serde = { version = "1.0.193", features = ["derive"] } -serde_json = "1.0.108" -serde_with_macros = "3.4.0" -sha256 = { version = "1.4.0", default-features = false } -soft-aes = "0.1.0" -thiserror = "1.0.51" -url = { version = "2.5.0", features = ["serde"] } -reqwest = {version = "0.11.23", optional = true} -inquire = "0.7.4" +regex = "1.10.4" +serde = { version = "1.0.200", features = ["derive"] } +thiserror = "1.0.59" +reqwest = {version = "0.11.27", optional = true} +inquire = "0.7.5" +bincode = "1.3.3" +rand = "0.8.5" +cbc = { version = "0.1.2", features = ["alloc", "std"] } +aes = "0.8.4" +sha2 = "0.10.8" +serde_json = "1.0.116" +base64 = "0.22.1" [features] default = ["update-notify"] -- 2.45.2 From 359ac16af8b8d7876ce4c99495b92a9945ea7171 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Fri, 3 May 2024 07:37:04 +0300 Subject: [PATCH 3/4] chore(msrv): Bump the MSRV to `1.74.0` --- .forgejo/workflows/ci.yml | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index fb8842f..7f31fc7 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: debian steps: - uses: actions/checkout@v4 - - uses: https://codeberg.org/TheAwiteb/rust-action@v1.70 + - uses: https://codeberg.org/TheAwiteb/rust-action@v1.74 - name: Build the source code run: cargo build - name: Check the code format diff --git a/Cargo.toml b/Cargo.toml index 46bd098..930e9b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Awiteb "] readme = "README.md" description = "A local CLI password manager" repository = "https://git.4rs.nl/awiteb/lprs" -rust-version = "1.70.0" +rust-version = "1.74.0" keywords = ["password", "manager", "CLI"] categories = ["command-line-utilities"] -- 2.45.2 From 6f6966d5b25b2b5047081304f7597fe80ec95387 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Thu, 2 May 2024 21:34:08 +0300 Subject: [PATCH 4/4] feat: Encrypt the hole vault file BREAKING-CHANGE: The previous format is not supported after this commit, so you must export your vaults in bit-warden format (before this commit) and then re-invoke them (after this commit) --- src/cli/clean_command.rs | 2 +- src/cli/export_command.rs | 9 +-- src/cli/import_command.rs | 14 +++-- src/cli/mod.rs | 17 ++++-- src/errors.rs | 12 ++-- src/main.rs | 13 ++--- src/utils.rs | 22 +++----- src/vault/cipher.rs | 73 +++++++++++------------- src/vault/mod.rs | 115 +++++++++++++++++++++++--------------- src/vault/validator.rs | 35 ------------ 10 files changed, 147 insertions(+), 165 deletions(-) delete mode 100644 src/vault/validator.rs diff --git a/src/cli/clean_command.rs b/src/cli/clean_command.rs index 88001f9..2e8cd7b 100644 --- a/src/cli/clean_command.rs +++ b/src/cli/clean_command.rs @@ -30,6 +30,6 @@ impl LprsCommand for Clean { "Cleaning the vaults file: {:?}", vault_manager.vaults_file.display() ); - fs::write(vault_manager.vaults_file, "[]").map_err(LprsError::Io) + fs::write(vault_manager.vaults_file, []).map_err(LprsError::Io) } } diff --git a/src/cli/export_command.rs b/src/cli/export_command.rs index 3d576a6..3e2023a 100644 --- a/src/cli/export_command.rs +++ b/src/cli/export_command.rs @@ -19,7 +19,7 @@ use std::{fs, io::Error as IoError, io::ErrorKind as IoErrorKind, path::PathBuf} use clap::Args; use crate::{ - vault::{BitWardenPasswords, Format, Vault, Vaults}, + vault::{BitWardenPasswords, Format, Vaults}, LprsCommand, LprsError, LprsResult, }; @@ -31,6 +31,7 @@ pub struct Export { /// Format to export vaults in #[arg(short, long, value_name = "FORMAT", default_value_t= Format::Lprs)] format: Format, + // TODO: `force` flag to write on existing file } impl LprsCommand for Export { @@ -42,9 +43,9 @@ impl LprsCommand for Export { self.format ); let exported_data = match self.format { - Format::Lprs => serde_json::to_string::>(&vault_manager.encrypt_vaults()?), - Format::BitWarden => serde_json::to_string(&BitWardenPasswords::from(vault_manager)), - }?; + Format::Lprs => vault_manager.json_export()?, + Format::BitWarden => serde_json::to_string(&BitWardenPasswords::from(vault_manager))?, + }; fs::write(&self.path, exported_data).map_err(LprsError::from) } diff --git a/src/cli/import_command.rs b/src/cli/import_command.rs index 31ca224..ff70302 100644 --- a/src/cli/import_command.rs +++ b/src/cli/import_command.rs @@ -14,7 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{fs::File, io::Error as IoError, io::ErrorKind as IoErrorKind, path::PathBuf}; +use std::{ + fs::{self, File}, + io::Error as IoError, + io::ErrorKind as IoErrorKind, + path::PathBuf, +}; use clap::Args; @@ -45,10 +50,11 @@ impl LprsCommand for Import { let imported_passwords_len = match self.format { Format::Lprs => { - let vaults = Vaults::try_reload(self.path, vault_manager.master_password.to_vec())?; - let vaults_len = vaults.vaults.len(); + let vaults = + Vaults::json_reload(&vault_manager.master_password, &fs::read(self.path)?)?; + let vaults_len = vaults.len(); - vault_manager.vaults.extend(vaults.vaults); + vault_manager.vaults.extend(vaults); vault_manager.try_export()?; vaults_len } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 4a0a1dd..5f63b44 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::path::PathBuf; +use std::{fs, path::PathBuf}; use clap::Parser; @@ -73,6 +73,13 @@ impl Cli { pub fn run(self) -> LprsResult<()> { let vaults_file = if let Some(path) = self.vaults_file { log::info!("Using the given vaults file"); + if let Some(parent) = path.parent() { + if parent.to_str() != Some("") && !parent.exists() { + log::info!("Creating the parent vaults file directory"); + fs::create_dir_all(parent)?; + } + } + fs::File::create(&path)?; path } else { log::info!("Using the default vaults file"); @@ -91,11 +98,9 @@ impl Cli { } } else { log::info!("Reloading the vaults file"); - let master_password = utils::master_password_prompt(&vaults_file)?; - Vaults::try_reload( - vaults_file, - master_password.into_bytes().into_iter().take(32).collect(), - )? + let master_password = + utils::master_password_prompt(fs::read(&vaults_file)?.is_empty())?; + Vaults::try_reload(vaults_file, master_password)? }; self.command.run(vault_manager) diff --git a/src/errors.rs b/src/errors.rs index c6a2985..e7bde78 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -20,15 +20,11 @@ pub type Result = std::result::Result; #[derive(Debug, thiserror::Error)] pub enum Error { - #[error("Invalid Json Path Error: {0}")] - InvalidJsonPath(String), #[error("Encryption Error: {0}")] Encryption(String), - #[error("Decryption Error: {0}")] - Decryption(String), - #[error( - "Wrong Master Password Error: Wrong password or you may have played with the password file" - )] + #[error("Decryption Error: The given key cannot decrypt the given data. Either the data has been tampered with or the key is incorrect.")] + Decryption, + #[error("Wrong Master Password Error: Wrong decryption password")] WrongMasterPassword, #[error("Weak Password Error: {0}")] WeakPassword(String), @@ -45,6 +41,8 @@ pub enum Error { InvalidRegex(#[from] regex::Error), #[error("UTF8 Error: {0}")] Utf8(#[from] FromUtf8Error), + #[error("Bincode Error: {0}")] + Bincode(#[from] bincode::Error), #[error("Base64 Decode Error: {0}")] BaseDecodeError(#[from] base64::DecodeError), #[error("Json Error: {0}")] diff --git a/src/main.rs b/src/main.rs index 5107b9b..1ab2191 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,13 +14,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::process::ExitCode; - -use base64::{ - alphabet, - engine::{general_purpose::PAD, GeneralPurpose}, -}; use clap::Parser; +use inquire::InquireError; +use std::process::ExitCode; pub mod cli; pub mod errors; @@ -30,12 +26,11 @@ pub mod vault; mod macros; mod traits; +pub use base64::engine::general_purpose::STANDARD as BASE64; pub use errors::{Error as LprsError, Result as LprsResult}; -use inquire::InquireError; pub use traits::*; -pub const STANDARDBASE: GeneralPurpose = GeneralPurpose::new(&alphabet::STANDARD, PAD); -pub const DEFAULT_VAULTS_FILE: &str = "vaults.json"; +pub const DEFAULT_VAULTS_FILE: &str = "vaults.lprs"; #[cfg(feature = "update-notify")] pub const VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/src/utils.rs b/src/utils.rs index f88065d..98e38d7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -14,14 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{ - fs, - path::{Path, PathBuf}, -}; +use std::{fs, path::PathBuf}; use inquire::validator::Validation; +use sha2::Digest; -use crate::{vault, LprsError, LprsResult}; +use crate::{LprsError, LprsResult}; /// Returns the local project dir joined with the given file name pub fn local_project_file(filename: &str) -> LprsResult { @@ -42,11 +40,7 @@ pub fn local_project_file(filename: &str) -> LprsResult { pub fn vaults_file() -> LprsResult { let vaults_file = local_project_file(crate::DEFAULT_VAULTS_FILE)?; if !vaults_file.exists() { - log::info!( - "Vaults file not found, creating a new one: {:?}", - vaults_file.display() - ); - fs::write(&vaults_file, "[]")?; + fs::File::create(&vaults_file)?; } Ok(vaults_file) } @@ -71,9 +65,9 @@ pub fn password_validator(password: &str) -> Result LprsResult { - let is_new_vaults_file = vault::is_new_vaults_file(vaults_file)?; - +/// +/// Return's the password as 32 bytes after hash it (256 bit) +pub fn master_password_prompt(is_new_vaults_file: bool) -> LprsResult<[u8; 32]> { inquire::Password { message: "Master Password:", enable_confirmation: is_new_vaults_file, @@ -87,7 +81,7 @@ pub fn master_password_prompt(vaults_file: &Path) -> LprsResult { .with_formatter(&|p| "*".repeat(p.chars().count())) .with_display_mode(inquire::PasswordDisplayMode::Masked) .prompt() - .map(sha256::digest) + .map(|p| sha2::Sha256::digest(p).into()) .map_err(Into::into) } diff --git a/src/vault/cipher.rs b/src/vault/cipher.rs index 39a5c21..e71ea75 100644 --- a/src/vault/cipher.rs +++ b/src/vault/cipher.rs @@ -14,53 +14,44 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use base64::Engine; -use soft_aes::aes::{aes_dec_ecb, aes_enc_ecb}; +use aes::cipher::{block_padding::Pkcs7, BlockDecryptMut, BlockEncryptMut, KeyIvInit}; +use rand::{rngs::StdRng, Rng, SeedableRng}; +use std::time::{SystemTime, UNIX_EPOCH}; use crate::{LprsError, LprsResult}; -/// Encrypt the string with AEC ECB -pub fn encrypt(master_password: &[u8], data: &str) -> LprsResult { - let padding = Some("PKCS7"); +type Aes256CbcEnc = cbc::Encryptor; +type Aes256CbcDec = cbc::Decryptor; - aes_enc_ecb(data.as_bytes(), master_password, padding) - .map(|d| crate::STANDARDBASE.encode(d)) - .map_err(|err| LprsError::Encryption(err.to_string())) -} - -/// Decrypt the string with AEC ECB -pub fn decrypt(master_password: &[u8], data: &str) -> LprsResult { - let padding = Some("PKCS7"); - - aes_dec_ecb( - crate::STANDARDBASE.decode(data)?.as_slice(), - master_password, - padding, +/// Encrypt the given data by the given key using AES-256 CBC +/// +/// Note: The IV will be add it to the end of the ciphertext (Last 16 bytes) +pub(crate) fn encrypt(master_password: &[u8; 32], data: &[u8]) -> Vec { + let iv: [u8; 16] = StdRng::seed_from_u64( + SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("SystemTime before UNIX EPOCH!") + .as_secs(), ) - .map_err(|err| { - if err.to_string().contains("Invalid padding") { - LprsError::WrongMasterPassword - } else { - LprsError::Decryption(err.to_string()) - } - }) - .map(|d| String::from_utf8(d).map_err(LprsError::Utf8))? + .gen(); + + let mut ciphertext = + Aes256CbcEnc::new(master_password.into(), &iv.into()).encrypt_padded_vec_mut::(data); + ciphertext.extend(&iv); + ciphertext } -/// Encrypt if the `Option` are `Some` -pub fn encrypt_some( - master_password: &[u8], - data: Option>, -) -> LprsResult> { - data.map(|d| encrypt(master_password, d.as_ref())) - .transpose() -} +/// Decrypt the given data by the given key, the data should +/// be encrypted by AES-256 CBC. The IV will be extraxted +/// from the last 16 bytes. +pub(crate) fn decrypt(master_password: &[u8; 32], data: &[u8]) -> LprsResult> { + let (ciphertext, iv) = data.split_at( + data.len() + .checked_sub(16) + .ok_or_else(|| LprsError::Decryption)?, + ); -/// Decrypt if the `Option` are `Some` -pub fn decrypt_some( - master_password: &[u8], - data: Option>, -) -> LprsResult> { - data.map(|d| decrypt(master_password, d.as_ref())) - .transpose() + Aes256CbcDec::new(master_password.into(), iv.into()) + .decrypt_padded_vec_mut::(ciphertext) + .map_err(|_| LprsError::Decryption) } diff --git a/src/vault/mod.rs b/src/vault/mod.rs index 1c3ea8e..11d2595 100644 --- a/src/vault/mod.rs +++ b/src/vault/mod.rs @@ -16,6 +16,7 @@ use std::{fs, path::PathBuf}; +use base64::Engine; use clap::{Parser, ValueEnum}; use serde::{Deserialize, Serialize}; @@ -24,10 +25,8 @@ use crate::{LprsError, LprsResult}; pub mod cipher; mod bitwarden; -mod validator; pub use bitwarden::*; -pub use validator::*; #[derive(Clone, Debug, ValueEnum)] pub enum Format { @@ -36,7 +35,6 @@ pub enum Format { } /// The vault struct -#[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Deserialize, Serialize, Parser)] pub struct Vault { /// The name of the vault @@ -60,7 +58,7 @@ pub struct Vault { #[derive(Default)] pub struct Vaults { /// Hash of the master password - pub master_password: Vec, + pub master_password: [u8; 32], /// The json vaults file pub vaults_file: PathBuf, /// The vaults @@ -85,28 +83,6 @@ impl Vault { } } - /// Decrypt the vault - pub fn decrypt(&self, master_password: &[u8]) -> LprsResult { - Ok(Vault::new( - cipher::decrypt(master_password, &self.name)?, - cipher::decrypt_some(master_password, self.username.as_ref())?, - cipher::decrypt_some(master_password, self.password.as_ref())?, - cipher::decrypt_some(master_password, self.service.as_ref())?, - cipher::decrypt_some(master_password, self.note.as_ref())?, - )) - } - - /// Encrypt the vault - pub fn encrypt(&self, master_password: &[u8]) -> LprsResult { - Ok(Vault::new( - cipher::encrypt(master_password, &self.name)?, - cipher::encrypt_some(master_password, self.username.as_ref())?, - cipher::encrypt_some(master_password, self.password.as_ref())?, - cipher::encrypt_some(master_password, self.service.as_ref())?, - cipher::encrypt_some(master_password, self.note.as_ref())?, - )) - } - /// Return the name of the vault with the service if there pub fn list_name(&self) -> String { use std::fmt::Write; @@ -126,7 +102,7 @@ impl Vault { impl Vaults { /// Create new [`Vaults`] instnce - pub fn new(master_password: Vec, vaults_file: PathBuf, vaults: Vec) -> Self { + pub fn new(master_password: [u8; 32], vaults_file: PathBuf, vaults: Vec) -> Self { Self { master_password, vaults_file, @@ -134,22 +110,65 @@ impl Vaults { } } - /// Encrypt the vaults - pub fn encrypt_vaults(&self) -> LprsResult> { - self.vaults - .iter() - .map(|p| p.encrypt(&self.master_password)) - .collect() + /// Add new vault + pub fn add_vault(&mut self, vault: Vault) { + self.vaults.push(vault) } - /// Reload the vaults from the file then decrypt it - pub fn try_reload(vaults_file: PathBuf, master_password: Vec) -> LprsResult { - let vaults = serde_json::from_str::>(&fs::read_to_string(&vaults_file)?)? - .into_iter() - .map(|p| p.decrypt(master_password.as_slice())) - .collect::>>()?; + /// Encrypt the vaults then returns it as json. + /// + /// This function used to backup the vaults. + /// + /// Note: The returned string is `Vec` + pub fn json_export(&self) -> LprsResult { + let encrypt = |val: &str| { + LprsResult::Ok( + crate::BASE64.encode(cipher::encrypt(&self.master_password, val.as_ref())), + ) + }; - Ok(Self::new(master_password, vaults_file, vaults)) + serde_json::to_string( + &self + .vaults + .iter() + .map(|v| { + LprsResult::Ok(Vault::new( + encrypt(&v.name)?, + v.username.as_ref().and_then(|u| encrypt(u).ok()), + v.password.as_ref().and_then(|p| encrypt(p).ok()), + v.service.as_ref().and_then(|s| encrypt(s).ok()), + v.note.as_ref().and_then(|n| encrypt(n).ok()), + )) + }) + .collect::>>()?, + ) + .map_err(Into::into) + } + + /// Reload the vaults from json data. + /// + /// This function used to import backup vaults. + pub fn json_reload(master_password: &[u8; 32], json_data: &[u8]) -> LprsResult> { + let decrypt = |val: &str| { + String::from_utf8(cipher::decrypt( + master_password, + &crate::BASE64.decode(val)?, + )?) + .map_err(|err| LprsError::Other(err.to_string())) + }; + + serde_json::from_slice::>(json_data)? + .into_iter() + .map(|v| { + LprsResult::Ok(Vault::new( + decrypt(&v.name)?, + v.username.as_ref().and_then(|u| decrypt(u).ok()), + v.password.as_ref().and_then(|p| decrypt(p).ok()), + v.service.as_ref().and_then(|s| decrypt(s).ok()), + v.note.as_ref().and_then(|n| decrypt(n).ok()), + )) + }) + .collect() } /// Encrypt the vaults then export it to the file @@ -160,14 +179,22 @@ impl Vaults { ); fs::write( &self.vaults_file, - serde_json::to_string(&self.encrypt_vaults()?)?, + cipher::encrypt(&self.master_password, &bincode::serialize(&self.vaults)?), ) .map_err(LprsError::Io) } - /// Add new vault - pub fn add_vault(&mut self, vault: Vault) { - self.vaults.push(vault) + /// Reload the vaults from the file then decrypt it + pub fn try_reload(vaults_file: PathBuf, master_password: [u8; 32]) -> LprsResult { + let vaults_data = fs::read(&vaults_file)?; + + let vaults: Vec = if vaults_data.is_empty() { + vec![] + } else { + bincode::deserialize(&cipher::decrypt(&master_password, &vaults_data)?)? + }; + + Ok(Self::new(master_password, vaults_file, vaults)) } } diff --git a/src/vault/validator.rs b/src/vault/validator.rs deleted file mode 100644 index c29d69f..0000000 --- a/src/vault/validator.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Lprs - A local CLI vault manager -// Copyright (C) 2024 Awiteb -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use std::{fs, path::Path}; - -use crate::LprsResult; - -use super::Vault; - -/// Return if the vaults file new file or not -pub fn is_new_vaults_file(path: &Path) -> LprsResult { - if path.exists() { - let file_content = fs::read_to_string(path)?; - if !file_content.is_empty() - && file_content.trim() != "[]" - && serde_json::from_str::>(&file_content).is_ok() - { - return Ok(false); - } - } - Ok(true) -} -- 2.45.2