kanru / logseq-encrypt-ui

Utility to encrypt/decrypt Logseq graphs
Apache License 2.0
76 stars 2 forks source link

Decrypt individual files? #3

Closed FortmaticGithub closed 2 years ago

FortmaticGithub commented 2 years ago

Sometimes logseq doesn't detect / show all the files i made on my last session and i usually fix it by decrypting and encrypting again but when i did it this time it did not solve the problem i've also done the manual re index and refresh but nothing seems to work

so i was hoping there was some way to just manually decrypt the individual files that are still left encrypted i know they exist cause the .md files are right there in the logseq folder they just never show up in the application

https://github.com/kanru/logseq-encrypt-ui/blob/main/src/worker.rs i saw that there's a decrypt_single_file function but I have 0 experience with Rust so idk how to manage this

for the function i need a path and backup, i assume these are both just path strings. identity is the encryption password parsed in a certain way i assume?

Was hoping you could help me or at least point me in the right direction with this.

But anyway thanks for reading

FortmaticGithub commented 2 years ago

https://github.com/spieglt/winage

found some GUI tool for encrypting /decrypting age files but can't seem to get it to work with these md.bak files i renamed them to .age and then i can use the tool with it but only with the identity decrypt and idk how to get the decryption identity I only know the password i used for encryption, are these files not encrypted with age passphrase but instead with the identity option?

if so how to get from the encryption password to the identity if that's even possible now

kanru commented 2 years ago

@FortmaticGithub the files are encrypted with an encryption identity. The key itself is encrypted with the password and saved in the logseq/metadata.edn file, under the :db/encrypted-secret key.

There's two way to get your encryption identity.

  1. Manually decode the key in the metadata file using any age tool.
  2. In Logseq, open the "All Graphs" page. Click the 🔐 emoji next your encrypted graph. It will reveal the encryption private key that you can use to decode all other files with any age tool.

The second option is recommended. Hope that helps 😄

FortmaticGithub commented 2 years ago

Oh man you saved me Was scared that I didn't have the metadata file they were encrypted with anymore but thankfully there were a bunch of backups of em in the logseq/bak folder

Many thanks 😭