Created
June 29, 2017 03:08
-
-
Save itkq/c1c4da4b5f5458b444f51fda581c96e2 to your computer and use it in GitHub Desktop.
This file contains 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 | |
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