zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
26.72k stars 1.86k forks source link

(Feature request) Encrypted / Protected attributes #4305

Open justyns opened 11 months ago

justyns commented 11 months ago

Describe feature

Similar to how some notes can be selectively protected, it would be great if certain attributes could also be protected.

I'd expect it to work by doing something like adding a checkbox when creating a label definition so that the definition becomes:

#label:myLabel(inheritable)=promoted,protected,single,text 

When Trilium protects or unprotects a note, it would also need to look at the attributes and encrypt/decrypt those as needed.

Additional Information

I'm assuming having both encrypted and unencrypted attributes would make the most sense right now, but please correct me if I'm wrong.

My though process on encrypted attributes would be for storing sensitive information like gps/location metadata, certain urls, etc. But I'd also still want to be able to search unencrypted attributes (on a protected note) like the #dateNote label in the demo.

zadam commented 11 months ago

Yeah, this feature would make sense, but wasn't done for the sake of simplicity, and I'm kinda skeptical whether the cost justifies the limited use cases.

One way to store private note metadata will be in attachments (currently in 0.61 beta), since these are encrypted together with the note, but they don't provide easy searchability like labels.

justyns commented 11 months ago

One way to store private note metadata will be in attachments (currently in 0.61 beta), since these are encrypted together with the note,

I should probably try the 0.61 beta. If I understand correctly, are you thinking the attachment would basically just be a json blob with the metadata in it? I could see that working for what I wanted to use it for.

but they don't provide easy searchability like labels.

Would you still be able to search through attachments, just not specific key/values (assuming attachment is json)? I think that'd be a fair trade off. It'd be nice if sqlite offered something like postgres's json/jsonb fields apparently sqlite does have some support for json, maybe that could help in the future to make json attachments searchable?

zadam commented 11 months ago

If I understand correctly, are you thinking the attachment would basically just be a json blob with the metadata in it?

Could be. Attachments can be any data, but one disadvantage is that there's no editing UI  (apart from uploading/renaming etc.). This could be usable when you e.g. have a script which just needs to store these GPS metadata somewhere encrypted.

Would you still be able to search through attachments, just not specific key/values (assuming attachment is json)?

Currently, no. But attachments concept is quite young and "searchable attachments" might come.