aboutsummaryrefslogtreecommitdiffstats
path: root/src/pinentry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pinentry.rs')
-rw-r--r--src/pinentry.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pinentry.rs b/src/pinentry.rs
index c0a929b..707fb24 100644
--- a/src/pinentry.rs
+++ b/src/pinentry.rs
@@ -5,6 +5,7 @@ use tokio::io::AsyncWriteExt as _;
pub async fn getpin(
prompt: &str,
desc: &str,
+ err: Option<&str>,
tty: Option<&str>,
) -> Result<crate::locked::Password> {
let mut opts = tokio::process::Command::new("pinentry");
@@ -33,6 +34,12 @@ pub async fn getpin(
.write_all(format!("SETDESC {}\n", desc).as_bytes())
.await
.context(crate::error::WriteStdin)?;
+ if let Some(err) = err {
+ stdin
+ .write_all(format!("SETERROR {}\n", err).as_bytes())
+ .await
+ .context(crate::error::WriteStdin)?;
+ }
stdin
.write_all(b"GETPIN\n")
.await