Skip to content

Instantly share code, notes, and snippets.

@itkq
Created June 29, 2017 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itkq/c1c4da4b5f5458b444f51fda581c96e2 to your computer and use it in GitHub Desktop.
Save itkq/c1c4da4b5f5458b444f51fda581c96e2 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
LIST_PATH=$HOME/.mfalist.encrypted
KEY_PATH=$HOME/.ssh/id_rsa
case $(uname) in
"Darwin") copy_cmd='pbdopy' ;;
"Linux" ) copy_cmd='xsel -bi' ;;
esac
openssl smime -decrypt -in $LIST_PATH -inkey $KEY_PATH -binary -inform PEM \
| peco | awk '{print $3}' | xargs oathtool --totp -b \
| $copy_cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment