diff --git a/CHANGELOG.md b/CHANGELOG.md index 56c0f21..2558017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ FIXME: Released on - Enhancements: - Replaced sha256 sum with last modification time check, to verify if a file has been changed in the text editor +- dependencies: + - updated `rand` to `0.8.0` + - updated `textwrap` to `0.13.1` + - updated `toml` to `0.5.8` + - updated `whoami` to `1.0.1` ## 0.2.0 diff --git a/Cargo.lock b/Cargo.lock index f0da32c..87dfa7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -412,6 +412,17 @@ dependencies = [ "wasi 0.9.0+wasi-snapshot-preview1", ] +[[package]] +name = "getrandom" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "hostname" version = "0.3.1" @@ -740,11 +751,23 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.15", "libc", - "rand_chacha", - "rand_core", - "rand_hc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76330fb486679b4ace3670f117bbc9e16204005c4bde9c4bd372f45bed34f12" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.0", + "rand_hc 0.3.0", ] [[package]] @@ -754,7 +777,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.0", ] [[package]] @@ -763,7 +796,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.15", +] + +[[package]] +name = "rand_core" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8b34ba8cfb21243bd8df91854c830ff0d785fff2e82ebd4434c2644cb9ada18" +dependencies = [ + "getrandom 0.2.0", ] [[package]] @@ -772,7 +814,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.0", ] [[package]] @@ -787,7 +838,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ - "getrandom", + "getrandom 0.1.15", "redox_syscall", "rust-argon2", ] @@ -988,7 +1039,7 @@ checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ "cfg-if 0.1.10", "libc", - "rand", + "rand 0.7.3", "redox_syscall", "remove_dir_all", "winapi", @@ -1009,7 +1060,7 @@ dependencies = [ "hostname", "lazy_static", "magic-crypt", - "rand", + "rand 0.8.0", "regex", "rpassword", "serde", @@ -1025,9 +1076,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bca196a5c5a7bc57a5c92809cf5670e16bcbca3bf0d09ef47150bf97221f6f" +checksum = "7aca9e798437265144ddacce09343df0b3413a0aef54b1e212e640e472118b80" dependencies = [ "smawk", "unicode-width", @@ -1066,9 +1117,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ "serde", ] @@ -1219,9 +1270,9 @@ dependencies = [ [[package]] name = "whoami" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0b81b8c1996f45197d8aad89b388f0a419afb4c5c876a23006d2d1435cb82d8" +checksum = "e35495e7faf4c657051a8e9725d9c37ac57879e915be3ed55bb401af84382035" dependencies = [ "wasm-bindgen", "web-sys", diff --git a/Cargo.toml b/Cargo.toml index ab67057..783df5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,17 +26,17 @@ getopts = "0.2.21" hostname = "0.3.1" lazy_static = "1.4.0" magic-crypt = "3.1.6" -rand = "0.7.3" +rand = "0.8.0" regex = "1.4.2" rpassword = "5.0.0" serde = { version = "1.0.118", features = ["derive"] } ssh2 = "0.9.0" tempfile = "3.1.0" -textwrap = "0.13.0" -toml = "0.5.7" +textwrap = "0.13.1" +toml = "0.5.8" tui = { version = "0.13.0", features = ["crossterm"], default-features = false } unicode-width = "0.1.7" -whoami = "1.0.0" +whoami = "1.0.1" [target.'cfg(any(target_os = "unix", target_os = "macos", target_os = "linux"))'.dependencies] users = "0.11.0" diff --git a/src/system/bookmarks_client.rs b/src/system/bookmarks_client.rs index 4119ac4..0f6a297 100644 --- a/src/system/bookmarks_client.rs +++ b/src/system/bookmarks_client.rs @@ -33,7 +33,7 @@ use crate::filetransfer::FileTransferProtocol; use crate::utils::crypto; use crate::utils::fmt::fmt_time; // Ext -use rand::{distributions::Alphanumeric, Rng}; +use rand::{distributions::Alphanumeric, thread_rng, Rng}; use std::fs::{OpenOptions, Permissions}; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; @@ -284,10 +284,12 @@ impl BookmarksClient { /// Generate a new AES key and write it to key file fn generate_key(key_file: &Path) -> Result { // Generate 256 bytes (2048 bits) key - let key: String = rand::thread_rng() - .sample_iter(Alphanumeric) + let mut rng = thread_rng(); + let key: String = std::iter::repeat(()) + .map(|()| rng.sample(Alphanumeric)) + .map(char::from) .take(256) - .collect::(); + .collect(); // Write file match OpenOptions::new() .create(true) @@ -406,7 +408,7 @@ mod tests { // Verify client assert_eq!(client.hosts.bookmarks.len(), 0); assert_eq!(client.hosts.recents.len(), 0); - assert!(client.key.len() > 0); + assert_eq!(client.key.len(), 256); assert_eq!(client.bookmarks_file, cfg_path); assert_eq!(client.recents_size, 16); }