From 3866d8a077d4b1fff2a0017067018114a0bcd7d2 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Mon, 6 Apr 2020 20:04:17 +0200 Subject: [PATCH] Convert shared key to Buffer with 32 length --- src/handshakes/abstract-handshake.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/handshakes/abstract-handshake.ts b/src/handshakes/abstract-handshake.ts index 45b650e..9834628 100644 --- a/src/handshakes/abstract-handshake.ts +++ b/src/handshakes/abstract-handshake.ts @@ -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);