Rename variables to better describe what they represent.

This commit is contained in:
Mega-Mewthree 2018-08-11 18:24:55 -07:00
parent 02e6fb88aa
commit b9e9ab89f7
1 changed files with 8 additions and 8 deletions

View File

@ -191,19 +191,19 @@ export default new class E2EE extends BuiltinModule {
return this._ecdh;
}
createKeyExchange(userID) {
this.ecdh[userID] = crypto.createECDH('secp521r1');
return this.ecdh[userID].generateKeys('base64');
createKeyExchange(dmChannelID) {
this.ecdh[dmChannelID] = crypto.createECDH('secp521r1');
return this.ecdh[dmChannelID].generateKeys('base64');
}
publicKeyFor(userID) {
return this.ecdh[userID].getPublicKey('base64');
publicKeyFor(dmChannelID) {
return this.ecdh[dmChannelID].getPublicKey('base64');
}
computeSecret(userID, otherKey) {
computeSecret(dmChannelID, otherKey) {
try {
const secret = this.ecdh[userID].computeSecret(otherKey, 'base64', 'base64');
delete this.ecdh[userID];
const secret = this.ecdh[dmChannelID].computeSecret(otherKey, 'base64', 'base64');
delete this.ecdh[dmChannelID];
const hash = crypto.createHash('sha256');
hash.update(secret);
return hash.digest('base64');