mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-02 13:53: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",
|
||||
"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": {
|
||||
"resolved": "packages/proto",
|
||||
"link": true
|
||||
@ -44183,6 +44195,7 @@
|
||||
"@types/lodash": "^4.17.15",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@waku/build-utils": "^1.0.0",
|
||||
"@waku/interfaces": "0.0.30",
|
||||
"@waku/message-encryption": "^0.0.33",
|
||||
"deep-equal-in-any-order": "^2.0.6",
|
||||
"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 { expect } from "chai";
|
||||
|
||||
@ -93,19 +93,20 @@ describe("Message Hash: RFC Test Vectors", () => {
|
||||
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 =
|
||||
"3f11bc950dce0e3ffdcf205ae6414c01130bb5d9f20644869bff80407fa52c8f";
|
||||
const pubsubTopic = "/waku/2/default-waku/proto";
|
||||
const message: IDecodedMessage = {
|
||||
version: 0,
|
||||
const message: IProtoMessage = {
|
||||
payload: new Uint8Array(),
|
||||
pubsubTopic,
|
||||
contentTopic: "/waku/2/default-content/proto",
|
||||
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,
|
||||
rateLimitProof: undefined
|
||||
rateLimitProof: undefined,
|
||||
version: 0
|
||||
};
|
||||
const hash = messageHash(pubsubTopic, message);
|
||||
expect(bytesToHex(hash)).to.equal(expectedHash);
|
||||
@ -144,16 +145,17 @@ describe("messageHash and messageHashStr", () => {
|
||||
expect(hashStr).to.equal(hashStrFromBytes);
|
||||
});
|
||||
|
||||
it("messageHashStr works with IDecodedMessage", () => {
|
||||
const decodedMessage: IDecodedMessage = {
|
||||
version: 0,
|
||||
it("messageHashStr works with IProtoMessage", () => {
|
||||
const decodedMessage: IProtoMessage = {
|
||||
payload: new Uint8Array([1, 2, 3, 4]),
|
||||
pubsubTopic,
|
||||
contentTopic: "/waku/2/default-content/proto",
|
||||
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,
|
||||
rateLimitProof: undefined
|
||||
rateLimitProof: undefined,
|
||||
version: 0
|
||||
};
|
||||
|
||||
const hashStr = messageHashStr(pubsubTopic, decodedMessage);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { messageHash } from "@waku/core";
|
||||
import type { IDecodedMessage, LightNode } from "@waku/interfaces";
|
||||
import { messageHash } from "@waku/message-hash";
|
||||
import { expect } from "chai";
|
||||
|
||||
import {
|
||||
@ -59,15 +59,13 @@ describe("Waku Store, message hash query", function () {
|
||||
);
|
||||
const messageHashes = sentMessages.map((msg) =>
|
||||
messageHash(TestDecoder.pubsubTopic, {
|
||||
pubsubTopic: TestDecoder.pubsubTopic,
|
||||
payload: Buffer.from(msg.payload, "base64"),
|
||||
contentTopic: msg.contentTopic || TestDecoder.contentTopic,
|
||||
timestamp: msg.timestamp
|
||||
? new Date(Number(msg.timestamp / 1000000n))
|
||||
: undefined,
|
||||
timestamp: msg.timestamp || undefined,
|
||||
meta: undefined,
|
||||
rateLimitProof: undefined,
|
||||
ephemeral: undefined
|
||||
ephemeral: undefined,
|
||||
version: undefined
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user