diff options
-rw-r--r-- | src/bin/agent.rs | 10 | ||||
-rw-r--r-- | src/pinentry.rs | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/bin/agent.rs b/src/bin/agent.rs index dedfe68..7c08216 100644 --- a/src/bin/agent.rs +++ b/src/bin/agent.rs @@ -62,9 +62,8 @@ async fn login( ) { let mut state = state.write().await; let email = "bitwarden@tozt.net"; // XXX read from config - let password = rbw::pinentry::pinentry("prompt", "desc", tty) - .await - .unwrap(); + let password = + rbw::pinentry::getpin("prompt", "desc", tty).await.unwrap(); let (access_token, iterations, protected_key) = rbw::actions::login(email, &password).await.unwrap(); state.access_token = Some(access_token); @@ -89,9 +88,8 @@ async fn unlock( ) { let mut state = state.write().await; let email = "bitwarden@tozt.net"; // XXX read from config - let password = rbw::pinentry::pinentry("prompt", "desc", tty) - .await - .unwrap(); + let password = + rbw::pinentry::getpin("prompt", "desc", tty).await.unwrap(); let (enc_key, mac_key) = rbw::actions::unlock( email, &password, diff --git a/src/pinentry.rs b/src/pinentry.rs index 8a25759..aced54f 100644 --- a/src/pinentry.rs +++ b/src/pinentry.rs @@ -2,7 +2,7 @@ use crate::prelude::*; use tokio::io::AsyncWriteExt as _; -pub async fn pinentry( +pub async fn getpin( prompt: &str, desc: &str, tty: Option<&str>, |