diff --git a/bash/sources/16_keystore b/bash/sources/16_keystore index f8bb249..3d3c223 100644 --- a/bash/sources/16_keystore +++ b/bash/sources/16_keystore @@ -15,11 +15,13 @@ fi _AUTH_DB=$RBASH_HOME/keystore.db _AUTH_SECRET= _KSTORE_DEF_PROP=${_KSTORE_DEF_PROP:-val} +_KSTORE_DEC_FAILED="$RBASH_HOME/.decypt-failed" if [ -f "$RBASH_HOME/keystore.secret" ]; then _AUTH_SECRET=$( cat "$RBASH_HOME/keystore.secret" ) fi + function kstore { case $1 in add) shift; _kstoreadd "$@" ;; @@ -130,7 +132,7 @@ function _kstoredec { openssl enc -d -aes-256-cbc -pbkdf2 -k "$_AUTH_SECRET" -a -A _code=$? if [ $_code -ne 0 ]; then - _AUTH_SECRET= + touch $_KSTORE_DEC_FAILED return $_code fi } @@ -199,6 +201,10 @@ function _kstoresecret-macos { function _kstoresecret-config { local _CONFIRM + if [ -f "$_KSTORE_DEC_FAILED" ]; then + rm $_KSTORE_DEC_FAILED + _AUTH_SECRET= + fi if [ -z "$_AUTH_SECRET" ]; then _kstoresecret-auto get