From c63739cb192c9d013841eaaffcff735eda530b4c Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 17 Sep 2020 09:45:58 -0500 Subject: [PATCH] Add otp helpers --- bin/pass-otp | 9 +++++++++ bin/simple-otp | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100755 bin/pass-otp create mode 100755 bin/simple-otp diff --git a/bin/pass-otp b/bin/pass-otp new file mode 100755 index 0000000..2e01286 --- /dev/null +++ b/bin/pass-otp @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# TODO: check for pass + +key="$1"; shift +args=("$@") + +otp="$(pass "$key" | grep -Pi '^otp.*: ?.*$' | cut -d ':' -f 2 | sed 's/ //g')" +simple-otp "$otp" diff --git a/bin/simple-otp b/bin/simple-otp new file mode 100755 index 0000000..889fdc4 --- /dev/null +++ b/bin/simple-otp @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# TODO: check for oathtool + +key="$1"; shift +args=("$@") + +oathtool --totp=sha1 -b "$key" "${args[@]}"