1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

All: Allow disabling any master key, including default or active one

Ref: https://discourse.joplinapp.org/t/syncing-error-with-joplin-cloud-and-e2ee-master-key-is-not-loaded/20115/5
This commit is contained in:
Laurent Cozic
2021-09-06 18:33:17 +01:00
parent 8996a0159a
commit 9407efd8ec
3 changed files with 17 additions and 7 deletions

View File

@@ -239,7 +239,10 @@ export function setMasterKeyEnabled(mkId: string, enabled: boolean = true) {
const idx = s.masterKeys.findIndex(mk => mk.id === mkId);
if (idx < 0) throw new Error(`No such master key: ${mkId}`);
if (mkId === getActiveMasterKeyId() && !enabled) throw new Error('The active master key cannot be disabled');
// Disabled for now as it's needed to disable even the main master key when the password has been forgotten
// https://discourse.joplinapp.org/t/syncing-error-with-joplin-cloud-and-e2ee-master-key-is-not-loaded/20115/5?u=laurent
//
// if (mkId === getActiveMasterKeyId() && !enabled) throw new Error('The active master key cannot be disabled');
s.masterKeys[idx] = {
...s.masterKeys[idx],