Migrate to pass's otp extension
This commit is contained in:
parent
e0bcf03ce4
commit
e4809c0baf
2 changed files with 10 additions and 10 deletions
6
common/bin/pass-migrate-to-pass-otp
Executable file
6
common/bin/pass-migrate-to-pass-otp
Executable file
|
@ -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
|
|
@ -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
|
||||
|
|
Reference in a new issue