clortho

Key/value store for shell use where both key and value are obfuscated
git clone git://git.defalsify.org/clortho.git
Log | Files | Refs | LICENSE

commit b87d6ceee6ebc1f5327def27d7e7d35f6b248a7d
parent 409ed88fd61964d95b2efa12a2d1ab0347058362
Author: lash <dev@holbrook.no>
Date:   Wed, 12 Jan 2022 13:45:16 +0000

Add password file input, no spam on decrypt fail

Diffstat:
Mclortho.sh | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/clortho.sh b/clortho.sh @@ -24,8 +24,14 @@ data_dir=$(realpath $data_dir) mkdir -vp $data_dir set +e +passphrase=$CLORTHO_PASSPHRASE + +if [ -z "$passphrase" ]; then + if [ -f ~/.clortho ]; then + read passphrase < ~/.clortho + fi +fi -passphrase=${CLORTHO_PASSPHRASE:-$PASSPHRASE} if [ -z "$passphrase" ]; then stty -echo echo -n "passphrase: " @@ -60,7 +66,10 @@ do_set_ccrypt() { do_get_ccrypt() { hash_key - vp=$(ccrypt -E CLORTHO_PASSPHRASE -c $data_dir/$kc) + vp=$(ccrypt -E CLORTHO_PASSPHRASE -c $data_dir/$kc 2> /dev/null) + if [ "$?" -gt "0" ]; then + exit 1; + fi echo $vp } set -a