Adds authentication as anyrun

This commit is contained in:
Michel Fedde 2025-09-13 00:56:43 +02:00
parent fec7b2ca1e
commit 3761169203
6 changed files with 34 additions and 3 deletions

View file

@ -108,7 +108,7 @@ bind = $mainMod Shift, Return, exec, hyprdrop ghostty --identifier term_hyprdrop
bind = $mainMod, Z, exec, $files bind = $mainMod, Z, exec, $files
bind = $mainMod, R, focusurgentorlast bind = $mainMod, R, focusurgentorlast
bind = $mainMod SHIFT, P, exec, $scriptsDir/anyrun/Bitwarden.sh bind = $mainMod SHIFT, P, exec, $scriptsDir/anyrun/Auth.sh
# Master Layout Keybinds # Master Layout Keybinds
bind = $mainMod, A, layoutmsg,swapwithmaster master bind = $mainMod, A, layoutmsg,swapwithmaster master

View file

@ -0,0 +1,4 @@
return {
"kaarmu/typst.vim",
ft = "typst",
}

24
.config/scripts/anyrun/Auth.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/env sh
SCRIPTPATH="$(
cd -- "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)"
TOKEN=$(cat "$SCRIPTPATH/.auth-token")
DOMAIN="https://auth.iedsoftworks.com"
list=$(curl --oauth2-bearer "$TOKEN" "$DOMAIN/api/v1/twofaccounts" | jq 'map({"\(.service) - \(.account)": .id}) | add' -r)
selection=$(echo "$list" | jq 'keys | map("\(.)\n") | add' -r | anyrun --plugins libstdin.so)
if [[ $selection == "" ]]; then
exit 0
fi
id=$(echo $list | jq ".[\"${selection}\"]")
curl --oauth2-bearer "$TOKEN" "$DOMAIN/api/v1/twofaccounts/$id/otp" |
jq ".password" -r |
wl-copy
notify-send -i "lock" "2FA Code copied" "Copied code for '$selection'"

View file

@ -1,3 +1,5 @@
.ssh/*.key .ssh/*.key
.local/share/kwalletd/* .local/share/kwalletd/*
.config/scripts/anyrun/.auth-token

1
.gitignore vendored
View file

@ -38,6 +38,7 @@
!/.config/xdg-desktop-portal/ !/.config/xdg-desktop-portal/
!/.config/xdg-desktop-portal-termfilechooser/ !/.config/xdg-desktop-portal-termfilechooser/
!/.config/scripts/ !/.config/scripts/
/.config/scripts/anyrun/.auth-token
!/.config/systemd/ !/.config/systemd/
/.config/systemd/* /.config/systemd/*
!/.config/systemd/user/ !/.config/systemd/user/

View file

@ -18,7 +18,7 @@ Host git.iedsoftworks.com
IdentityFile ~/.ssh/git.iedsoftworks.com.key IdentityFile ~/.ssh/git.iedsoftworks.com.key
Host home Host home
HostName home HostName home.server
User michel User michel
IdentityFile ~/.ssh/home.key IdentityFile ~/.ssh/home.key
@ -51,6 +51,6 @@ Host vagrant
IdentityFile ~/.ssh/vagrant IdentityFile ~/.ssh/vagrant
Host essential Host essential
HostName essential HostName essential.server
User michel User michel
IdentityFile ~/.ssh/essential_home.key IdentityFile ~/.ssh/essential_home.key