chore: update noise-js & noise-rtc (#223)

* update noise-js
* migrate noise-rtc
* update waku versions
This commit is contained in:
Sasha 2023-04-04 23:39:03 +02:00 committed by GitHub
parent 2f419f4199
commit 21e8c705dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5474 additions and 3789 deletions

View File

@ -1,12 +1,7 @@
import { createLightNode } from "js-waku/lib/create_waku";
import { utils } from "js-waku";
import { waitForRemotePeer } from "js-waku/lib/wait_for_remote_peer";
import {
Fleet,
getPredefinedBootstrapNodes,
} from "js-waku/lib/predefined_bootstrap_nodes";
import { PeerDiscoveryStaticPeers } from "js-waku/lib/peer_discovery_static_list";
import { Protocols } from "js-waku";
import { createLightNode } from "@waku/create";
import * as utils from "@waku/utils/bytes";
import { waitForRemotePeer } from "@waku/core";
import { Protocols } from "@waku/interfaces";
import * as noise from "@waku/noise";
import protobuf from "protobufjs";
import QRCode from "qrcode";
@ -34,12 +29,12 @@ async function main() {
ui.waku.connected();
const [sender, responder] = getSenderAndResponder(node);
const responder = getResponder(node);
const myStaticKey = noise.generateX25519KeyPair();
const urlPairingInfo = getPairingInfoFromURL();
const pairingObj = new noise.WakuPairing(
sender,
node.lightPush,
responder,
myStaticKey,
urlPairingInfo || new noise.ResponderParameters()
@ -86,7 +81,7 @@ async function main() {
});
const payload = ProtoChatMessage.encode(message).finish();
await node.lightPush.push(encoder, { payload, timestamp });
await node.lightPush.send(encoder, { payload, timestamp });
});
} catch (err) {
ui.waku.error(err.message);
@ -122,13 +117,7 @@ function getPairingInfoFromURL() {
);
}
function getSenderAndResponder(node) {
const sender = {
async publish(encoder, msg) {
await node.lightPush.push(encoder, msg);
},
};
function getResponder(node) {
const msgQueue = new Array();
const subscriptions = new Map();
const intervals = new Map();
@ -178,7 +167,7 @@ function getSenderAndResponder(node) {
},
};
return [sender, responder];
return responder;
}
async function scheduleHandshakeAuthConfirmation(pairingObj, ui) {

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,11 @@
"start": "webpack-dev-server"
},
"dependencies": {
"@waku/noise": "https://github.com/waku-org/js-noise.git",
"js-waku": "^0.29.0-29436ea",
"@waku/core": "0.0.16",
"@waku/create": "0.0.12",
"@waku/interfaces": "0.0.11",
"@waku/noise": "0.0.3",
"@waku/utils": "0.0.4",
"protobufjs": "^7.1.2",
"qrcode": "^1.5.1"
},

View File

@ -1,12 +1,7 @@
import { createLightNode } from "js-waku/lib/create_waku";
import { utils } from "js-waku";
import { waitForRemotePeer } from "js-waku/lib/wait_for_remote_peer";
import {
Fleet,
getPredefinedBootstrapNodes,
} from "js-waku/lib/predefined_bootstrap_nodes";
import { PeerDiscoveryStaticPeers } from "js-waku/lib/peer_discovery_static_list";
import { Protocols } from "js-waku";
import { createLightNode } from "@waku/create";
import * as utils from "@waku/utils/bytes";
import { waitForRemotePeer } from "@waku/core";
import { Protocols } from "@waku/interfaces";
import * as noise from "@waku/noise";
import protobuf from "protobufjs";
import QRCode from "qrcode";
@ -31,12 +26,12 @@ async function main() {
ui.waku.connected();
const [sender, responder] = getSenderAndResponder(node);
const responder = getResponder(node);
const myStaticKey = noise.generateX25519KeyPair();
const urlPairingInfo = getPairingInfoFromURL();
const pairingObj = new noise.WakuPairing(
sender,
node.lightPush,
responder,
myStaticKey,
urlPairingInfo || new noise.ResponderParameters()
@ -217,13 +212,7 @@ function getPairingInfoFromURL() {
);
}
function getSenderAndResponder(node) {
const sender = {
async publish(encoder, msg) {
await node.lightPush.push(encoder, msg);
},
};
function getResponder(node) {
const msgQueue = new Array();
const subscriptions = new Map();
const intervals = new Map();
@ -273,7 +262,7 @@ function getSenderAndResponder(node) {
},
};
return [sender, responder];
return responder;
}
async function scheduleHandshakeAuthConfirmation(pairingObj, ui) {
@ -291,7 +280,7 @@ async function buildWakuMessage(node, noiseExecute) {
});
payload = ProtoMessage.encode(payload).finish();
return node.lightPush.push(encoder, { payload });
return node.lightPush.send(encoder, { payload });
};
const listenToMessages = async (fn) => {

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,11 @@
"start": "webpack-dev-server"
},
"dependencies": {
"@waku/noise": "https://github.com/waku-org/js-noise.git",
"js-waku": "^0.29.0-29436ea",
"@waku/core": "0.0.16",
"@waku/create": "0.0.12",
"@waku/interfaces": "0.0.11",
"@waku/noise": "0.0.3",
"@waku/utils": "0.0.4",
"protobufjs": "^7.1.2",
"qrcode": "^1.5.1"
},