use only ~/.ssh/id_rsa and ~/.ssh/id_ed25519 for decryption

fixes #5
This commit is contained in:
Ryan Mulligan 2020-12-18 19:23:47 -08:00
parent 8af97149b2
commit be7bad2c12

View file

@ -105,10 +105,12 @@ function edit {
if [ -f "$FILE" ] if [ -f "$FILE" ]
then then
DECRYPT=("''${DEFAULT_DECRYPT[@]}") DECRYPT=("''${DEFAULT_DECRYPT[@]}")
while IFS= read -r key if [ -f "$HOME/.ssh/id_rsa" ]; then
do DECRYPT+=(--identity "$HOME/.ssh/id_rsa")
DECRYPT+=(--identity "$key") fi
done <<<"$((find ~/.ssh -maxdepth 1 -type f -not -name "*pub" -not -name "config" -not -name "authorized_keys" -not -name "known_hosts") || exit 1)" if [ -f "$HOME/.ssh/id_ed25519" ]; then
DECRYPT+=(--identity "$HOME/.ssh/id_ed25519")
fi
DECRYPT+=(-o "$CLEARTEXT_FILE" "$FILE") DECRYPT+=(-o "$CLEARTEXT_FILE" "$FILE")
${ageBin} "''${DECRYPT[@]}" || exit 1 ${ageBin} "''${DECRYPT[@]}" || exit 1
cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before" cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before"