diff --git a/Cargo.lock b/Cargo.lock index e769fc0..2a7e241 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2476,11 +2476,12 @@ dependencies = [ [[package]] name = "rpassword" -version = "5.0.1" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" +checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322" dependencies = [ "libc", + "rtoolbox", "winapi", ] @@ -2506,6 +2507,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rtoolbox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "rustc-demangle" version = "0.1.23" diff --git a/Cargo.toml b/Cargo.toml index ee01fde..1a6a9a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ path = "src/main.rs" anyhow = "^1.0" base64 = "0.21.2" text_io = "0.1.8" -rpassword = "5.0" +rpassword = "7.2.0" reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "cookies", "gzip", "rustls-tls"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/src/commands/encrypt.rs b/src/commands/encrypt.rs index ca28e4d..09629d7 100644 --- a/src/commands/encrypt.rs +++ b/src/commands/encrypt.rs @@ -25,9 +25,8 @@ where error!("Passkey cannot be empty, try again."); continue; } - let passkey_confirm = - rpassword::prompt_password_stdout("Confirm encryption passkey: ") - .map(SecretString::new)?; + let passkey_confirm = rpassword::prompt_password("Confirm encryption passkey: ") + .map(SecretString::new)?; if passkey1.expose_secret() == passkey_confirm.expose_secret() { passkey = Some(passkey1); break; diff --git a/src/login.rs b/src/login.rs index c3670e0..2753968 100644 --- a/src/login.rs +++ b/src/login.rs @@ -82,6 +82,7 @@ fn do_login_impl( password: SecretString, account: Option<&SteamGuardAccount>, ) -> anyhow::Result { + debug!("starting login"); let mut login = UserLogin::new(transport.clone(), build_device_details()); let mut password = password; diff --git a/src/tui.rs b/src/tui.rs index 600eaa5..99c3dd2 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use crossterm::{ cursor, event::{Event, KeyCode, KeyEvent, KeyModifiers}, @@ -6,6 +7,7 @@ use crossterm::{ terminal::{Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen}, QueueableCommand, }; +use log::debug; use secrecy::SecretString; use std::collections::HashSet; use std::io::{stderr, stdout, Write}; @@ -245,18 +247,21 @@ pub(crate) fn pause() { } } -pub(crate) fn prompt_passkey() -> std::io::Result { +pub(crate) fn prompt_passkey() -> anyhow::Result { + debug!("prompting for passkey"); loop { - let raw = rpassword::prompt_password_stdout("Enter encryption passkey: ")?; + let raw = rpassword::prompt_password("Enter encryption passkey: ") + .context("prompting for passkey")?; if !raw.is_empty() { return Ok(SecretString::new(raw)); } } } -pub(crate) fn prompt_password() -> std::io::Result { +pub(crate) fn prompt_password() -> anyhow::Result { + debug!("prompting for password"); loop { - let raw = rpassword::prompt_password_stdout("Password: ")?; + let raw = rpassword::prompt_password("Password: ").context("prompting for password")?; if !raw.is_empty() { return Ok(SecretString::new(raw)); }