diff options
| author | ewy <ewy0@protonmail.com> | 2026-10-07 16:08:28 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-10-07 16:10:50 +0200 |
| commit | ef3ad03bab97e9a77433fb76d81cf969d3e914d6 (patch) | |
| tree | f916b81e752f02252a29e8f3545325b34d67d1fc /.local | |
| parent | 21d7d595e3df9468d0acd42e03569db5a10d6b60 (diff) | |
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/uwupass | 26 |
1 files changed, 13 insertions, 13 deletions
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 |
