Closed codesoap closed 3 years ago
Thank you! I took a slightly different implementation strategy, but the examples and discussion was very useful. Let me know if the changes in #173 look good!
I really like the lazyOpener
. I had briefly thought about something like this, but didn't think it would be implementable with so little code. I'll definitely remember this for future projects.
age
creates empty output files, when something goes wrong. Examples:age -p -o data.age data
when I enter non matching passphrases.age -d -o data data.age
when I enter the wrong passphrase.age -d -i key -o data data.age
when I provided the wrong secret key.This pull requests ensures, that the output file is created as late as possible and thus avoids the creation of empty files for the given examples. Unfortunately this leads to some boilerplate, but I feel like it's not too bad.
One drawback is that the user is now informed later about already existing output files. Thus they may have already entered a password, only to be informed that the output file already exists and won't be overwritten. This could be prevented by checking if the file exists in advance. Let me know if you want this implemented.
This pull request should resolve #159 and to some extend #57.