From 0ab35cdcdcb003a29d2488f4fda22d06e6e8a187 Mon Sep 17 00:00:00 2001 From: Moviuro Date: Sun, 12 Nov 2017 15:28:36 +0100 Subject: rofi-pass: first integration of pass-otp(1) --- rofi-pass | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rofi-pass b/rofi-pass index 0f3edc2..a2d173c 100755 --- a/rofi-pass +++ b/rofi-pass @@ -318,14 +318,22 @@ mainMenu () { mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass "${pass_file}") password=${password_temp[0]} fi - fields=$(printf '%s\n' "${password_temp[@]:1}" | awk '$1 ~ /:$/{$1=$1;print}') + fields=$(printf '%s\n' "${password_temp[@]:1}" | awk '$1 ~ /:$/ || /otpauth:\/\// {$1=$1;print}') declare -A stuff stuff["pass"]=${password} if [[ -n $fields ]]; then while read -r LINE; do - _id="${LINE%%: *}" - _val="${LINE#* }" + case "$LINE" in + "otpauth://"*) + _id="OTP" + _val="$(PASSWORD_STORE_DIR="${root}" pass otp "$selected_password")" + ;; + *) + _id="${LINE%%: *}" + _val="${LINE#* }" + ;; + esac stuff["${_id}"]=${_val} done < <(printf '%s\n' "${fields}") if test "${stuff['autotype']+autotype}" -- cgit