mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-04 06:43:12 +00:00
fix: rebase package lock
This commit is contained in:
parent
5f63cb5bfb
commit
f649f59e64
13
package-lock.json
generated
13
package-lock.json
generated
@ -11727,6 +11727,18 @@
|
|||||||
"resolved": "packages/message-encryption",
|
"resolved": "packages/message-encryption",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@waku/message-hash": {
|
||||||
|
"version": "0.1.19",
|
||||||
|
"resolved": "https://registry.npmjs.org/@waku/message-hash/-/message-hash-0.1.19.tgz",
|
||||||
|
"integrity": "sha512-fl+qky3MQK8l3HTT5wq23NcdYFYNqVcUVwBblX9/IArcDlDNjEEdK68K3n8rFWxBBd2JAK0RxU7MMkLiK3vWUA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@noble/hashes": "^1.3.2",
|
||||||
|
"@waku/utils": "0.0.23"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@waku/proto": {
|
"node_modules/@waku/proto": {
|
||||||
"resolved": "packages/proto",
|
"resolved": "packages/proto",
|
||||||
"link": true
|
"link": true
|
||||||
@ -44183,6 +44195,7 @@
|
|||||||
"@types/lodash": "^4.17.15",
|
"@types/lodash": "^4.17.15",
|
||||||
"@types/sinon": "^17.0.3",
|
"@types/sinon": "^17.0.3",
|
||||||
"@waku/build-utils": "^1.0.0",
|
"@waku/build-utils": "^1.0.0",
|
||||||
|
"@waku/interfaces": "0.0.30",
|
||||||
"@waku/message-encryption": "^0.0.33",
|
"@waku/message-encryption": "^0.0.33",
|
||||||
"deep-equal-in-any-order": "^2.0.6",
|
"deep-equal-in-any-order": "^2.0.6",
|
||||||
"fast-check": "^3.23.2",
|
"fast-check": "^3.23.2",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { IDecodedMessage, IProtoMessage } from "@waku/interfaces";
|
import type { IProtoMessage } from "@waku/interfaces";
|
||||||
import { bytesToHex, hexToBytes } from "@waku/utils/bytes";
|
import { bytesToHex, hexToBytes } from "@waku/utils/bytes";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
@ -93,19 +93,20 @@ describe("Message Hash: RFC Test Vectors", () => {
|
|||||||
expect(bytesToHex(hash)).to.equal(expectedHash);
|
expect(bytesToHex(hash)).to.equal(expectedHash);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Waku message hash computation (message is IDecodedMessage)", () => {
|
it("Waku message hash computation (message is IProtoMessage with version)", () => {
|
||||||
const expectedHash =
|
const expectedHash =
|
||||||
"3f11bc950dce0e3ffdcf205ae6414c01130bb5d9f20644869bff80407fa52c8f";
|
"3f11bc950dce0e3ffdcf205ae6414c01130bb5d9f20644869bff80407fa52c8f";
|
||||||
const pubsubTopic = "/waku/2/default-waku/proto";
|
const pubsubTopic = "/waku/2/default-waku/proto";
|
||||||
const message: IDecodedMessage = {
|
const message: IProtoMessage = {
|
||||||
version: 0,
|
|
||||||
payload: new Uint8Array(),
|
payload: new Uint8Array(),
|
||||||
pubsubTopic,
|
|
||||||
contentTopic: "/waku/2/default-content/proto",
|
contentTopic: "/waku/2/default-content/proto",
|
||||||
meta: hexToBytes("0x73757065722d736563726574"),
|
meta: hexToBytes("0x73757065722d736563726574"),
|
||||||
timestamp: new Date("2024-04-30T10:54:14.978Z"),
|
timestamp:
|
||||||
|
BigInt(new Date("2024-04-30T10:54:14.978Z").getTime()) *
|
||||||
|
BigInt(1000000),
|
||||||
ephemeral: undefined,
|
ephemeral: undefined,
|
||||||
rateLimitProof: undefined
|
rateLimitProof: undefined,
|
||||||
|
version: 0
|
||||||
};
|
};
|
||||||
const hash = messageHash(pubsubTopic, message);
|
const hash = messageHash(pubsubTopic, message);
|
||||||
expect(bytesToHex(hash)).to.equal(expectedHash);
|
expect(bytesToHex(hash)).to.equal(expectedHash);
|
||||||
@ -144,16 +145,17 @@ describe("messageHash and messageHashStr", () => {
|
|||||||
expect(hashStr).to.equal(hashStrFromBytes);
|
expect(hashStr).to.equal(hashStrFromBytes);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("messageHashStr works with IDecodedMessage", () => {
|
it("messageHashStr works with IProtoMessage", () => {
|
||||||
const decodedMessage: IDecodedMessage = {
|
const decodedMessage: IProtoMessage = {
|
||||||
version: 0,
|
|
||||||
payload: new Uint8Array([1, 2, 3, 4]),
|
payload: new Uint8Array([1, 2, 3, 4]),
|
||||||
pubsubTopic,
|
|
||||||
contentTopic: "/waku/2/default-content/proto",
|
contentTopic: "/waku/2/default-content/proto",
|
||||||
meta: new Uint8Array([5, 6, 7, 8]),
|
meta: new Uint8Array([5, 6, 7, 8]),
|
||||||
timestamp: new Date("2024-04-30T10:54:14.978Z"),
|
timestamp:
|
||||||
|
BigInt(new Date("2024-04-30T10:54:14.978Z").getTime()) *
|
||||||
|
BigInt(1000000),
|
||||||
ephemeral: undefined,
|
ephemeral: undefined,
|
||||||
rateLimitProof: undefined
|
rateLimitProof: undefined,
|
||||||
|
version: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
const hashStr = messageHashStr(pubsubTopic, decodedMessage);
|
const hashStr = messageHashStr(pubsubTopic, decodedMessage);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
import { messageHash } from "@waku/core";
|
||||||
import type { IDecodedMessage, LightNode } from "@waku/interfaces";
|
import type { IDecodedMessage, LightNode } from "@waku/interfaces";
|
||||||
import { messageHash } from "@waku/message-hash";
|
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -59,15 +59,13 @@ describe("Waku Store, message hash query", function () {
|
|||||||
);
|
);
|
||||||
const messageHashes = sentMessages.map((msg) =>
|
const messageHashes = sentMessages.map((msg) =>
|
||||||
messageHash(TestDecoder.pubsubTopic, {
|
messageHash(TestDecoder.pubsubTopic, {
|
||||||
pubsubTopic: TestDecoder.pubsubTopic,
|
|
||||||
payload: Buffer.from(msg.payload, "base64"),
|
payload: Buffer.from(msg.payload, "base64"),
|
||||||
contentTopic: msg.contentTopic || TestDecoder.contentTopic,
|
contentTopic: msg.contentTopic || TestDecoder.contentTopic,
|
||||||
timestamp: msg.timestamp
|
timestamp: msg.timestamp || undefined,
|
||||||
? new Date(Number(msg.timestamp / 1000000n))
|
|
||||||
: undefined,
|
|
||||||
meta: undefined,
|
meta: undefined,
|
||||||
rateLimitProof: undefined,
|
rateLimitProof: undefined,
|
||||||
ephemeral: undefined
|
ephemeral: undefined,
|
||||||
|
version: undefined
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user