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 @@ */