mirror of https://github.com/ericonr/get-otp.git
Simplify error checking in get-otp.
Using an authenticated encryption scheme means we can check if we had the proper password and not print anything to standard out, instead of having jq verify if its input is valid JSON.
This commit is contained in:
parent
0f1ccd703c
commit
4fe7044f17
10
get-otp.in
10
get-otp.in
|
@ -1,14 +1,12 @@
|
|||
#!/bin/sh
|
||||
file="${OTP_ACCOUNTS:-$HOME/.local/share/otp_accounts}"
|
||||
json="$(@PREFIX@/libexec/cbc-file unlock "$file")"
|
||||
[ -z "$json" ] && exit 1
|
||||
|
||||
pre_label="$(printf %s "$json" |
|
||||
jq '.[].label' 2>/dev/null)"
|
||||
[ -z "$pre_label" ] && exit 1
|
||||
|
||||
label="$(printf %s "$pre_label" |
|
||||
label="$(printf %s "$json" |
|
||||
jq '.[].label' 2>/dev/null |
|
||||
fzf --cycle -1 ${1:+--query "$1"}
|
||||
)"
|
||||
)"
|
||||
[ -z "$label" ] && exit 1
|
||||
|
||||
secret="$(printf %s "$json" |
|
||||
|
|
Loading…
Reference in New Issue