use next version of libraries for light-js and noise-js

This commit is contained in:
Sasha 2024-04-19 00:41:29 +02:00
parent f60c456e84
commit 5d10d30d21
No known key found for this signature in database
4 changed files with 2236 additions and 6024 deletions

View File

@ -76,12 +76,13 @@
createDecoder,
utf8ToBytes,
bytesToUtf8,
} from "https://unpkg.com/@waku/sdk@0.0.24-070b625.0/bundle/index.js";
} from "https://unpkg.com/@waku/sdk@0.0.25-fd60cc2.0/bundle/index.js";
import {
enrTree,
DnsNodeDiscovery,
} from "https://unpkg.com/@waku/discovery@0.0.2-070b625.0/bundle/index.js";
import { messageHash } from "https://unpkg.com/@waku/message-hash@0.1.12-070b625.0/bundle/index.js";
wakuDnsDiscovery,
} from "https://unpkg.com/@waku/discovery@0.0.2-fd60cc2.0/bundle/index.js";
import { messageHash } from "https://unpkg.com/@waku/message-hash@0.1.13-fd60cc2.0/bundle/index.js";
const peerIdDiv = document.getElementById("peer-id");
const remotePeerIdDiv = document.getElementById("remote-peer-id");
@ -98,8 +99,8 @@
const peersSelector = document.getElementById("peer-select");
const ContentTopic = "/js-waku-examples/1/chat/utf8";
const decoder = createDecoder(ContentTopic);
const encoder = createEncoder({ contentTopic: ContentTopic });
const decoder = createDecoder(ContentTopic/*, "/waku/2/rs/1/5"*/);
const encoder = createEncoder({ contentTopic: ContentTopic/*, pubsubTopic: "/waku/2/rs/1/5" */});
// Each key is a unique identifier for the message. Each value is an obj { text, timestamp }
let messages = {};
let unsubscribe;
@ -125,7 +126,17 @@
}
statusDiv.innerHTML = "<p>Creating Waku node.</p>";
const node = await createLightNode();
const node = await createLightNode({
shardInfo: {
contentTopics: [ContentTopic]
},
defaultBootstrap: true,
// libp2p: {
// peerDiscovery: [
// wakuDnsDiscovery([enrTree["TEST"]], { lightPush: 5, filter: 5, store: 5 }),
// ]
// }
});
statusDiv.innerHTML = "<p>Starting Waku node.</p>";
await node.start();

View File

@ -1,9 +1,13 @@
import { createLightNode, waitForRemotePeer } from "@waku/sdk";
import * as utils from "@waku/utils/bytes";
import { contentTopicToPubsubTopic } from "@waku/utils";
import * as noise from "@waku/noise";
import protobuf from "protobufjs";
import QRCode from "qrcode";
const ContentTopic = "/noise-js/1/message/proto";
const PubsubTopic = contentTopicToPubsubTopic(ContentTopic);
// Protobuf
const ProtoChatMessage = new protobuf.Type("ChatMessage")
.add(new protobuf.Field("timestamp", 1, "uint64"))
@ -19,6 +23,9 @@ async function main() {
// Starting the node
const node = await createLightNode({
defaultBootstrap: true,
shardInfo: {
contentTopics: [ContentTopic],
}
});
try {
@ -27,13 +34,14 @@ async function main() {
ui.waku.connected();
const myStaticKey = noise.generateX25519KeyPair();
const myStaticKey = new noise.X25519DHKey();
const urlPairingInfo = getPairingInfoFromURL();
const pairingObj = new noise.WakuPairing(
PubsubTopic,
node.lightPush,
node.filter,
myStaticKey,
myStaticKey.generateKeyPair(),
urlPairingInfo || new noise.ResponderParameters()
);
const pExecute = pairingObj.execute(120000); // timeout after 2m

File diff suppressed because it is too large Load Diff

View File

@ -9,9 +9,9 @@
"start": "webpack-dev-server"
},
"dependencies": {
"@waku/sdk": "0.0.18",
"@waku/noise": "0.0.3-31510da",
"@waku/utils": "0.0.10",
"@waku/sdk": "0.0.25-fd60cc2.0",
"@waku/noise": "0.0.3-056e650",
"@waku/utils": "0.0.17-fd60cc2.0",
"protobufjs": "^7.1.2",
"qrcode": "^1.5.1"
},