passage icon indicating copy to clipboard operation
passage copied to clipboard

Add reencrypt command based on reencrypt_path()

Open maertsen opened this issue 1 year ago • 1 comments

hi Filippo,

I ran into #13 and did the simplest possible thing: expose reencrypt_path(). Perhaps this is some use to you or others. I rarely ever write bash scripts, so even though this is merely a few lightly adapted existing lines of code from pass init, I would encourage careful review.

#13 mentioned having to repeatedly enter a PIN; I believe that behaviour has since been resolved, because I did not come across it in testing. I still have to repeatedly touch to decrypt in accordance with my touch policy of always, but I actually prefer that.

Commit message:

passage reencrypt let's you reencrypt .age files to add recipients. Although the same mechanism will also remove access, this is ineffective when used in combination with git, because the one can just retrieve the previous version from history.

This functionality corresponds to the second use of pass init. Given that the first (init) functionality is not implemented and internally this command is not much more than direct access to the reencrypt_path() function, reencrypt seemed to be a more suitable name.

The current implementation does not figure out the change in recipients (if any) and therefore has a rather generic "Reencrypted $path" git commit message.

maertsen avatar Aug 14 '23 12:08 maertsen

Thanks for this patch! I tried it and it worked as desired.

blaggacao avatar Sep 28 '23 12:09 blaggacao