elasticdog / transcrypt

transparently encrypt files within a git repository
MIT License
1.43k stars 102 forks source link

Consider making functions for get_password() and set_password() #141

Closed ljm42 closed 2 years ago

ljm42 commented 2 years ago

I would like to move the transcrypt password out of the git config file and come up with some other method of storing it.

I'm wondering if you'd be open to creating functions for get_password() and set_password(), something like this:

get_password() {
  local password=$(git config --get --local transcrypt.password)
  echo "$password"
}

set_password() {
  local password=$1
  git config transcrypt.password "$password"
}

the code would call those like this:

  current_password=$(get_password)
  set_password "$password"

Then in my implementation I would just have to modify those functions and not all the places that get/set the password. Would you be open to that?

Oh, with these names the current get_password() would have to be renamed, maybe get_password_from_user() ?

jmurty commented 2 years ago

Solved with new load_password() and save_password() functions merged from #142, thanks for the improvement!