The pubsub topic string
The message to be hashed
A string containing the hex representation of the SHA-256 hash
import { messageHashStr } from "@waku/core";
const pubsubTopic = "/waku/2/default-waku/proto";
const message = {
payload: new Uint8Array([1, 2, 3, 4]),
contentTopic: "/waku/2/default-content/proto",
meta: new Uint8Array([5, 6, 7, 8]),
timestamp: new Date()
};
const hashString = messageHashStr(pubsubTopic, message);
console.log(hashString); // e.g. "a1b2c3d4..."
Computes a deterministic message hash and returns it as a hexadecimal string. This is a convenience wrapper around messageHash that converts the result to a hex string.