···5252pw_edit() {
5353 name=$1
54545555+ if [ ! -f "$name.age" ]; then
5656+ die "Failed to access $name"
5757+ fi
5858+5559 # we use /dev/shm because it's an in-memory
5660 # space that we can use to store private data,
5761 # and securely wipe it without worrying about
···6468 trap 'rm -rf /dev/shm/pa' EXIT
6569 tmpfile="/dev/shm/pa/$name.txt"
66707171+ age -i ~/.age/key.txt --decrypt "$1.age" > "$tmpfile"
6772 "${EDITOR:-vi}" "$tmpfile"
68736974 if [ ! -f $tmpfile ]; then
7075 die "New password not saved"
7176 fi
72777878+ rm "$name.age"
7379 age -r "$pubkey" -o "$name.age" "$tmpfile"
7480}
7581