Delete E2EE Master Keys

Sure...
I use Ubuntu (Linux) so my paths will be as such.
The database is located here: /home/user/.config/joplin-desktop
and it is named database.sqlite

I like to use a program called "DB Browser for SQLite". I caution you ... if you are not aware of how to do this already, you might want to not do this yourself ... or at least have a fresh backup in the case that you bugger it up.

The table is master_keys. Browse the data and delete the record that is the issue record. You can see the description in the source_application field. You delete the record by simply clicking the delete button, then clicking Write Changes to commit.

Hope that helps. It worked perfectly for me and takes only a minute.

1 Like

Wonderful. Thanks a lot!

1 Like

No problem. I hope it works for you. Many of the other solutions seemed quite involved and more complicated than the clicking of a few buttons. You can use any software that can work with SQLite databases, it is a simple action that any software should be able to handle with ease. Should you have difficulty, post and I can help, at least in accordance to how I fixed mine.

EDIT- To make sure this is clear, this assumes you have no files encrypted with this key. If you use this method, you will most likely lose ALL of those files. If your files are all unencrypted and you are receiving that weird error, this works perfectly. Be aware of the risk.

2 Likes

Thanks a lot. Appreciated. That is very kind of you!

It sounds like deleting the keys in the database is the cleanest solution. Good point of making sure the key is not in use. I'll export my notes before I do this, just in case.

1 Like

It is also worth noting that if you do not have the private key for said key, you should do your recovery now while you still can. I have not needed to look, so I cannot verify, but I believe you can check and verify this in the notes table, around the encryption_applied field.

1 Like

