Convert shared key to Buffer with 32 length

This commit is contained in:
Matija Petrunic 2020-04-06 20:04:17 +02:00
parent 2745783db3
commit 3866d8a077

View File

@ -106,7 +106,7 @@ export abstract class AbstractHandshake {
protected dh(privateKey: bytes32, publicKey: bytes32): bytes32 {
try {
return Buffer.from(box.before(publicKey, privateKey));
return Buffer.from(box.before(publicKey, privateKey), 0, 32);
} catch (e) {
logger(e.message);
return Buffer.alloc(32);