tessen

default description
git clone https://git.awy.one/tessen.git
Log | Files | Refs | README | LICENSE

commit 4c3e80bdf45ab1a4ac6a7b620787da4d87cc9049
parent 0ef171e6d21f984a19742311a37ea2ccd8d54642
Author: Ayush Agarwal <ayush@fastmail.in>
Date:   Wed, 16 Feb 2022 22:12:31 +0530

feat: add support for OTP when using gopass

refactor: offload the autotype and copy operation to key_action

Diffstat:
Mtessen | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tessen b/tessen @@ -373,25 +373,27 @@ key_action() { } # THIRD MENU: optional, this function is used if an 'otpauth://' URI is found +# note that OTP support in gopass is deprecated and if they end up removing +# support for it, we'll have to make changes here as well key_otp() { local tmp_otp - if ! pass otp -h > /dev/null 2>&1; then + if [[ "$pass_backend" == "pass" ]] && ! pass otp -h > /dev/null 2>&1; then _die "pass-otp is not installed" fi - tmp_otp="$(pass otp "$tsn_passfile")" + if [[ "$pass_backend" == "pass" ]]; then + tmp_otp="$(pass otp "$tsn_passfile")" + elif [[ "$pass_backend" == "gopass" ]]; then + tmp_otp="$(gopass otp -o "$tsn_passfile")" + fi - if [[ "$tmp_otp" =~ ^[[:digit:]]+$ ]]; then - get_key option - if [[ "$chosen_key" == "$tsn_autokey" ]]; then - auto_type "$tmp_otp" - else - wld_copy "$tmp_otp" - fi - else + if ! [[ "$tmp_otp" =~ ^[[:digit:]]+$ ]]; then _die "invalid OTP detected" fi + key_action "$tmp_otp" + + unset -v tmp_otp } # THIRD MENU: optional, this function is used if TESSEN_URLKEY is found.