diff options
| author | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-01-23 12:48:30 +0100 |
|---|---|---|
| committer | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-01-23 12:48:30 +0100 |
| commit | 97f968a30e7dc28f6d99bfbaae8a4aeefb6ad525 (patch) | |
| tree | 5a250224ab69a04f05be2f757af86bfee9a7fec0 /passmenu-otp | |
| parent | a00f92fdb6062af011d98ba8af6ddf0713fa7b3e (diff) | |
| download | bin-97f968a30e7dc28f6d99bfbaae8a4aeefb6ad525.tar.gz bin-97f968a30e7dc28f6d99bfbaae8a4aeefb6ad525.zip | |
added all of my scripts
Diffstat (limited to 'passmenu-otp')
| -rwxr-xr-x | passmenu-otp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/passmenu-otp b/passmenu-otp new file mode 100755 index 0000000..d511944 --- /dev/null +++ b/passmenu-otp @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +: "${PASSWORD_STORE_DIR:=$HOME/.password-store}" +DMENU="${DMENU:-dmenu}" + +# Build list of pass entry paths (relative to PASSWORD_STORE_DIR) that contain an otpauth:// line. +entries=$( + find "$PASSWORD_STORE_DIR" -type f -name '*.gpg' ! -path '*/.git/*' -print 2>/dev/null | + while IFS= read -r f; do + entry="${f#$PASSWORD_STORE_DIR/}" + entry="${entry%.gpg}" + if pass show "$entry" 2>/dev/null | grep -q '^otpauth://'; then + printf '%s\n' "$entry" + fi + done +) + +[ -n "${entries:-}" ] || exit 0 + +choice=$(printf '%s\n' "$entries" | "$DMENU" -i -p "OTP:") +[ -n "${choice:-}" ] || exit 0 + +pass otp -c "$choice" |
