• Deterministic Message Hashing as defined in 14/WAKU2-MESSAGE

    Computes a SHA-256 hash of the concatenation of pubsub topic, payload, content topic, meta, and timestamp.

    Parameters

    Returns Uint8Array

    A Uint8Array containing the SHA-256 hash

    Example

    import { messageHash } 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 hash = messageHash(pubsubTopic, message);