Greetings,

I added OTP support to passmenu and I thought it could be helpful to
others also (hopefully). I just subscribed to the list to send the
formated patch (attached).

Congratulations on pass. Awesome tool!

Best regards,
Albert.
From c6f679b3fbe817e091a709575364115adc64487f Mon Sep 17 00:00:00 2001
From: vonpupp <alb...@haevas.com>
Date: Sun, 9 Aug 2020 22:15:48 -0300
Subject: [PATCH] Add otp support to passmenu

---
 contrib/dmenu/passmenu | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index 83268bc..1d0edb7 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -3,10 +3,15 @@
 shopt -s nullglob globstar
 
 typeit=0
+otp=0
 if [[ $1 == "--type" ]]; then
 	typeit=1
 	shift
 fi
+if [[ $1 == "--otp" ]]; then
+	otp=1
+	shift
+fi
 
 prefix=${PASSWORD_STORE_DIR-~/.password-store}
 password_files=( "$prefix"/**/*.gpg )
@@ -17,7 +22,9 @@ password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
 
 [[ -n $password ]] || exit
 
-if [[ $typeit -eq 0 ]]; then
+if [[ $otp -eq 1 ]]; then
+	pass otp -c "$password" 2>/dev/null
+elif [[ $typeit -eq 0 ]]; then
 	pass show -c "$password" 2>/dev/null
 else
 	pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } |
-- 
2.28.0

Reply via email to