kasi

POSIX shell password manager that is cryptography program-agnostic
Log | Files | Refs | README | LICENSE

commit fd8b9b1cd22c2828f9da5443b35582d384a65d01
parent 44278549ad2cb0c39cfec0f8316555d1e1fe3927
Author: Shokara <shokara@snopyta.org>
Date:   Sat, 12 Jun 2021 12:52:40 -0400

fix edit command and encrypt the file

File wasn't encrypted before and was stored in plaintext under a
gpg extension

Diffstat:
Mangou | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/angou b/angou @@ -10,6 +10,9 @@ ANGOU_LIST=${ANGOU_LIST:-"tree"} mkdir -p "$ANGOU_DIR" cd "$ANGOU_DIR" || exit +[ ! -f ".gpg-id" ] && echo "please put your gpg key id into \$ANGOU_DIR/.gpg-id" +GPG_ID="$(cat .gpg-id)" + # decrypt and print a password from ANGOU_DIR or print the directory structure view() { if [ -f "${1%%.gpg}" ]; then @@ -36,12 +39,15 @@ edit() { tmpfile="$(mktemp)" # edit a copy of a password if it already exists - [ -f "${1%%.gpg}".gpg ] && cp "$1" "$tmpfile" + [ -f "${1%%.gpg}".gpg ] && gpg -qd "${1%%.gpg}".gpg > "$tmpfile" "${VISUAL:-${EDITOR:-ed}}" "$tmpfile" mkdir -p "$(dirname "$1")" - mv "$tmpfile" "${1%%.gpg}".gpg + gpg -er "$GPG_ID" "$tmpfile" + + rm "$tmpfile" + mv "$tmpfile.gpg" "${1%%.gpg}".gpg } # print usage