Skip to content

Instantly share code, notes, and snippets.

@natikgadzhi
Created December 5, 2021 20:43
Show Gist options
  • Save natikgadzhi/4082dfc9b2abf331c5c0d85761594853 to your computer and use it in GitHub Desktop.
Save natikgadzhi/4082dfc9b2abf331c5c0d85761594853 to your computer and use it in GitHub Desktop.
Raycast Yubico OTP script command
#!/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