Don't prefix everything by default

This commit is contained in:
Jiiks 2018-08-10 21:17:52 +03:00
parent 83ef17d302
commit 0a1bd46ca9
1 changed files with 4 additions and 4 deletions

View File

@ -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) {