diff --git a/dot_config/fuzzel/executable_fuzzel-rbw.sh b/dot_config/fuzzel/executable_fuzzel-rbw.sh index d45ab9b..223f94f 100644 --- a/dot_config/fuzzel/executable_fuzzel-rbw.sh +++ b/dot_config/fuzzel/executable_fuzzel-rbw.sh @@ -31,6 +31,22 @@ copy_to_clipboard() { fi } +# Funktion zum Erzeugen eines TOTP aus otpauth URL +totp_from_otpauth() { + local url="$1" + if [[ "$url" =~ ^otpauth://totp/.*secret= ]]; then + local secret=$(echo "$url" | grep -oP 'secret=\K[^&]*') + if [[ -z "$secret" ]]; then + echo "Kein Secret im OTPAUTH-URL gefunden." + return 2 + fi + oathtool -b --totp "$secret" + else + echo "" + return 1 + fi +} + # Liste mit Name+User kombinieren und formatieren entries=$(rbw list --fields name,user | awk -F'\t' '{print $1 " | " $2}') @@ -55,6 +71,14 @@ if [[ -n "$selected" ]]; then if [[ -n "$selected_detail" ]]; then cleaned_text=$(clean_text "$selected_detail") + + # Wenn cleaned_text ein otpauth:// URL ist, versuche TOTP Code zu generieren + totp_code=$(totp_from_otpauth "$cleaned_text") + if [[ $? -eq 0 && -n "$totp_code" ]]; then + cleaned_text="$totp_code" + echo "TOTP-Code generiert: $cleaned_text" + fi + copy_to_clipboard "$cleaned_text" echo "In Zwischenablage kopiert: ${cleaned_text:0:20}..." diff --git a/executable_install-fedora.sh b/executable_install-fedora.sh index 0ec05e1..1c0a824 100644 --- a/executable_install-fedora.sh +++ b/executable_install-fedora.sh @@ -27,7 +27,7 @@ sudo dnf update sudo dnf install -y \ fzf zsh-autosuggestions zsh-syntax-highlighting \ rg htop ncdu pwgen pass-otp gopass gopass-jsonapi \ - tmux-powerline lolcat socat + tmux-powerline lolcat socat oathtool ## GUI & Desktop sudo dnf install -y \