diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-10-27 22:56:09 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-10-27 22:56:09 -0400 |
commit | cc389962fdd1c7eca9d328b794c95f8d5536944c (patch) | |
tree | feb0939ab58a672b0364a8a3bf1ccd7b7e1766bd /src/pinentry.rs | |
parent | 3fa5908401237b643c69f84bbf4c69e1ca3e2484 (diff) | |
download | rbw-cc389962fdd1c7eca9d328b794c95f8d5536944c.tar.gz rbw-cc389962fdd1c7eca9d328b794c95f8d5536944c.zip |
don't grab the keyboard when entering the api key
unlike the vault password, it's pretty unlikely that someone will be
entering the api key by hand, so make copy/paste more reasonable
Diffstat (limited to 'src/pinentry.rs')
-rw-r--r-- | src/pinentry.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pinentry.rs b/src/pinentry.rs index d62d4b2..b4d2bb0 100644 --- a/src/pinentry.rs +++ b/src/pinentry.rs @@ -8,15 +8,19 @@ pub async fn getpin( desc: &str, err: Option<&str>, tty: Option<&str>, + grab: bool, ) -> Result<crate::locked::Password> { let mut opts = tokio::process::Command::new(pinentry); opts.stdin(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped()); + let mut args = vec!["-o", "0"]; if let Some(tty) = tty { - opts.args(&["-T", tty, "-o", "0"]); - } else { - opts.args(&["-o", "0"]); + args.extend(&["-T", tty]); } + if !grab { + args.push("-g"); + } + opts.args(args); let mut child = opts.spawn().map_err(|source| Error::Spawn { source })?; // unwrap is safe because we specified stdin as piped in the command opts // above |