Initial update for the bitmessage-js package #1

Merged
PeterSurda merged 15 commits from lee.miller/bitmessage-js:mac into master 2024-03-08 01:55:30 +01:00
Showing only changes of commit 095bc95660 - Show all commits

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