From ef3ad03bab97e9a77433fb76d81cf969d3e914d6 Mon Sep 17 00:00:00 2001 From: ewy Date: Wed, 7 Oct 2026 16:08:28 +0200 Subject: fix uwupass --- .local/bin/uwupass | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to '.local/bin') diff --git a/.local/bin/uwupass b/.local/bin/uwupass index c6ce9e1..edb3336 100755 --- a/.local/bin/uwupass +++ b/.local/bin/uwupass @@ -41,31 +41,31 @@ if ! command -v gpg; then fi # Compose the database opening command +# needs to be suffixed with entry name dbQuery() { command="keepassxc-cli $*" - [[ -e ${KEYFILE:-} ]] && command="$command -k $KEYFILE" - [[ -e ${YUBIKEY:-} ]] && command="$command -y" + [[ -e ${KEYFILE:-} ]] && command="$command --key-file $KEYFILE" + [[ -e ${YUBIKEY:-} ]] && command="$command --yubikey" command="$command $DATABASE" - # Don't use message here, because this essentially returns a value echo "$command" } # Decrypt the pgp password -pass=$(gpg --decrypt "$PGP_KEY") +decryptPass=$(gpg --decrypt "$PGP_KEY") # Send the entries to dmenu -entry=$(echo "$pass" | eval "$(dbQuery ls -R -f)" | ${DMENU:-dmenu} -p "Select entry") +query=$(dbQuery ls -R -f) +entries=$(echo $decryptPass | $query) +entry=$(echo "$entries" | ${DMENU:-dmenu} -p "Select entry") +pass=$(echo "$decryptPass" | $(dbQuery show --show-protected --attributes Password) "$entry") +# Retrieve the target password +echo -n "$pass" | wl-copy --sensitive -# Retreive the target password -target=$(echo "$pass" | eval "$(dbQuery show -s)" -a Password \"$entry\") +message "Copied password for $entry." - -# Write the password -echo -n "$target" | wl-copy -message "Copied password for $entry to selection buffer." +exit # Copy TOTP ~~to clipboard~~ -totp="$(echo "$pass" | eval "$(dbQuery show -s -t)" \"$entry\")" -echo $totp +totp=$(echo "$decryptPass" | $(dbQuery show --show-protected --totp) $entry || true) if [[ -n "$totp" ]]; then message "Your TOTP is $totp." fi -- cgit v1.3.1