Reset encryptNewMessages to previous state
This commit is contained in:
parent
8b4318c06e
commit
73f2fe4fd0
|
@ -31,7 +31,6 @@ export default new class E2EE extends BuiltinModule {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
window.nodecrypto = nodecrypto;
|
||||
this.encryptNewMessages = true;
|
||||
this.ecdhDate = START_DATE;
|
||||
}
|
||||
|
@ -147,6 +146,8 @@ export default new class E2EE extends BuiltinModule {
|
|||
const secret = this.computeSecret(channelId, key);
|
||||
this.setKey(channelId, secret);
|
||||
Toasts.success('Key exchange complete!');
|
||||
if (this.preEchangeState) this.encryptNewMessages = this.preEchangeState;
|
||||
this.preEchangeState = null;
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
Toasts.warning('Key exchange for channel already in progress!');
|
||||
return;
|
||||
}
|
||||
E2EE.preEchangeState = E2EE.encryptNewMessages;
|
||||
E2EE.encryptNewMessages = false; // Disable encrypting new messages so we won't encrypt public keys
|
||||
const publicKeyMessage = `\`\`\`\n-----BEGIN PUBLIC KEY-----\n${keyExchange}\n-----END PUBLIC KEY-----\n\`\`\``;
|
||||
WebpackModules.getModuleByName('DraftActions').saveDraft(DiscordApi.currentChannel.id, publicKeyMessage);
|
||||
|
|
Loading…
Reference in New Issue