obsidian-encrypt icon indicating copy to clipboard operation
obsidian-encrypt copied to clipboard

Re-encrypt notes automatically

Open DJN0 opened this issue 2 years ago • 4 comments

Would it be possible to re-encrypt a decrypted note automatically with the original password after a certain amount of time and/or on exit? I've found it a hassle to view and edit encrypted notes on a frequent basis, because I need to re-enter the original password twice every time I'm done working on an encrypted note (and it has to be twice so that I don't lose a note off of one mistyped password).

DJN0 avatar Dec 15 '21 23:12 DJN0

Hi @DJN0,

It may be possible to do something like that, but not cleanly with the current architecture of this plugin.

I may look into creating a new plugin for this workflow, I can see how it would be more convenient.

Alternatively, encrypting your whole vault with something like https://github.com/cryptomator/cryptomator may be a more reliable option.

meld-cp avatar Dec 16 '21 08:12 meld-cp

+1 on this. Promt for password on open, auto encrypt on close.

Might be tricky AF since how would it handle 'force quit' or obsidian crashing?

mardoqueo avatar Jan 14 '22 14:01 mardoqueo

+1 for this.

I wonder if Obsidian API actually allows the plugin to see any note. If it does, it seems just adding a thread with a timer to encrypt the note back would solve it. However, handling crashes, force quits, and kill -9 is indeed super tricky without any demon running on the host system...

Another though: maybe we could achieve the same result by a standalone, 3rd party app, that could decrypt an .md file, and auto encrypt it after some time, leaving Obsidian just as a viewer? However, this would require the app to be mobile-friendly to be able to encrypt/decrypt the notes on the phones...

Toucani avatar Jul 09 '22 12:07 Toucani

However, handling crashes, force quits, and kill -9 is indeed super tricky without any demon running on the host system...

Little food for thought that has not been mulled over too much so far: The crude solution to this is, when encrypting, to :

  1. Write an unencrypted copy besides the current note,
  2. Encrypt original version
  3. Ensure encryption is successful, checking if submitted password correctly decrypts
  4. if yes: delete backup
  5. if no: restore from backup

Of course you run into issues where you loose the security if the backup is synced to elsewhere before being deleted. I am not sure if that is possible to be prevented. It would be possible for normal sync by designating a folder into which you'd put the backup, and then set that folder up to not be synced. As for Github-sync/3rd-party syncing? No clue. Probably doable, but not natively supportable by the plugin itself probably ¯\(ツ)

I guess you could also just hold the copy in a variable while performing the encryption, and then just restore from that - which should resolve the issue above.

Gewerd-Strauss avatar Jul 25 '22 19:07 Gewerd-Strauss

Please check version v2.0.0 and see how you get on with the new standalone encrypted note setup.

meld-cp avatar Nov 07 '22 08:11 meld-cp

It's amazing!!!! Thanks!

mardoqueo avatar Nov 07 '22 11:11 mardoqueo

Please check version v2.0.0 and see how you get on with the new standalone encrypted note setup.

OK honeymoon's over. Can we have Markdown inside encrypted note? 🙏🙏🙏 pretty pretty pretty please?

mardoqueo avatar Nov 07 '22 13:11 mardoqueo