FiloSottile/passage

Unecessary prompt for password

Myridium opened this issue · 2 comments

When editing a password, passage prompts for the password once to decrypt the file. But then it asks again when saving the file. It should not need to prompt the second time.

$ passage edit tmp
Enter passphrase for identity file "/home/username/.passage/identities":
Enter passphrase for identity file "/home/username/.passage/identities":
Password unchanged.

The problem is that the existing file is decrypted (again) to check whether it has changed.

local action="Add"
if [[ -f $passfile ]]; then
$AGE -d -o "$tmp_file" -i "$IDENTITIES_FILE" "$passfile" || exit 1
action="Edit"
fi
${EDITOR:-vi} "$tmp_file"
[[ -f $tmp_file ]] || die "New password not saved."
$AGE -d -o - -i "$IDENTITIES_FILE" "$passfile" 2>/dev/null | diff - "$tmp_file" &>/dev/null && die "Password unchanged."

This is an intentional design choice of password-store, presumably to catch conflicts that happen during editing, which I don't think I am going to deviate from in passage.