1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Electron: Improved enabling/disabling E2EE

This commit is contained in:
Laurent Cozic
2017-12-24 11:23:51 +01:00
parent d1abf4971d
commit bef7c38724
3 changed files with 31 additions and 11 deletions

View File

@ -43,6 +43,13 @@ class EncryptionService {
return this.logger_;
}
async generateMasterKeyAndEnableEncryption(password) {
let masterKey = await this.generateMasterKey(password);
masterKey = await MasterKey.save(masterKey);
await this.enableEncryption(masterKey, password);
await this.loadMasterKeysFromSettings();
}
async enableEncryption(masterKey, password = null) {
Setting.setValue('encryption.enabled', true);
Setting.setValue('encryption.activeMasterKeyId', masterKey.id);