Skip to content

Commit 30791db

Browse files
committed
update dependencies
Signed-off-by: Michael Lodder <redmike7@gmail.com>
1 parent 0812929 commit 30791db

5 files changed

Lines changed: 136 additions & 155 deletions

File tree

Cargo.toml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["secrets", "vault", "keyring"]
1313
license = "MIT/Apache-2.0"
1414
repository = "https://github.com/mikelodder7/cryptex"
1515
readme = "README.md"
16-
version = "1.11.0"
16+
version = "2.0.0"
1717

1818
[lib]
1919
crate-type = ["staticlib", "rlib", "cdylib"]
@@ -24,28 +24,27 @@ name = "cryptex"
2424
[features]
2525
default = ["linux-secret-service", "macos-keychain", "windows-credentials"]
2626
file = ["argon2", "chacha20poly1305", "dirs", "rusqlite"]
27-
linux-secret-service = ["secret-service", "users"]
28-
macos-keychain = ["security-framework", "security-framework-sys", "core-foundation", "core-foundation-sys", "users"]
29-
windows-credentials = ["winapi", "byteorder"]
27+
linux-secret-service = ["secret-service", "uzers"]
28+
macos-keychain = ["security-framework", "security-framework-sys", "core-foundation", "core-foundation-sys", "uzers"]
29+
windows-credentials = ["windows"]
3030

3131
[dependencies]
32-
atty = "0.2"
33-
clap = "2.33"
32+
clap = "4"
3433
colored = "3.0"
3534
hex = "0.4"
3635
rpassword = "7"
3736
serde = { version = "1", optional = true }
3837
subtle = "2"
39-
whoami = "1.6"
38+
whoami = "2"
4039
zeroize = { version = "1", features = ["zeroize_derive"] }
4140

4241
argon2 = { version = "0.5", optional = true }
4342
chacha20poly1305 = { version = "0.10", optional = true }
4443
dirs = { version = "6.0", optional = true }
45-
rusqlite = { version = "0.37", features = ["bundled-sqlcipher-vendored-openssl"], optional = true }
44+
rusqlite = { version = "0.38", features = ["bundled-sqlcipher-vendored-openssl"], optional = true }
4645

4746
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
48-
users = { version = "0.11", optional = true }
47+
uzers = { version = "0.12", optional = true }
4948

5049
[target.'cfg(target_os = "macos")'.dependencies]
5150
security-framework = { version = "3", optional = true }
@@ -57,5 +56,10 @@ core-foundation-sys = { version = "0.8.7", optional = true }
5756
secret-service = { version = "5", features = ["rt-tokio-crypto-rust"], optional = true }
5857

5958
[target.'cfg(target_os = "windows")'.dependencies]
60-
winapi = { version = "0.3", features = ["dpapi", "errhandlingapi", "wincred", "winerror"], optional = true }
61-
byteorder = { version = "1.5", optional = true }
59+
windows = { version = "0.62", features = [
60+
"Win32_Foundation",
61+
"Win32_Security_Credentials",
62+
"Win32_Security_Cryptography",
63+
"Win32_Storage_FileSystem",
64+
], optional = true }
65+

src/keyring.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub use keyringsecret::*;
4242
all(target_os = "linux", feature = "linux-secret-service"),
4343
all(target_os = "macos", feature = "macos-keychain"),
4444
))]
45-
use users::{get_current_username, get_effective_username};
45+
use uzers::{get_current_username, get_effective_username};
4646

4747
/// Return the OS keyring if available
4848
#[cfg(any(
@@ -83,10 +83,14 @@ compile_error!("no keyring implementation is selected or available for this plat
8383
all(target_os = "macos", feature = "macos-keychain"),
8484
))]
8585
fn get_username() -> String {
86+
fn fallback_username() -> String {
87+
whoami::username().unwrap_or_else(|_| String::from("unknown"))
88+
}
89+
8690
fn get_current_user() -> String {
8791
match get_current_username() {
88-
Some(s) => s.into_string().unwrap_or_else(|_| whoami::username()),
89-
None => whoami::username(),
92+
Some(s) => s.into_string().unwrap_or_else(|_| fallback_username()),
93+
None => fallback_username(),
9094
}
9195
}
9296

src/keyring/sqlcipher.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,15 @@ fn get_keyring_file(in_path: Option<PathBuf>) -> PathBuf {
125125

126126
#[cfg(target_os = "windows")]
127127
fn make_hidden(path: &Path) {
128-
use std::ffi::CString;
128+
use std::ffi::OsStr;
129+
use std::iter::once;
130+
use std::os::windows::ffi::OsStrExt;
131+
use windows::Win32::Storage::FileSystem::{FILE_ATTRIBUTE_HIDDEN, SetFileAttributesW};
132+
use windows::core::PCWSTR;
133+
134+
let wide: Vec<u16> = OsStr::new(path).encode_wide().chain(once(0)).collect();
129135
unsafe {
130-
let file_name = path.to_str().unwrap();
131-
winapi::um::fileapi::SetFileAttributesA(
132-
file_name.as_ptr(),
133-
0x2, // Hidden
134-
);
136+
let _ = SetFileAttributesW(PCWSTR(wide.as_ptr()), FILE_ATTRIBUTE_HIDDEN);
135137
}
136138
}
137139

0 commit comments

Comments
 (0)