From 8e3287979592cbe254988d7835d3af832eeeaf40 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Mon, 17 Aug 2020 04:02:02 +0000 Subject: [PATCH] get rid of pubkey warnings --- dialects/transport/lib.loki_crypt.js | 3 +++ lib.loki_crypt.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/dialects/transport/lib.loki_crypt.js b/dialects/transport/lib.loki_crypt.js index f7648c6..4e8fe42 100644 --- a/dialects/transport/lib.loki_crypt.js +++ b/dialects/transport/lib.loki_crypt.js @@ -71,6 +71,9 @@ const DHDecrypt64 = async (symmetricKey, cipherText64) => { } function makeSymmetricKey(privKey, pubKey) { + if (pubKey.byteLength === 32) { + pubKey = Buffer.concat([Buffer.from('05', 'hex'), pubKey]) + } const keyAgreement = libsignal.curve.calculateAgreement( pubKey, privKey, diff --git a/lib.loki_crypt.js b/lib.loki_crypt.js index 10d630f..5c9a44b 100644 --- a/lib.loki_crypt.js +++ b/lib.loki_crypt.js @@ -71,6 +71,9 @@ const DHDecrypt64 = async (symmetricKey, cipherText64) => { } function makeSymmetricKey(privKey, pubKey) { + if (pubKey.byteLength === 32) { + pubKey = Buffer.concat([Buffer.from('05', 'hex'), pubKey]) + } const keyAgreement = libsignal.curve.calculateAgreement( pubKey, privKey,