Created
December 27, 2019 16:08
-
-
Save timmc/8e059a499dc1d7cc6c4b0dc5402a8fb1 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 | |
# Generates a TOTP code and copies it to the clipboard. | |
# Accepts path to a GPG-encrypted TOTP secret key file. | |
# Usage: $0 <encrypted-secrets-file> | |
# | |
# Encrypt a secret like this: xsel -bo | gpg2 --encrypt --recipient 0x32D0F478 > ~/.2fa/aws.gpg | |
set -eu -o pipefail | |
secretsFile="$1" | |
oathtool -b --totp -- "$(gpg2 --decrypt --quiet < "$secretsFile")" | xsel -bi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment