diff --git a/common/bin/pass-migrate-to-pass-otp b/common/bin/pass-migrate-to-pass-otp new file mode 100755 index 0000000..a6979aa --- /dev/null +++ b/common/bin/pass-migrate-to-pass-otp @@ -0,0 +1,6 @@ +#!/usr/bin/env fish + +set entry $argv[1] +set otp_secret (pass $entry | awk -F': ' '/^otp/{gsub(/\s/,"",$2);print $2}') +set otp_uri "otpauth://totp/totp-secret?secret=$otp_secret&issuer=$entry" +echo $otp_uri | pass otp append $entry diff --git a/common/bin/pass-otp b/common/bin/pass-otp index 023a8d3..f5e81af 100755 --- a/common/bin/pass-otp +++ b/common/bin/pass-otp @@ -1,12 +1,6 @@ #!/usr/bin/env bash -# TODO: check for pass - -key="$1"; shift -args=("$@") - -otp="$(set -e; pass "$key" 2>/dev/null | grep -Pi '^otp' | cut -d ':' -f 2 | sed 's/ //g')" -otp_status="$?" -[[ $otp_status != 0 ]] && { echo "pass command failed with exit code $otp_status"; exit 1; } -[[ -z $otp ]] && { echo "No OTP secret found for pass entry '$key'"; exit 2; } -simple-otp "$otp" +echo 'This script is deprecated. Install and use the pass-otp extension. + yay -S pass-otp + pass otp $args' +exit 1