From 64608c7e628f195189a093ff7745157da17efe07 Mon Sep 17 00:00:00 2001 From: Mega-Mewthree Date: Mon, 13 Aug 2018 13:17:29 -0700 Subject: [PATCH] Switched context menu stuff to popover, fixed things. --- client/src/builtin/E2EE.js | 26 ++++++++++++++++++ client/src/builtin/E2EEComponent.vue | 41 +++++++++++++++++++++++++++- client/src/modules/security.js | 22 +++++++++++++++ package-lock.json | 16 +++++------ 4 files changed, 96 insertions(+), 9 deletions(-) diff --git a/client/src/builtin/E2EE.js b/client/src/builtin/E2EE.js index f0b8095c..045f5117 100644 --- a/client/src/builtin/E2EE.js +++ b/client/src/builtin/E2EE.js @@ -90,6 +90,32 @@ export default new class E2EE extends BuiltinModule { Settings.getSetting('security', 'e2eedb', 'e2ekvps').addItem({ value: { key: channelId, value: key } }); } +<<<<<<< Updated upstream +======= + get ecdhStorage() { + return this._ecdhStorage || (this._ecdhStorage = {}); + } + + createKeyExchange(dmChannelID) { + this.ecdhStorage[dmChannelID] = Security.createECDH(); + return Security.generateECDHKeys(this.ecdhStorage[dmChannelID]); + } + + publicKeyFor(dmChannelID) { + return Security.getECDHPublicKey(this.ecdhStorage[dmChannelID]); + } + + computeSecret(dmChannelID, otherKey) { + try { + const secret = Security.computeECDHSecret(this.ecdhStorage[dmChannelID], otherKey); + delete this.ecdhStorage[dmChannelID]; + return Security.sha256(secret); + } catch (e) { + throw e; + } + } + +>>>>>>> Stashed changes async enabled(e) { seed = Security.randomBytes(); // TODO Input modal for key diff --git a/client/src/builtin/E2EEComponent.vue b/client/src/builtin/E2EEComponent.vue index d767385d..4e6f1259 100644 --- a/client/src/builtin/E2EEComponent.vue +++ b/client/src/builtin/E2EEComponent.vue @@ -9,7 +9,11 @@ */