From bdec8b842e3bd12efe2fe78bdfd25877593569ec Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 10 Aug 2018 17:02:41 +0300 Subject: [PATCH] Set master key --- client/src/builtin/E2EE.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/builtin/E2EE.js b/client/src/builtin/E2EE.js index fb9610eb..84089588 100644 --- a/client/src/builtin/E2EE.js +++ b/client/src/builtin/E2EE.js @@ -15,7 +15,7 @@ import { VueInjector, Reflection } from 'ui'; import E2EEComponent from './E2EEComponent.vue'; import aes256 from 'aes256'; -const seed = Math.random().toString(36).replace(/[^a-z]+/g, ''); +let seed = Math.random().toString(36).replace(/[^a-z]+/g, ''); export default new class E2EE extends BuiltinModule { @@ -24,6 +24,11 @@ export default new class E2EE extends BuiltinModule { this.master = this.encrypt(seed, 'temporarymasterkey'); } + setMaster(key) { + seed = Math.random().toString(36).replace(/[^a-z]+/g, ''); + this.master = this.encrypt(seed, key); + } + get settingPath() { return ['security', 'default', 'e2ee']; }