balrog

A partial drop-in replacement for pass and pass-otp written in POSIX shell.
git clone https://git.stjo.hn/balrog
Log | Files | Refs | README | LICENSE

commit 94779299f4686f0a2df79322da69a10f77f74419
parent ae49ca64df0243ccf9bc826035f79533939d92c6
Author: St John Karp <contact@stjo.hn>
Date:   Sat,  9 Oct 2021 09:46:31 -0400

Store the TOTP secret in a variable

Not all oathtool versions take input from stdin, so this is necessary
for the time being. This commit can be reverted once appropriate
versions of oathtool are available across the board.

Diffstat:
Mbalrog | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/balrog b/balrog @@ -111,10 +111,12 @@ while [ -n "$ACTION" ] ; do show) # Decrypt, extract the secret from the otpauth line, and pass it to oathtool. if [ "$OTP" -eq 1 ] ; then - gpg2 --decrypt --quiet "$KEY_FILE" | + # Store the TOTP secret in a variable. + # Not all oathtool versions take input from stdin. + secret="$(gpg2 --decrypt --quiet "$KEY_FILE" | grep 'otpauth' | - sed 's/.*secret=\([a-zA-Z0-9]*\).*/\1/' | - oathtool --base32 --totp - | + sed 's/.*secret=\([a-zA-Z0-9]*\).*/\1/')" + oathtool --base32 --totp "$secret" | ([ "$COPY" -eq 1 ] && xclip -selection clipboard || cat) # Decrypt and get the first line. else