meld-cp / obsidian-encrypt

Hide secrets in your Obsidian.md vault
MIT License
607 stars 36 forks source link

Encrypt all contents of a folder #52

Closed lfcstreet closed 1 year ago

lfcstreet commented 1 year ago

Hi Thank you for this great plugin. Feature request - is it possible to add a "encrypt/decrypt this folder" feature - i.e. it will encrypt/decrypt all files inside it with the same password.

Thank you!

meld-cp commented 1 year ago

V2.0.3 tries to remember the last used password for the file it was used in (including it's parent folder). It's not quite what you wanted but it may help. Could you give it a try?

The problem I have with your suggestion is that it would mean decrypting the files to disk, which I'm trying to avoid so that syncing and backup software don't copy the decrypted text to external systems.

lfcstreet commented 1 year ago

Thanks for your reply. The other option is:

  1. The user unlocks the folder - but in reality the files are not all decrypted.
  2. The user opens a file in the folder - decryption happens only then.
  3. The user moves to another file, decryption happens on that file, the first one still is in memory and not written to disk
  4. All open files are encrypted and written to disk when (1) the user closes the app, or "locks" the folder OR (2) a "no. of open files in allowed in memory" limit (say 200 files) is reached - the oldest open file is encrypted and written to disk. When the user clicks on it again, it will again be read from disk and decrypted .
meld-cp commented 1 year ago

Yeah, I think #63 will help out for your use case here.

My idea was that, on first use, the password will be remembered for the session on the file and it's parent folder.

When a file is opened the best guess password is tried automatically, if that worked the file is shown (ready for editing), else the password prompt is shown as normal.

This way once the password is used for one of the files in a folder it's sibling files can also be decrypted straight away (providing they also used the same password that is)

lfcstreet commented 1 year ago

Agreed. But then again, for it to be a folder level encryption, the same thing is needed for encryption - it should be possible to encrypt all the files in a folder with the same password at one go.

And when new files are added, ideally it should auto encrypt it using that same password - but I guess that's asking for much because then you are forced to store that common password somewhere, maybe in some encrypted form.!