24 lines
647 B
Bash
Executable file
24 lines
647 B
Bash
Executable file
#!/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'"
|