Fix the test case for encrypted

This commit is contained in:
Lee Miller 2024-03-02 16:37:57 +02:00
parent 597ed89c90
commit 095bc95660
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

10
test.js
View File

@ -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;
});
});