commit bb46db8a9144e6e2231fc122476139c0640f486a
parent b52b7a7066e91abfca92908a8aa5c4737f94ad4a
Author: St John Karp <contact@stjo.hn>
Date: Mon, 30 May 2022 10:22:03 -0400
Revert "Store the TOTP secret in a variable"
This reverts commit 94779299f4686f0a2df79322da69a10f77f74419.
Versions of oathtool that take input from stdin seem to be sufficiently
common now to remove this.
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/balrog b/balrog
@@ -111,12 +111,10 @@ while [ -n "$ACTION" ] ; do
show)
# Decrypt, extract the secret from the otpauth line, and pass it to oathtool.
if [ "$OTP" -eq 1 ] ; then
- # Store the TOTP secret in a variable.
- # Not all oathtool versions take input from stdin.
- secret="$(gpg2 --decrypt --quiet "$KEY_FILE" |
+ gpg2 --decrypt --quiet "$KEY_FILE" |
grep 'otpauth' |
- sed 's/.*secret=\([a-zA-Z0-9]*\).*/\1/')"
- oathtool --base32 --totp "$secret" |
+ sed 's/.*secret=\([a-zA-Z0-9]*\).*/\1/' |
+ oathtool --base32 --totp - |
([ "$COPY" -eq 1 ] && xclip -selection clipboard || cat)
# Decrypt and get the first line.
else