Switch to using internal functions fron pass instead of using pass directly
This commit is contained in:
parent
780e62a713
commit
9ae5562869
16
gocrypt.bash
16
gocrypt.bash
|
@ -36,11 +36,11 @@ gocrypt_init() {
|
||||||
gocrypt_die "gocrypt plugin already initialized for your password store"
|
gocrypt_die "gocrypt plugin already initialized for your password store"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pass generate "$gocrypt_passwd_file" 32
|
cmd_generate "$gocrypt_passwd_file" 32
|
||||||
|
|
||||||
# Initialize gocryptfs
|
# Initialize gocryptfs
|
||||||
mkdir "$gocrypt_dir"
|
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
|
# Mount the gocryptfs subdirectory and initialze what is inside of it
|
||||||
gocrypt_open
|
gocrypt_open
|
||||||
|
@ -53,16 +53,16 @@ gocrypt_init() {
|
||||||
echo "# Gocrypt" >> .gitignore
|
echo "# Gocrypt" >> .gitignore
|
||||||
echo "gocrypt" >> .gitignore
|
echo "gocrypt" >> .gitignore
|
||||||
|
|
||||||
pass git add .gitignore
|
cmd_git add .gitignore
|
||||||
pass git add "$gocrypt_dir"
|
cmd_git add "$gocrypt_dir"
|
||||||
pass git commit -m "Initialized encrypted storage for gocrypt plugin"
|
cmd_git commit -m "Initialized encrypted storage for gocrypt plugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
gocrypt_open() {
|
gocrypt_open() {
|
||||||
gocrypt_close_check
|
gocrypt_close_check
|
||||||
mkdir -p "$gocrypt_dec_dir"
|
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() {
|
gocrypt_close() {
|
||||||
|
@ -75,8 +75,8 @@ gocrypt_delegate() {
|
||||||
# Delegate command to another `pass` instance that manages what is inside of the mountpoint
|
# Delegate command to another `pass` instance that manages what is inside of the mountpoint
|
||||||
PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" pass "$@"
|
PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" pass "$@"
|
||||||
# Commit if there has been changes due to this operation
|
# Commit if there has been changes due to this operation
|
||||||
pass git add "$gocrypt_dir"
|
cmd_git add "$gocrypt_dir"
|
||||||
pass git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
|
cmd_git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
|
||||||
}
|
}
|
||||||
|
|
||||||
gocrypt_crypt() {
|
gocrypt_crypt() {
|
||||||
|
|
Loading…
Reference in a new issue