dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 84da251b2e572c909f942e1cb1316b0164a0791a
parent be6067452ca15a390914f02a239d5a25c091adc3
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sun, 28 Jun 2020 21:40:51 +0200

Add support for one-time passwords

Diffstat:
M.local/bin/passmenu | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/.local/bin/passmenu b/.local/bin/passmenu @@ -75,16 +75,23 @@ retrieve_password() if [ -n "$prefix" ]; then xdotool type "$prefix" fi + case "${_passfile}" in + */2fa-*) + f="$(printf '%s' "${_passfile}" | sed "s,$pass_dir/,,;s,.gpg,,")" + p="$(pass otp "$f")";; + *) + p="$(gpg2 -q -d "${_passfile}")";; + esac if [ "$typeout" = 1 ]; then - gpg -q -d "${_passfile}" | \ + printf '%s' "$p" | \ { IFS= read -r pass; printf %s "$pass"; } | \ xdotool type --clearmodifiers --file - if [ "$newline" = 1 ]; then xdotool key Return fi else - gpg -q -d "${_passfile}" | xclip + printf '%s' "$p" | xclip fi }