Created
December 5, 2021 20:43
-
-
Save natikgadzhi/4082dfc9b2abf331c5c0d85761594853 to your computer and use it in GitHub Desktop.
Raycast Yubico OTP script command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Required parameters: | |
# @raycast.schemaVersion 1 | |
# @raycast.title yubico-oath | |
# @raycast.mode compact | |
# Optional parameters: | |
# @raycast.icon 🔑 | |
# @raycast.argument1 { "type": "text", "placeholder": "Account name" } | |
# Documentation: | |
# @raycast.description Grab a OATH code from Yubikey | |
# @raycast.author Nate Gadzhi | |
# @raycast.authorURL https://github.com/nategadzhi | |
if [! command -v ykman &>/dev/null ]; then | |
echo "Yubico OTP needs ykman to be installed. Pip install ykman." | |
exit 1 | |
fi | |
YUBICO_OATH_CODE=`ykman oath accounts code $1 | grep -oE '([0-9]{6})$' |tr -d \\n` | |
echo $YUBICO_OATH_CODE |pbcopy | |
echo "Your OATH code for $1 is $YUBICO_OATH_CODE (copied to clipboard)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment