aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Baier <jan.baier@amagical.net>2020-06-28 00:12:36 +0200
committerTad Fisher <129148+tadfisher@users.noreply.github.com>2020-09-12 13:02:49 -0700
commit0aadd4c82cf190ae8ac9c08e7eb142716ed33a85 (patch)
tree5abf0a712fa7d3d036851e657a14ef2727f6dd3f
parent24330b81d6d1a4d87708692f0ee9906d3297012e (diff)
downloadpass-otp-0aadd4c82cf190ae8ac9c08e7eb142716ed33a85.tar.gz
pass-otp-0aadd4c82cf190ae8ac9c08e7eb142716ed33a85.zip
Add support for using Pass::OTP
Pass::OTP is alternative implementation of One-time passwords with more features, namely it can support parsing otpauth:// links and custom character classes. This can close #97
-rw-r--r--README.md2
-rwxr-xr-xotp.bash6
2 files changed, 6 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2d28491..7027b42 100644
--- a/README.md
+++ b/README.md
@@ -195,7 +195,7 @@ URL=https://git.malte-kiefer.de/crux-ports/plain
## Requirements
- `pass` 1.7.0 or later for extension support
-- `oathtool` for generating 2FA codes
+- `oathtool` or `Pass::OTP` for generating 2FA codes
- `qrencode` for generating QR code images
### Build requirements
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"
;;
*)