Adds authentication as anyrun
This commit is contained in:
parent
fec7b2ca1e
commit
3761169203
6 changed files with 34 additions and 3 deletions
24
.config/scripts/anyrun/Auth.sh
Executable file
24
.config/scripts/anyrun/Auth.sh
Executable 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'"
|
||||
Loading…
Add table
Add a link
Reference in a new issue