Error toast on computeSecret error.

This commit is contained in:
Mega-Mewthree 2018-08-11 16:28:34 -07:00
parent 7e41fe73e7
commit c10310af3a
2 changed files with 11 additions and 6 deletions

View File

@ -201,11 +201,15 @@ export default new class E2EE extends BuiltinModule {
}
computeSecret(userID, otherKey) {
const secret = this.ecdh[userID].computeSecret(otherKey, 'base64', 'base64');
delete this.ecdh[userID];
const hash = crypto.createHash('sha256');
hash.update(secret);
return hash.digest('base64');
try {
const secret = this.ecdh[userID].computeSecret(otherKey, 'base64', 'base64');
delete this.ecdh[userID];
const hash = crypto.createHash('sha256');
hash.update(secret);
return hash.digest('base64');
} catch (e) {
throw e;
}
}
handleChannelTextAreaSubmit(component, args, retVal) {

View File

@ -60,7 +60,8 @@
chatInput[Object.keys(chatInput).find(k => k.startsWith('__reactEventHandlers'))].onChange.call(chatInput, evt);
Toasts.success("Encryption key has been set for this DM channel.");
} catch (e) {
throw e;
Toasts.error("Invalid public key. Please set up a new key exchange.");
console.error(e);
}
}