Unfortunately this is not true. Like other posters I have not "actively" created several keys. Now each of my instances / devices do use / share 3 keys, and unfortunately each one of them uses a different one as active key. I couldn't help this happening. Now it seems I am left with 2 options, I could ...

  • delete all keys but one active key (this is where you say "not needed / not possible", OR
  • switch to another active key (which is also not possible).
    The 3rd option, to sync everything decrypted, I do not consider a serious option.
    Thanks for thinking this through - carefully !

Is this really acceptable?

It's impossible to delete the yellow prompt, and I already have access to all my notes. It should be possible to simply reencrypt the notes, delete the old master keys and remove the yellow, very-annoying prompt, but instead I have to go and delete key files manually, export my notes, reimport my notes, and reencrypt, every time?

Additionally, I have just encrypted the files with a key that I copied and pasted, and even then, it's showing a red X as if it weren't right. This is a deal-breaker.

2 Likes

The inability to manage keys through Joplin has been extremely frustrating for me as well. I love the app and its functionality, but the difficulty setting up encrypted synchronization across two Linux boxes and an Android phone without creating extra keys and conflicts bothers me a lot.

It would help if I could at least choose which key is active, so that I can set it to be the same key for all devices.

The next improvement I'd like to see would be the ability to verify that an old key is not necessary and to delete it.

Thanks for all the hard work you put into this app, but please move a reliable process for this up your priority queue.

4 Likes

Hello, sorry but i get confused ;-;
You can break down the steps or make a tutorial or something for slow people like me ? ;-; pls?

Just piling on to state that I made the same mistake as others. I put Joplin on my new phone, and since it'd been a bit since I first installed the app on my old phone, and because the UI isn't clear about it, I thought I needed to config the encryption first. Now I have two keys, both with the same password, and only one of which is marked active.

Since I deleted the set of notes that comes with a new install, the newer, inactive key seems only to be in play on some background and/or history stuff. I know it "doesn't matter", but I want to get rid of this new key because it doesn't need to be there. I can see the key file itself as well as the eight items it's affecting via grep, but I'm too scared to delete them from Dropbox. Exporting, nuking the Joplin installs, and starting over with fresh encryption is also a silly proposition.

I'm a "seasoned" computer user, and if I can make this mistake, anyone can. The UI let me make this mistake, and not being able to correct it feels bad -- even if it doesn't matter. Yes, the docs do say...

Do not manually enable encryption on multiple devices in parallel, but rather wait for the other ones to sync with the first already encrypted device. Otherwise, you may end up with multiple encryption keys (which is supported by Joplin but most probably not what you want).

...but that's of little help after the fact. If those two sentences had popped up on my new device under some kind of "Syncing to a new device? Please wait for the sync to finish before messing with stuff!" pop-up when I went into the encryption settings, it would've stopped me from creating a new key unnecessarily.

So, those are my hopes for the future:

  • Make the UX more user-friendly so this multiple-key mistake is less likely to happen.
  • Allow us to remove inactive keys via the app itself rather than dubious manual means.
4 Likes

I am also dealing with this persistent banner.

I had the same problem mentioned by @markwdickson - not being able to remove the saved data on my Android phone, despite that I've cleared the cache and data before uninstalling Joplin. The master key I intended to delete appeared anyway after many attempts, regardless of powering off or not. Then magically, the obsolete master key was gone after I deleted the "JoplinProfile" from my phone. Everything else seemed fine so far.

For those who are seeking solution to cleaning Joplin data on Android phones for good, this is what I did:

Follow all what @ahpl suggested. If you see the obsolete master key still there after reinstallation, go to "Configuration > Export Profile (at the bottom)" > search "JoplinProfile" in your phone's "Files" > delete "JoplinProfile" > retap "Joplin". And there you go.

I probably should have deleted the JoplinProfile before uninstallation. You can try this. And make sure the "Fail-safe" button under "Configuration > Synchronisation" is NOT turned on after the reinstallation so that the local data on your phone can be wiped out. You can always turn it back on afterwards.

Good luck!

I don't think that does anything useful. You're just exporting the profile to a dir on your phone and then deleting that dir.

I apologize if this has already been suggested, but if deletion cannot/should not be supported, what about archival? Get the offending key out of sight and also disable any UI warnings about missing passwords on archived keys. Also, a textbox indicating how many notes each key is encrypting would be useful. I'm 100 percent certain in my case ( and most of these cases ), the answer for the offending key is zero, but it would be nice to have that certainty.
Finally, can't stress this enough, I love this tool. My entire life flows through it now. So thankful I found it. Thanks to all who make this.

2 Likes

Sigh.

1 Like

If you just want to nuke all the master_keys:

I removed all Joplin clients, except the Desktop instance.

  1. Remove encryption in settings
  2. Sync
  3. Backup notes as *.JEX file
  4. Backup the db, before we manipulate it:
$ cp ~/.config/joplin-desktop/database.sqlite ~/.config/joplin-desktop/database.sqlite.backup
  1. Delete all master keys:
# list master_keys. Should output the list of keys
sqlite3 ~/.config/joplin-desktop/database.sqlite 'SELECT * FROM master_keys'

# delete ALL master_keys and free space afterwards
$ sqlite3 ~/.config/joplin-desktop/database.sqlite 'DELETE FROM master_keys; VACUUM;'

# If you just want to remove a specific key
$ sqlite3 ~/.config/joplin-desktop/database.sqlite 'DELETE FROM master_keys WHERE id = <id>; VACUUM;'

# confirm deletion
sqlite3 ~/.config/joplin-desktop/database.sqlite 'SELECT * FROM master_keys'
  1. Re-enable encryption if desired
  2. Sync
  3. Configure other clients

Key deletion should really, really be a feature of the clients.
@laurent do you need help implementing this? What are your plans here?

7 Likes

Thanks!

Before reading your guide, I only got rid of the annoying list of master keys (left over after trying out Joplin on Desktop, Mobile an enabling & disabling encryption) by completely nuking everything everywhere, and even that wasn't that easy.

Why deleting the long list of inactive and obsolete master keys, begging for passwords is not possible is beyond me - it seems I'm not alone with this grievance.

Users of an app like Joplin should know when they positively disabled encryption everywhere. At least it should made possible after exporting keys to a backup, if deleting obsolete keys individually isn't implemented.

2 Likes

I think this is a good suggestion.

"Syncing to a new device? Please wait for the sync to finish before messing with stuff!"

Maybe not that exact wording, but then again maybe exactly!

No matter what message we put, I think some users will still not read it. There's already a banner with a bright background and link to the doc, because I know the E2EE UX is not great, but some people still don't read it.

It's the same with the Rich Text editor banner - people dismiss it without reading it, then proceed to create a very detailed GitHub issue with images and videos about some issue that was in the link they dismissed.

Oh my. I've been there myself

Gotta be hard at times, being a developer...

1 Like