Suite B
This commit is contained in:
parent
b1f0a4247a
commit
54e5f2149b
|
@ -31,6 +31,7 @@ export default new class E2EE extends BuiltinModule {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
window.nodecrypto = nodecrypto;
|
||||
this.encryptNewMessages = true;
|
||||
this.ecdhDate = START_DATE;
|
||||
}
|
||||
|
@ -117,7 +118,7 @@ export default new class E2EE extends BuiltinModule {
|
|||
try {
|
||||
const secret = Security.computeECDHSecret(this.ecdhStorage[dmChannelID], otherKey);
|
||||
delete this.ecdhStorage[dmChannelID];
|
||||
return Security.sha256(secret);
|
||||
return Security.hash('sha384', secret, 'hex');
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -80,8 +80,14 @@ export default class Security {
|
|||
});
|
||||
}
|
||||
|
||||
static createECDH() {
|
||||
return nodecrypto.createECDH('secp521r1');
|
||||
static createECDH(curve = 'secp384r1') {
|
||||
return nodecrypto.createECDH(curve);
|
||||
}
|
||||
|
||||
static hash(algorithm, data, encoding) {
|
||||
const hash = nodecrypto.createHash(algorithm);
|
||||
hash.update(data);
|
||||
return hash.digest(encoding);
|
||||
}
|
||||
|
||||
static sha256(text) {
|
||||
|
|
Loading…
Reference in New Issue