aboutsummaryrefslogtreecommitdiff
path: root/otp.bash
diff options
context:
space:
mode:
Diffstat (limited to 'otp.bash')
-rwxr-xr-xotp.bash6
1 files changed, 5 insertions, 1 deletions
diff --git a/otp.bash b/otp.bash
index 5539a5b..c56f502 100755
--- a/otp.bash
+++ b/otp.bash
@@ -16,8 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# []
-VERSION="1.1.1"
+VERSION="1.1.2"
OATH=$(which oathtool)
+OTPTOOL=$(which otptool)
## source: https://gist.github.com/cdown/1163649
urlencode() {
@@ -335,6 +336,7 @@ cmd_otp_code() {
contents=$($GPG -d "${GPG_OPTS[@]}" "$passfile")
while read -r -a line; do
if [[ "$line" == otpauth://* ]]; then
+ local uri="$line"
otp_parse_uri "$line"
break
fi
@@ -348,6 +350,7 @@ cmd_otp_code() {
[[ -n "$otp_period" ]] && cmd+=" --time-step-size=$otp_period"s
[[ -n "$otp_digits" ]] && cmd+=" --digits=$otp_digits"
cmd+=" $otp_secret"
+ [[ -n "$OTPTOOL" ]] && cmd="$OTPTOOL $uri"
;;
hotp)
@@ -355,6 +358,7 @@ cmd_otp_code() {
cmd="$OATH -b --hotp --counter=$counter"
[[ -n "$otp_digits" ]] && cmd+=" --digits=$otp_digits"
cmd+=" $otp_secret"
+ [[ -n "$OTPTOOL" ]] && cmd="$OTPTOOL $uri"
;;
*)