mirror of https://github.com/waku-org/waku-lab.git
chore: use next version of libraries for light-js and noise-js (#60)
This commit is contained in:
parent
f60c456e84
commit
ebf7beb242
|
@ -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");
|
||||
|
@ -99,7 +100,7 @@
|
|||
|
||||
const ContentTopic = "/js-waku-examples/1/chat/utf8";
|
||||
const decoder = createDecoder(ContentTopic);
|
||||
const encoder = createEncoder({ contentTopic: ContentTopic });
|
||||
const encoder = createEncoder({ contentTopic: ContentTopic});
|
||||
// Each key is a unique identifier for the message. Each value is an obj { text, timestamp }
|
||||
let messages = {};
|
||||
let unsubscribe;
|
||||
|
@ -125,7 +126,12 @@
|
|||
}
|
||||
|
||||
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>";
|
||||
await node.start();
|
||||
|
|
|
@ -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
|
@ -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"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue