Switch to using internal functions fron pass instead of using pass directly

This commit is contained in:
Peter Cai 2022-10-10 15:06:37 -04:00
parent 780e62a713
commit 9ae5562869
1 changed files with 8 additions and 8 deletions

View File

@ -36,11 +36,11 @@ gocrypt_init() {
gocrypt_die "gocrypt plugin already initialized for your password store"
fi
pass generate "$gocrypt_passwd_file" 32
cmd_generate "$gocrypt_passwd_file" 32
# Initialize gocryptfs
mkdir "$gocrypt_dir"
gocryptfs -passfile /dev/stdin -init "$gocrypt_dir" <<< "$(pass show "$gocrypt_passwd_file")"
gocryptfs -passfile /dev/stdin -init "$gocrypt_dir" <<< "$(cmd_show "$gocrypt_passwd_file")"
# Mount the gocryptfs subdirectory and initialze what is inside of it
gocrypt_open
@ -53,16 +53,16 @@ gocrypt_init() {
echo "# Gocrypt" >> .gitignore
echo "gocrypt" >> .gitignore
pass git add .gitignore
pass git add "$gocrypt_dir"
pass git commit -m "Initialized encrypted storage for gocrypt plugin"
cmd_git add .gitignore
cmd_git add "$gocrypt_dir"
cmd_git commit -m "Initialized encrypted storage for gocrypt plugin"
}
gocrypt_open() {
gocrypt_close_check
mkdir -p "$gocrypt_dec_dir"
gocryptfs -passfile /dev/stdin "$gocrypt_dir" "$gocrypt_dec_dir" <<< "$(pass show "$gocrypt_passwd_file")"
gocryptfs -passfile /dev/stdin "$gocrypt_dir" "$gocrypt_dec_dir" <<< "$(cmd_show "$gocrypt_passwd_file")"
}
gocrypt_close() {
@ -75,8 +75,8 @@ gocrypt_delegate() {
# Delegate command to another `pass` instance that manages what is inside of the mountpoint
PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" pass "$@"
# Commit if there has been changes due to this operation
pass git add "$gocrypt_dir"
pass git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
cmd_git add "$gocrypt_dir"
cmd_git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
}
gocrypt_crypt() {