From 095bc95660becd065071e8ce9889ca463e630c35 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sat, 2 Mar 2024 16:37:57 +0200 Subject: [PATCH] Fix the test case for encrypted --- test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test.js b/test.js index 79c793f..d2ae1f6 100644 --- a/test.js +++ b/test.js @@ -460,8 +460,10 @@ describe("Common structures", function() { describe("encrypted", function() { it("should encode and decode", function() { var iv = Buffer.alloc(16); - var ephemPublicKey = Buffer.alloc(65); - ephemPublicKey[0] = 0x04; + var ephemPublicKey = Buffer.alloc(70); + ephemPublicKey.writeUInt16BE(714, 0, true); + ephemPublicKey.writeUInt16BE(32, 2, true); + ephemPublicKey.writeUInt16BE(32, 36, true); var ciphertext = Buffer.from("test"); var mac = Buffer.alloc(32); var inopts = { @@ -475,9 +477,9 @@ describe("Common structures", function() { expect(encoded.length).to.equal(122); var outopts = encrypted.decode(encoded); expect(bufferEqual(iv, outopts.iv)).to.be.true; - // expect(bufferEqual(ephemPublicKey, outopts.ephemPublicKey)).to.be.true; + expect(bufferEqual(ephemPublicKey, outopts.ephemPublicKey)).to.be.true; expect(ciphertext.toString()).to.equal("test"); - // expect(bufferEqual(mac, outopts.mac)).to.be.true; + expect(bufferEqual(mac, outopts.mac)).to.be.true; }); });