chore: use next version of libraries for light-js and noise-js (#60)

This commit is contained in:
Sasha 2024-04-23 23:55:53 +02:00 committed by GitHub
parent f60c456e84
commit ebf7beb242
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 2230 additions and 6023 deletions

View File

@ -76,12 +76,13 @@
createDecoder, createDecoder,
utf8ToBytes, utf8ToBytes,
bytesToUtf8, 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 { import {
enrTree, enrTree,
DnsNodeDiscovery, DnsNodeDiscovery,
} from "https://unpkg.com/@waku/discovery@0.0.2-070b625.0/bundle/index.js"; wakuDnsDiscovery,
import { messageHash } from "https://unpkg.com/@waku/message-hash@0.1.12-070b625.0/bundle/index.js"; } 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 peerIdDiv = document.getElementById("peer-id");
const remotePeerIdDiv = document.getElementById("remote-peer-id"); const remotePeerIdDiv = document.getElementById("remote-peer-id");
@ -125,7 +126,12 @@
} }
statusDiv.innerHTML = "<p>Creating Waku node.</p>"; statusDiv.innerHTML = "<p>Creating Waku node.</p>";
const node = await createLightNode(); const node = await createLightNode({
shardInfo: {
contentTopics: [ContentTopic]
},
defaultBootstrap: true,
});
statusDiv.innerHTML = "<p>Starting Waku node.</p>"; statusDiv.innerHTML = "<p>Starting Waku node.</p>";
await node.start(); await node.start();

View File

@ -1,9 +1,13 @@
import { createLightNode, waitForRemotePeer } from "@waku/sdk"; import { createLightNode, waitForRemotePeer } from "@waku/sdk";
import * as utils from "@waku/utils/bytes"; import * as utils from "@waku/utils/bytes";
import { contentTopicToPubsubTopic } from "@waku/utils";
import * as noise from "@waku/noise"; import * as noise from "@waku/noise";
import protobuf from "protobufjs"; import protobuf from "protobufjs";
import QRCode from "qrcode"; import QRCode from "qrcode";
const ContentTopic = "/noise-js/1/message/proto";
const PubsubTopic = contentTopicToPubsubTopic(ContentTopic);
// Protobuf // Protobuf
const ProtoChatMessage = new protobuf.Type("ChatMessage") const ProtoChatMessage = new protobuf.Type("ChatMessage")
.add(new protobuf.Field("timestamp", 1, "uint64")) .add(new protobuf.Field("timestamp", 1, "uint64"))
@ -19,6 +23,9 @@ async function main() {
// Starting the node // Starting the node
const node = await createLightNode({ const node = await createLightNode({
defaultBootstrap: true, defaultBootstrap: true,
shardInfo: {
contentTopics: [ContentTopic],
}
}); });
try { try {
@ -27,13 +34,14 @@ async function main() {
ui.waku.connected(); ui.waku.connected();
const myStaticKey = noise.generateX25519KeyPair(); const myStaticKey = new noise.X25519DHKey();
const urlPairingInfo = getPairingInfoFromURL(); const urlPairingInfo = getPairingInfoFromURL();
const pairingObj = new noise.WakuPairing( const pairingObj = new noise.WakuPairing(
PubsubTopic,
node.lightPush, node.lightPush,
node.filter, node.filter,
myStaticKey, myStaticKey.generateKeyPair(),
urlPairingInfo || new noise.ResponderParameters() urlPairingInfo || new noise.ResponderParameters()
); );
const pExecute = pairingObj.execute(120000); // timeout after 2m 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" "start": "webpack-dev-server"
}, },
"dependencies": { "dependencies": {
"@waku/sdk": "0.0.18", "@waku/sdk": "0.0.25-fd60cc2.0",
"@waku/noise": "0.0.3-31510da", "@waku/noise": "0.0.3-056e650",
"@waku/utils": "0.0.10", "@waku/utils": "0.0.17-fd60cc2.0",
"protobufjs": "^7.1.2", "protobufjs": "^7.1.2",
"qrcode": "^1.5.1" "qrcode": "^1.5.1"
}, },