From 0a1bd46ca97518bc0f28b83d9b362db7eee480a2 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 10 Aug 2018 21:17:52 +0300 Subject: [PATCH] Don't prefix everything by default --- client/src/builtin/E2EE.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/builtin/E2EE.js b/client/src/builtin/E2EE.js index 874bdb32..18b5b849 100644 --- a/client/src/builtin/E2EE.js +++ b/client/src/builtin/E2EE.js @@ -39,12 +39,12 @@ export default new class E2EE extends BuiltinModule { return Settings.getSet('security').settings.find(s => s.id === 'e2eedb').settings[0].value; } - encrypt(key, content, prefix = '$:') { + encrypt(key, content, prefix = '') { return prefix + aes256.encrypt(key, content); } - decrypt(key, content, prefix = '$:') { - return aes256.decrypt(key, content.substr(2)); + decrypt(key, content, prefix = '') { + return aes256.decrypt(key, content.replace(prefix, '')); } getKey(channelId) { @@ -88,7 +88,7 @@ export default new class E2EE extends BuiltinModule { handleSubmitCta(component, args, retVal) { const key = this.getKey(DiscordApi.currentChannel.id); if (!key) return; - component.props.value = this.encrypt(this.decrypt(this.decrypt(seed, this.master), key), component.props.value); + component.props.value = this.encrypt(this.decrypt(this.decrypt(seed, this.master), key), component.props.value, '$:'); } async disabled(e) {