Updates
BIN
dogfooding/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
dogfooding/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
51
dogfooding/index.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>Sent Received Message Ratio</title>
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
<style>
|
||||
#container {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
}
|
||||
#sender,
|
||||
#receiver {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h3>Waku Dogfooding App</h3>
|
||||
<div id="runningScreen" style="display: none">
|
||||
<label for="peerID">Your peer ID:</label>
|
||||
<span id="peerID"></span>
|
||||
<br />
|
||||
<label for="numSent">Messages Sent:</label>
|
||||
<span id="numSent">0</span>
|
||||
<br />
|
||||
<label for="numReceived">Messages Received:</label>
|
||||
<span id="numReceived">0</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="container">
|
||||
<div id="sender">
|
||||
<h3>Sent</h3>
|
||||
<div id="messagesSent"></div>
|
||||
</div>
|
||||
<div id="receiver">
|
||||
<h3>Received</h3>
|
||||
<div id="messagesReceived"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
3
dogfooding/index.js
Normal file
55
dogfooding/index.js.LICENSE.txt
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* [hi-base32]{@link https://github.com/emn178/hi-base32}
|
||||
*
|
||||
* @version 0.5.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2015-2018
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Copyright (c) 2014, GMO GlobalSign
|
||||
* Copyright (c) 2015-2022, Peculiar Ventures
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author 2014-2019, Yury Strozhevsky
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||
|
||||
/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
|
||||
|
||||
/**
|
||||
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
||||
*
|
||||
* @version 0.9.3
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2015-2023
|
||||
* @license MIT
|
||||
*/
|
||||
1
dogfooding/index.js.map
Normal file
19
dogfooding/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Sent Received Message Ratio",
|
||||
"description": "Example meant to run across two browsers to test ratio of messages sent to messages received",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
13
experimental/light-js/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Using Waku Light Push and Filter in JavaScript
|
||||
|
||||
**Demonstrates**:
|
||||
|
||||
- Waku Light node: Waku Filter + Waku Light Push
|
||||
- Pure Javascript/HTML.
|
||||
- Use minified bundle of js from unpkg.com, no import, no package manager.
|
||||
|
||||
This example uses Waku Filter to listen to messages and Waku Light Push to send messages.
|
||||
|
||||
To test the example, simply download the `index.html` file from this folder and open it in a browser.
|
||||
|
||||
The `master` branch's HEAD is deployed at https://lab.waku.org/light-js/.
|
||||
BIN
experimental/light-js/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/light-js/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
284
experimental/light-js/index.html
Normal file
@ -0,0 +1,284 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>JS-Waku light node example</title>
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<h2>Status</h2>
|
||||
</div>
|
||||
<div id="status"></div>
|
||||
|
||||
<div>
|
||||
<h2>Local Peer Id</h2>
|
||||
</div>
|
||||
<div id="peer-id"></div>
|
||||
|
||||
<div>
|
||||
<h2>Select Peer</h2>
|
||||
</div>
|
||||
<div>
|
||||
<button id="getPeersButton" type="button">Refresh Peers</button>
|
||||
<select id="peer-select">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="remote-multiaddr">Remote peer's multiaddr</label>
|
||||
</div>
|
||||
<div style="margin-right: 1em">
|
||||
<input
|
||||
id="remote-multiaddr"
|
||||
type="text"
|
||||
value=""
|
||||
style="width: 100%; max-width: 900px"
|
||||
/>
|
||||
</div>
|
||||
<button disabled id="dial" type="button">Dial</button>
|
||||
|
||||
<div>
|
||||
<h2>Remote Peers</h2>
|
||||
</div>
|
||||
<div id="remote-peer-id"></div>
|
||||
<br />
|
||||
<button disabled id="subscribe" type="button">Subscribe with Filter</button>
|
||||
<button disabled id="unsubscribe" type="button">
|
||||
Unsubscribe with Filter
|
||||
</button>
|
||||
<br />
|
||||
<label for="textInput">Message text</label>
|
||||
<input id="textInput" placeholder="Type your message here" type="text" />
|
||||
<button disabled id="sendButton" type="button">
|
||||
Send message using Light Push
|
||||
</button>
|
||||
<br />
|
||||
<div id="messages"></div>
|
||||
|
||||
<div>
|
||||
<h2>Store</h2>
|
||||
</div>
|
||||
<button disabled id="queryStoreButton" type="button">
|
||||
Retrieve past messages
|
||||
</button>
|
||||
|
||||
<script src="https://unpkg.com/@multiformats/multiaddr@12.1.1/dist/index.min.js"></script>
|
||||
<script type="module">
|
||||
import {
|
||||
createLightNode,
|
||||
waitForRemotePeer,
|
||||
createEncoder,
|
||||
createDecoder,
|
||||
utf8ToBytes,
|
||||
bytesToUtf8,
|
||||
} from "https://unpkg.com/@waku/sdk@0.0.25/bundle/index.js";
|
||||
import {
|
||||
enrTree,
|
||||
DnsNodeDiscovery,
|
||||
wakuDnsDiscovery,
|
||||
} from "https://unpkg.com/@waku/discovery@0.0.2/bundle/index.js";
|
||||
import { messageHash } from "https://unpkg.com/@waku/message-hash@0.1.13/bundle/index.js";
|
||||
|
||||
const peerIdDiv = document.getElementById("peer-id");
|
||||
const remotePeerIdDiv = document.getElementById("remote-peer-id");
|
||||
const statusDiv = document.getElementById("status");
|
||||
const remoteMultiAddrDiv = document.getElementById("remote-multiaddr");
|
||||
const dialButton = document.getElementById("dial");
|
||||
const subscribeButton = document.getElementById("subscribe");
|
||||
const unsubscribeButton = document.getElementById("unsubscribe");
|
||||
const queryStoreButton = document.getElementById("queryStoreButton");
|
||||
const messagesDiv = document.getElementById("messages");
|
||||
const textInput = document.getElementById("textInput");
|
||||
const sendButton = document.getElementById("sendButton");
|
||||
const getPeersButton = document.getElementById("getPeersButton");
|
||||
const peersSelector = document.getElementById("peer-select");
|
||||
|
||||
const ContentTopic = "/js-waku-examples/1/chat/utf8";
|
||||
const decoder = createDecoder(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;
|
||||
|
||||
const updateMessages = (msgs, div) => {
|
||||
div.innerHTML = "<ul>";
|
||||
Object.values(msgs)
|
||||
.sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime())
|
||||
.forEach(
|
||||
(msg) =>
|
||||
(div.innerHTML +=
|
||||
"<li>" + `${msg.text} - ${msg.timestamp}` + "</li>")
|
||||
);
|
||||
div.innerHTML += "</ul>";
|
||||
};
|
||||
|
||||
try {
|
||||
await getPeers();
|
||||
} catch (e) {
|
||||
console.log("Failed to find a peer", e);
|
||||
remoteMultiAddrDiv.value =
|
||||
"/dns4/node-01.do-ams3.waku.test.statusim.net/tcp/8000/wss/p2p/16Uiu2HAkykgaECHswi3YKJ5dMLbq2kPVCo89fcyTd38UcQD6ej5W";
|
||||
}
|
||||
|
||||
statusDiv.innerHTML = "<p>Creating Waku node.</p>";
|
||||
const node = await createLightNode({
|
||||
contentTopics: [ContentTopic],
|
||||
defaultBootstrap: true,
|
||||
});
|
||||
|
||||
statusDiv.innerHTML = "<p>Starting Waku node.</p>";
|
||||
await node.start();
|
||||
|
||||
window.waku = node;
|
||||
console.info(
|
||||
"Use window.waku to access the waku node running in the browser directly through the console."
|
||||
);
|
||||
|
||||
// Queries all peers from libp2p peer store and updates list of connected peers
|
||||
const updatePeersList = async () => {
|
||||
// Generate <p> element with connection string from each peer
|
||||
const peers = await node.libp2p.peerStore.all();
|
||||
const peerIdElements = peers.map((peer) => {
|
||||
const element = document.createElement("p");
|
||||
element.textContent = `${peer.addresses[1].multiaddr}/p2p/${peer.id}`;
|
||||
return element;
|
||||
});
|
||||
// Update elements displaying list of peers
|
||||
remotePeerIdDiv.replaceChildren(...peerIdElements);
|
||||
};
|
||||
|
||||
// Refreshes list of connected peers each time a new one is detected
|
||||
node.store.protocol.addLibp2pEventListener("peer:connect", async (event) => {
|
||||
const peerId = event.detail;
|
||||
console.log(`Peer connected with peer id: ${peerId}`);
|
||||
// Wait half a second after receiving event for peer to show up in peer store
|
||||
setTimeout(async () => {
|
||||
updatePeersList();
|
||||
}, 500);
|
||||
|
||||
// Update status
|
||||
statusDiv.innerHTML = `<p>Peer dialed: ${peerId}</p>`;
|
||||
// Enable send and subscribe inputs as we are now connected to a peer
|
||||
textInput.disabled = false;
|
||||
sendButton.disabled = false;
|
||||
subscribeButton.disabled = false;
|
||||
queryStoreButton.disabled = false;
|
||||
});
|
||||
|
||||
statusDiv.innerHTML = "<p>Waku node started.</p>";
|
||||
peerIdDiv.innerHTML = "<p>" + node.libp2p.peerId.toString() + "</p>";
|
||||
dialButton.disabled = false;
|
||||
|
||||
dialButton.onclick = async () => {
|
||||
const ma = remoteMultiAddrDiv.value;
|
||||
if (!ma) {
|
||||
statusDiv.innerHTML = "<p>Error: No multiaddr provided.</p>";
|
||||
return;
|
||||
}
|
||||
statusDiv.innerHTML = "<p>Dialing peer.</p>";
|
||||
let multiaddr;
|
||||
try {
|
||||
multiaddr = MultiformatsMultiaddr.multiaddr(ma);
|
||||
} catch (err) {
|
||||
statusDiv.innerHTML = "<p>Error: invalid multiaddr provided</p>";
|
||||
throw err;
|
||||
}
|
||||
await node.dial(multiaddr, ["filter", "lightpush", "store"]);
|
||||
};
|
||||
|
||||
const messageReceivedCallback = (wakuMessage) => {
|
||||
// create a unique key for the message
|
||||
const msgHash =
|
||||
bytesToUtf8(messageHash(ContentTopic, wakuMessage)) +
|
||||
wakuMessage.proto.timestamp;
|
||||
const text = bytesToUtf8(wakuMessage.payload);
|
||||
// store message by its key
|
||||
messages[msgHash + wakuMessage.proto.timestamp] = {
|
||||
text,
|
||||
timestamp: wakuMessage.timestamp,
|
||||
};
|
||||
// call function to refresh display of messages
|
||||
updateMessages(messages, messagesDiv);
|
||||
};
|
||||
|
||||
subscribeButton.onclick = async () => {
|
||||
unsubscribe = await node.filter.subscribe(
|
||||
[decoder],
|
||||
messageReceivedCallback
|
||||
);
|
||||
unsubscribeButton.disabled = false;
|
||||
subscribeButton.disabled = true;
|
||||
};
|
||||
|
||||
queryStoreButton.onclick = async () => {
|
||||
await node.store.queryWithOrderedCallback(
|
||||
[decoder],
|
||||
messageReceivedCallback
|
||||
);
|
||||
};
|
||||
|
||||
unsubscribeButton.onclick = async () => {
|
||||
await unsubscribe();
|
||||
unsubscribe = undefined;
|
||||
unsubscribeButton.disabled = true;
|
||||
subscribeButton.disabled = false;
|
||||
};
|
||||
|
||||
sendButton.onclick = async () => {
|
||||
const text = textInput.value;
|
||||
|
||||
await node.lightPush.send(encoder, {
|
||||
payload: utf8ToBytes(text),
|
||||
});
|
||||
console.log("Message sent!");
|
||||
textInput.value = null;
|
||||
};
|
||||
|
||||
getPeersButton.onclick = async () => {
|
||||
await getPeers(statusDiv, remoteMultiAddrDiv);
|
||||
};
|
||||
|
||||
peersSelector.addEventListener("change", function (event) {
|
||||
remoteMultiAddrDiv.value = event.target.value;
|
||||
});
|
||||
|
||||
async function getPeers() {
|
||||
// Display status
|
||||
statusDiv.innerHTML = "<p>Discovering peers</p>";
|
||||
|
||||
// Clear all options in select element
|
||||
peersSelector.innerHTML = "";
|
||||
|
||||
// Get peers using DNS discovery
|
||||
const defaultNodeCount = 5;
|
||||
const dnsDiscovery = await DnsNodeDiscovery.dnsOverHttp();
|
||||
const peers = await dnsDiscovery.getPeers([enrTree["TEST"]], {
|
||||
relay: defaultNodeCount,
|
||||
store: defaultNodeCount,
|
||||
filter: defaultNodeCount,
|
||||
lightPush: defaultNodeCount,
|
||||
});
|
||||
|
||||
// Create an option element for each peer's multiaddr and append to select element
|
||||
const optionElements = peers.map((peer) => {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = `${peer.multiaddrs[1]}/p2p/${peer.peerId}`;
|
||||
optionElement.text = `${peer.multiaddrs[1]}/p2p/${peer.peerId}`;
|
||||
return optionElement;
|
||||
});
|
||||
peersSelector.append(...optionElements);
|
||||
|
||||
// Set first peer as selected
|
||||
peersSelector.options[0].selected = true;
|
||||
remoteMultiAddrDiv.value = peersSelector.options[0].value;
|
||||
|
||||
statusDiv.innerHTML = "<p>Peers discovered</p>";
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
19
experimental/light-js/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Light JS",
|
||||
"description": "Send messages between several users (or just one) using light client targeted protocols.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
BIN
experimental/noise-js/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/noise-js/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
200
experimental/noise-js/index.html
Normal file
@ -0,0 +1,200 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>Waku Noise</title>
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
min-width: 300px;
|
||||
max-width: 800px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-content: space-between;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h3:last-of-type {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h2 span,
|
||||
h3 span {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.progress {
|
||||
color: #9ea13b;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #3ba183;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #c84740;
|
||||
}
|
||||
|
||||
button.progress {
|
||||
color: white;
|
||||
background-color: #9ea13b;
|
||||
}
|
||||
|
||||
button.success {
|
||||
color: white;
|
||||
background-color: #3ba183;
|
||||
}
|
||||
|
||||
button.error {
|
||||
color: white;
|
||||
background-color: #c84740;
|
||||
}
|
||||
|
||||
.pairingInfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pairingInfo input {
|
||||
display: block;
|
||||
min-width: 250px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.5rem;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pairingInfo button {
|
||||
flex-grow: 1;
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.pairingInfo button + button {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.chatArea {
|
||||
}
|
||||
|
||||
.chatArea ul {
|
||||
margin-bottom: 30px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.chatArea ul li + li {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.chatArea div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.chatArea div > * {
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.5rem;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="status">
|
||||
<h3>
|
||||
<b>Waku Node Status:</b> <span id="waku-status">connecting...</span>
|
||||
</h3>
|
||||
<h3 id="handshake-span">
|
||||
<b>Handshake Status:</b>
|
||||
<span id="handshake-status" class="progress">waiting for waku</span>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="pairingInfo" id="qr-url-container" style="display: none">
|
||||
<h2>Pairing information</h2>
|
||||
<input
|
||||
type="text"
|
||||
id="qr-url"
|
||||
readonly
|
||||
placeholder="generating URL..."
|
||||
/>
|
||||
<div>
|
||||
<button id="copy-url" style="width: 100px">Copy URL</button>
|
||||
<button id="open-tab" style="width: 150px">Open in new tab</button>
|
||||
</div>
|
||||
<canvas id="qr-canvas"></canvas>
|
||||
</div>
|
||||
|
||||
<div class="chatArea" id="chat-area" style="display: none">
|
||||
<h2>Chat</h2>
|
||||
<ul id="messages"></ul>
|
||||
|
||||
<div>
|
||||
<input id="nick-input" placeholder="Choose a nickname" type="text" />
|
||||
<textarea
|
||||
id="text-input"
|
||||
placeholder="Type your message here"
|
||||
type="text"
|
||||
></textarea>
|
||||
<button id="send-btn" type="button" disabled>Send message</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>
|
||||
NOTICE: you can try also try to pair your browser with a
|
||||
<a href="https://github.com/waku-org/go-waku/tree/master/examples/noise"
|
||||
>go-waku based node</a
|
||||
>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
9618
experimental/noise-js/index.js
Normal file
19
experimental/noise-js/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Waku Noise",
|
||||
"description": "Example showing Waku noise capabilities.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
BIN
experimental/noise-rtc/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/noise-rtc/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
198
experimental/noise-rtc/index.html
Normal file
@ -0,0 +1,198 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>Waku NoiseRTC</title>
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
min-width: 300px;
|
||||
max-width: 800px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-content: space-between;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h3:last-of-type {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h2 span,
|
||||
h3 span {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.progress {
|
||||
color: #9ea13b;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #3ba183;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #c84740;
|
||||
}
|
||||
|
||||
button.progress {
|
||||
color: white;
|
||||
background-color: #9ea13b;
|
||||
}
|
||||
|
||||
button.success {
|
||||
color: white;
|
||||
background-color: #3ba183;
|
||||
}
|
||||
|
||||
button.error {
|
||||
color: white;
|
||||
background-color: #c84740;
|
||||
}
|
||||
|
||||
.pairingInfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pairingInfo input {
|
||||
display: block;
|
||||
min-width: 250px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.5rem;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pairingInfo button {
|
||||
flex-grow: 1;
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.pairingInfo button + button {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.chatArea {
|
||||
}
|
||||
|
||||
.chatArea ul {
|
||||
margin-bottom: 30px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.chatArea ul li + li {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.chatArea div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.chatArea div > * {
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.5rem;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="status">
|
||||
<h3>
|
||||
<b>Waku Node Status:</b>
|
||||
<span id="waku-status" class="progress">connecting...</span>
|
||||
</h3>
|
||||
<h3 id="handshake-span">
|
||||
<b>Handshake Status:</b>
|
||||
<span id="handshake-status" class="progress">waiting for waku</span>
|
||||
</h3>
|
||||
<h3>
|
||||
<b>RTC Status:</b>
|
||||
<span id="rtc-status" class="progress"
|
||||
>waiting for noise to be established</span
|
||||
>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="pairingInfo" id="qr-url-container" style="display: none">
|
||||
<h2>Pairing information</h2>
|
||||
<input
|
||||
type="text"
|
||||
id="qr-url"
|
||||
readonly
|
||||
placeholder="generating URL..."
|
||||
/>
|
||||
<div>
|
||||
<button id="copy-url" style="width: 100px">Copy URL</button>
|
||||
<button id="open-tab" style="width: 100px">Open in new</button>
|
||||
</div>
|
||||
<canvas id="qr-canvas"></canvas>
|
||||
</div>
|
||||
|
||||
<div class="chatArea" id="chat-area" style="display: none">
|
||||
<h2>Chat</h2>
|
||||
<ul id="messages"></ul>
|
||||
|
||||
<div>
|
||||
<input id="nick-input" placeholder="Choose a nickname" type="text" />
|
||||
<textarea
|
||||
id="text-input"
|
||||
placeholder="Type your message here"
|
||||
type="text"
|
||||
></textarea>
|
||||
<button id="send-btn" type="button" disabled>Send message</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
9618
experimental/noise-rtc/index.js
Normal file
19
experimental/noise-rtc/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Waku NoiseRTC",
|
||||
"description": "Example showing WebRTC with Waku Noise.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
BIN
experimental/relay-direct-rtc/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/relay-direct-rtc/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
73
experimental/relay-direct-rtc/index.html
Normal file
@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>Relay direct chat</title>
|
||||
<link rel="stylesheet" href="./style.css" />
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<h3>Status: <span id="status"></span></h3>
|
||||
|
||||
<h4><label for="remoteNode">Remote node multiaddr</label></h4>
|
||||
<div>
|
||||
<input
|
||||
id="remoteNode"
|
||||
value="/dns4/node-01.ac-cn-hongkong-c.go-waku.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAm1fVVprL9EaDpDw4frNX3CPfZu5cBqhtk9Ncm6WCvprpv"
|
||||
/>
|
||||
<button id="connectRemoteNode">Dial</button>
|
||||
</div>
|
||||
|
||||
<h4><label for="webrtcPeer">WebRTC Peer</label></h4>
|
||||
<div>
|
||||
<input id="webrtcPeer" />
|
||||
<button id="connectWebrtcPeer">Dial</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button id="relayWebRTC">Ensure WebRTC Relay connection</button>
|
||||
<button id="dropNonWebRTC">Drop non WebRTC connections</button>
|
||||
</div>
|
||||
|
||||
<details open>
|
||||
<summary>Peer's information</summary>
|
||||
|
||||
<h4>Content topic</h4>
|
||||
<p id="contentTopic"></p>
|
||||
|
||||
<h4>Local Peer Id</h4>
|
||||
<p id="localPeerId"></p>
|
||||
|
||||
<h4>Remote Peer Id</h4>
|
||||
<p id="remotePeerId"></p>
|
||||
|
||||
<h4>Relay mesh's protocols</h4>
|
||||
<p id="relayMeshInfo"></p>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<div id="messages"></div>
|
||||
|
||||
<div class="footer">
|
||||
<div class="inputArea">
|
||||
<input type="text" id="nickText" placeholder="Nickname" />
|
||||
<textarea id="messageText" placeholder="Message"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="controls">
|
||||
<button id="send">Send</button>
|
||||
<button id="exit">Exit chat</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//cdn.jsdelivr.net/npm/protobufjs@7.X.X/dist/protobuf.min.js"></script>
|
||||
<script type="module" src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
14864
experimental/relay-direct-rtc/index.js
Normal file
19
experimental/relay-direct-rtc/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Relay direct chat",
|
||||
"description": "Send messages between several users (or just one) using Relay with direct WebRTC connection.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
185
experimental/relay-direct-rtc/style.css
Normal file
@ -0,0 +1,185 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
h3 + h4,
|
||||
div + h4,
|
||||
div + details,
|
||||
div + div {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.header div {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.header div input {
|
||||
min-width: 300px;
|
||||
min-height: 30px;
|
||||
width: 80%;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.header div button {
|
||||
min-width: 50px;
|
||||
min-height: 30px;
|
||||
width: 10%;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.header div button + button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
details {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
details p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
summary {
|
||||
cursor: pointer;
|
||||
max-width: 100%;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
span {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
input,
|
||||
textarea {
|
||||
line-height: 1rem;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
min-height: 3rem;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 800px;
|
||||
min-width: 300px;
|
||||
max-width: 800px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-content: space-between;
|
||||
}
|
||||
|
||||
#messages {
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.message + .message {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.message :first-child {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.message p + p {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.message span {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.inputArea {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.controls {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.controls button {
|
||||
flex-grow: 1;
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#send {
|
||||
background-color: #32d1a0;
|
||||
border: none;
|
||||
color: white;
|
||||
}
|
||||
#send:hover {
|
||||
background-color: #3abd96;
|
||||
}
|
||||
#send:active {
|
||||
background-color: #3ba183;
|
||||
}
|
||||
|
||||
#exit {
|
||||
color: white;
|
||||
border: none;
|
||||
background-color: #ff3a31;
|
||||
}
|
||||
#exit:hover {
|
||||
background-color: #e4423a;
|
||||
}
|
||||
#exit:active {
|
||||
background-color: #c84740;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #3ba183;
|
||||
}
|
||||
|
||||
.progress {
|
||||
color: #9ea13b;
|
||||
}
|
||||
|
||||
.terminated {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #c84740;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-self: flex-end;
|
||||
}
|
||||
13
experimental/relay-js/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Using Waku Relay in JavaScript
|
||||
|
||||
**Demonstrates**:
|
||||
|
||||
- Waku Relay: Send and receive messages using Waku Relay.
|
||||
- Pure Javascript/HTML.
|
||||
- Use minified bundle of js from unpkg.com, no import, no package manager.
|
||||
|
||||
This example uses Waku Relay to send and receive simple text messages.
|
||||
|
||||
To test the example, simply download the `index.html` file from this folder and open it in a browser.
|
||||
|
||||
The `master` branch's HEAD is deployed at https://lab.waku.org/relay-js/
|
||||
BIN
experimental/relay-js/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/relay-js/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
131
experimental/relay-js/index.html
Normal file
@ -0,0 +1,131 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>JS-Waku Chat</title>
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div><h1>Waku Node Status</h1></div>
|
||||
<div id="status"></div>
|
||||
|
||||
<label for="textInput">Message text</label>
|
||||
<input
|
||||
disabled
|
||||
id="textInput"
|
||||
placeholder="Type your message here"
|
||||
type="text"
|
||||
/>
|
||||
<button disabled id="sendButton" type="button">
|
||||
Send Message using Relay
|
||||
</button>
|
||||
|
||||
<div><h1>Messages</h1></div>
|
||||
<div id="messages"></div>
|
||||
|
||||
<script type="module">
|
||||
/**
|
||||
* Demonstrate usage of js-waku in the browser. Use relay, gossip sub protocol to send and receive messages.
|
||||
* Recommended payload is protobuf. Using simple utf-8 string for demo purposes only.
|
||||
*/
|
||||
|
||||
import {
|
||||
waitForRemotePeer,
|
||||
createDecoder,
|
||||
createEncoder,
|
||||
bytesToUtf8,
|
||||
utf8ToBytes,
|
||||
createRelayNode,
|
||||
} from "https://unpkg.com/@waku/sdk@0.0.18/bundle/index.js";
|
||||
|
||||
const statusDiv = document.getElementById("status");
|
||||
const messagesDiv = document.getElementById("messages");
|
||||
const textInput = document.getElementById("textInput");
|
||||
const sendButton = document.getElementById("sendButton");
|
||||
|
||||
// Every Waku Message has a content topic that categorizes it.
|
||||
// It is always encoded in clear text.
|
||||
// Recommendation: `/dapp-name/version/functionality/codec`
|
||||
// We recommend to use protobuf as codec (`proto`), this demo uses utf-8
|
||||
// for simplicity's sake.
|
||||
const contentTopic = "/js-waku-examples/1/chat/utf8";
|
||||
|
||||
// Prepare encoder and decoder, `V0` for clear text messages.
|
||||
|
||||
const encoder = createEncoder({ contentTopic });
|
||||
const decoder = createDecoder(contentTopic);
|
||||
|
||||
try {
|
||||
statusDiv.innerHTML = "<p>Starting</p>";
|
||||
|
||||
// Create and starts a Waku node.
|
||||
// `defaultBootstrap: true` bootstraps by connecting to pre-defined/hardcoded Waku nodes.
|
||||
// `emitSelf`: emits event of sent message to itself and invokes subscribers by it
|
||||
// We are currently working on migrating this method to DNS Discovery.
|
||||
//
|
||||
// https://js.waku.org/functions/lib_create_waku.createPrivacyNode.html
|
||||
const waku = await createRelayNode({
|
||||
emitSelf: true,
|
||||
defaultBootstrap: true,
|
||||
});
|
||||
await waku.start();
|
||||
|
||||
// Add a hook to process all incoming messages on a specified content topic.
|
||||
//
|
||||
// https://js.waku.org/classes/index.waku_relay.WakuRelay.html#addObserver
|
||||
waku.relay.subscribe(
|
||||
decoder,
|
||||
(message) => {
|
||||
// Checks there is a payload on the message.
|
||||
// Waku Message is encoded in protobuf, in proto v3 fields are always optional.
|
||||
//
|
||||
// https://js.waku.org/interfaces/index.proto_message.WakuMessage-1.html#payload
|
||||
if (!message.payload) return;
|
||||
|
||||
// Helper method to decode the payload to utf-8. A production dApp should
|
||||
// use `wakuMessage.payload` (Uint8Array) which enables encoding a data
|
||||
// structure of their choice.
|
||||
//
|
||||
// https://js.waku.org/functions/index.utils.bytesToUtf8.html
|
||||
const text = bytesToUtf8(message.payload);
|
||||
messagesDiv.innerHTML =
|
||||
`<p>${text}</p><br />` + messagesDiv.innerHTML;
|
||||
},
|
||||
[contentTopic]
|
||||
);
|
||||
|
||||
statusDiv.innerHTML = "<p>Connecting to a peer</p>";
|
||||
|
||||
// Best effort method that waits for the Waku node to be connected to remote
|
||||
// waku nodes (peers) and for appropriate handshakes to be done.
|
||||
//
|
||||
// https://js.waku.org/functions/lib_wait_for_remote_peer.waitForRemotePeer.html
|
||||
await waitForRemotePeer(waku);
|
||||
|
||||
// We are now connected to a remote peer, let's define the `sendMessage`
|
||||
// function that sends the text input over Waku Relay, the gossipsub
|
||||
// protocol.
|
||||
sendButton.onclick = async () => {
|
||||
const payload = utf8ToBytes(textInput.value);
|
||||
await waku.relay.send(encoder, { payload });
|
||||
console.log("Message sent!");
|
||||
|
||||
// Reset the text input.
|
||||
textInput.value = null;
|
||||
};
|
||||
|
||||
// Ready to send & receive messages, enable text input.
|
||||
textInput.disabled = false;
|
||||
sendButton.disabled = false;
|
||||
statusDiv.innerHTML = "<p>Ready!</p>";
|
||||
} catch (e) {
|
||||
statusDiv.innerHTML = "Failed to start application";
|
||||
console.log(e);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
19
experimental/relay-js/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Relay JS",
|
||||
"description": "This example uses Waku Relay to send and receive simple text messages.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
BIN
experimental/rln-identity/290a37f49b5702f8afb9.zkey
Normal file
BIN
experimental/rln-identity/aa9201d05fdde7a5e4ca.wasm
Normal file
BIN
experimental/rln-identity/b4248102cd3e41a57413.wasm
Normal file
BIN
experimental/rln-identity/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/rln-identity/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
206
experimental/rln-identity/index.html
Normal file
@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>RLN Credential management</title>
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
min-width: 300px;
|
||||
max-width: 800px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-content: space-between;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h3:last-of-type {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h2 span,
|
||||
h3 span {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.progress {
|
||||
color: #9ea13b;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #3ba183;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #c84740;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
select {
|
||||
padding: 0.5rem;
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
button.progress {
|
||||
color: white;
|
||||
background-color: #9ea13b;
|
||||
}
|
||||
|
||||
button.success {
|
||||
color: white;
|
||||
background-color: #3ba183;
|
||||
}
|
||||
|
||||
button.error {
|
||||
color: white;
|
||||
background-color: #c84740;
|
||||
}
|
||||
|
||||
.mb-1 {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.mb-2 {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.mb-3 {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
.mt-1 {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.block {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="status">
|
||||
<h3>
|
||||
<b>Status:</b>
|
||||
<span id="status" class="progress">Starting...</span>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="block mb-1">
|
||||
<h2>Wallet</h2>
|
||||
<button id="connect">Connect</button>
|
||||
</div>
|
||||
|
||||
<div class="block mb-1">
|
||||
<h2>Keystore</h2>
|
||||
<div>
|
||||
<button id="import">Import</button>
|
||||
<input id="import-file" class="hidden" type="file" />
|
||||
<button id="export">Export</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<h3 class="mt-1">Existing credentials</h3>
|
||||
|
||||
<div class="block mb-2">
|
||||
<select id="keystore"></select>
|
||||
<div>
|
||||
<input id="password" placeholder="password" />
|
||||
<button id="read-credential">Read</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block mb-3">
|
||||
<h3>Create new (will use the password)</h3>
|
||||
<button id="register-new">Register</button>
|
||||
</div>
|
||||
|
||||
<div id="current-credentials">
|
||||
<div class="block mb-1">
|
||||
<p>Keystore hash</p>
|
||||
<code>none</code>
|
||||
</div>
|
||||
|
||||
<div class="block mb-1">
|
||||
<p>Membership ID</p>
|
||||
<code>none</code>
|
||||
</div>
|
||||
|
||||
<div class="block mb-1">
|
||||
<p>Secret Hash</p>
|
||||
<code>none</code>
|
||||
</div>
|
||||
|
||||
<div class="block mb-1">
|
||||
<p>Commitment</p>
|
||||
<code>none</code>
|
||||
</div>
|
||||
|
||||
<div class="block mb-1">
|
||||
<p>Nullifier</p>
|
||||
<code>none</code>
|
||||
</div>
|
||||
|
||||
<div class="block mb-1">
|
||||
<p>Trapdoor</p>
|
||||
<code>none</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
6214
experimental/rln-identity/index.js
Normal file
19
experimental/rln-identity/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Waku RLN",
|
||||
"description": "Example showing Waku RLN credential management.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
BIN
experimental/rln-js/290a37f49b5702f8afb9.zkey
Normal file
BIN
experimental/rln-js/aa9201d05fdde7a5e4ca.wasm
Normal file
BIN
experimental/rln-js/b4248102cd3e41a57413.wasm
Normal file
BIN
experimental/rln-js/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/rln-js/favicon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
186
experimental/rln-js/index.html
Normal file
@ -0,0 +1,186 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
<title>RLN Chat</title>
|
||||
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<link rel="icon" href="./favicon.ico" />
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
min-width: 300px;
|
||||
max-width: 800px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-content: space-between;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h3:last-of-type {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h2 span,
|
||||
h3 span {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.progress {
|
||||
color: #9ea13b;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #3ba183;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #c84740;
|
||||
}
|
||||
|
||||
button.progress {
|
||||
color: white;
|
||||
background-color: #9ea13b;
|
||||
}
|
||||
|
||||
button.success {
|
||||
color: white;
|
||||
background-color: #3ba183;
|
||||
}
|
||||
|
||||
button.error {
|
||||
color: white;
|
||||
background-color: #c84740;
|
||||
}
|
||||
|
||||
.pairingInfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pairingInfo input {
|
||||
display: block;
|
||||
min-width: 250px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.5rem;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pairingInfo button {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.pairingInfo button + button {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.chatArea {
|
||||
}
|
||||
|
||||
.chatArea ul {
|
||||
margin-bottom: 30px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.chatArea ul li + li {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.chatArea div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.chatArea div > * {
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.5rem;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.mb-1 {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="status">
|
||||
<h3>
|
||||
<b>Status:</b>
|
||||
<span id="status" class="progress">Starting...</span>
|
||||
</h3>
|
||||
<button id="connect" class="mb-1">Connect wallet</button>
|
||||
</div>
|
||||
|
||||
<div class="chatArea" id="chat-area" style="display: none">
|
||||
<h2>Chat</h2>
|
||||
<ul id="messages"></ul>
|
||||
|
||||
<div>
|
||||
<input id="nick" placeholder="Choose a nickname" type="text" />
|
||||
<textarea
|
||||
id="text"
|
||||
placeholder="Type your message here"
|
||||
type="text"
|
||||
></textarea>
|
||||
<button id="send" type="button">Send message</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
16209
experimental/rln-js/index.js
Normal file
19
experimental/rln-js/manifest.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Waku RLN",
|
||||
"description": "Example showing Waku RLN capabilities.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"display": "standalone",
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
13
experimental/web-chat/asset-manifest.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/web-chat/static/css/main.4df59f7b.css",
|
||||
"main.js": "/web-chat/static/js/main.547d0ff0.js",
|
||||
"index.html": "/web-chat/index.html",
|
||||
"main.4df59f7b.css.map": "/web-chat/static/css/main.4df59f7b.css.map",
|
||||
"main.547d0ff0.js.map": "/web-chat/static/js/main.547d0ff0.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.4df59f7b.css",
|
||||
"static/js/main.547d0ff0.js"
|
||||
]
|
||||
}
|
||||
BIN
experimental/web-chat/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
experimental/web-chat/favicon.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
1
experimental/web-chat/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><meta name="description" content="Chat app powered by js-waku"/><link rel="manifest" href="/web-chat/manifest.json"/><link rel="apple-touch-icon" href="/web-chat/favicon.png"/><link rel="icon" href="/web-chat/favicon.ico"/><title>Waku v2 chat app</title><script defer="defer" src="/web-chat/static/js/main.547d0ff0.js"></script><link href="/web-chat/static/css/main.4df59f7b.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
20
experimental/web-chat/manifest.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"short_name": "Waku v2 Chat",
|
||||
"name": "Chat app powered by js-waku",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
3
experimental/web-chat/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
4
experimental/web-chat/static/css/main.4df59f7b.css
Normal file
1
experimental/web-chat/static/css/main.4df59f7b.css.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"static/css/main.4df59f7b.css","mappings":"AAAA;;CAAc,CAAd,uCAAc,CAAd,qBAAc,CAAd,8BAAc,CAAd,wCAAc,CAAd,4BAAc,CAAd,uCAAc,CAAd,gHAAc,CAAd,8BAAc,CAAd,eAAc,CAAd,UAAc,CAAd,wBAAc,CAAd,QAAc,CAAd,uBAAc,CAAd,aAAc,CAAd,QAAc,CAAd,4DAAc,CAAd,gCAAc,CAAd,mCAAc,CAAd,mBAAc,CAAd,eAAc,CAAd,uBAAc,CAAd,2BAAc,CAAd,8CAAc,CAAd,mGAAc,CAAd,aAAc,CAAd,8BAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,aAAc,CAAd,iBAAc,CAAd,sBAAc,CAAd,iBAAc,CAAd,aAAc,CAAd,8BAAc,CAAd,oBAAc,CAAd,aAAc,CAAd,mEAAc,CAAd,aAAc,CAAd,mBAAc,CAAd,cAAc,CAAd,+BAAc,CAAd,mBAAc,CAAd,sBAAc,CAAd,mBAAc,CAAd,QAAc,CAAd,SAAc,CAAd,iCAAc,CAAd,gHAAc,CAAd,wBAAc,CAAd,qBAAc,CAAd,4BAAc,CAAd,gCAAc,CAAd,+BAAc,CAAd,mEAAc,CAAd,0CAAc,CAAd,mBAAc,CAAd,mDAAc,CAAd,sDAAc,CAAd,YAAc,CAAd,yBAAc,CAAd,2DAAc,CAAd,iBAAc,CAAd,yBAAc,CAAd,0BAAc,CAAd,QAAc,CAAd,SAAc,CAAd,gBAAc,CAAd,wBAAc,CAAd,sDAAc,CAAd,SAAc,CAAd,mCAAc,CAAd,wBAAc,CAAd,4DAAc,CAAd,qBAAc,CAAd,qBAAc,CAAd,cAAc,CAAd,qBAAc,CAAd,wCAAc,CAAd,uBAAc,CAAd,kBAAc,CAAd,kBAAc,CAAd,aAAc,CAAd,aAAc,CAAd,aAAc,CAAd,cAAc,CAAd,cAAc,CAAd,YAAc,CAAd,YAAc,CAAd,iBAAc,CAAd,qCAAc,CAAd,6BAAc,CAAd,4BAAc,CAAd,2BAAc,CAAd,cAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,sBAAc,CAAd,uBAAc,CAAd,iBAAc,CAAd,0BAAc,CAAd,2BAAc,CAAd,yBAAc,CAAd,iCAAc,CAAd,0BAAc,CAAd,qBAAc,CAAd,6BAAc,CAAd,WAAc,CAAd,iBAAc,CAAd,eAAc,CAAd,gBAAc,CAAd,iBAAc,CAAd,aAAc,CAAd,eAAc,CAAd,YAAc,CAAd,kBAAc,CAAd,oBAAc,CAAd,0BAAc,CAAd,wBAAc,CAAd,yBAAc,CAAd,0BAAc,CAAd,sBAAc,CAAd,uBAAc,CAAd,wBAAc,CAAd,qBAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,oBAAc,CAAd,oBAAc,CAAd,kCAAc,CAAd,uBAAc,CAAd,kBAAc,CAAd,kBAAc,CAAd,aAAc,CAAd,aAAc,CAAd,aAAc,CAAd,cAAc,CAAd,cAAc,CAAd,YAAc,CAAd,YAAc,CAAd,iBAAc,CAAd,qCAAc,CAAd,6BAAc,CAAd,4BAAc,CAAd,2BAAc,CAAd,cAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,sBAAc,CAAd,uBAAc,CAAd,iBAAc,CAAd,0BAAc,CAAd,2BAAc,CAAd,yBAAc,CAAd,iCAAc,CAAd,0BAAc,CAAd,qBAAc,CAAd,6BAAc,CAAd,WAAc,CAAd,iBAAc,CAAd,eAAc,CAAd,gBAAc,CAAd,iBAAc,CAAd,aAAc,CAAd,eAAc,CAAd,YAAc,CAAd,kBAAc,CAAd,oBAAc,CAAd,0BAAc,CAAd,wBAAc,CAAd,yBAAc,CAAd,0BAAc,CAAd,sBAAc,CAAd,uBAAc,CAAd,wBAAc,CAAd,qBAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,oBAAc,CAAd,oBAAc,CAEd,uBAAmB,CAAnB,sBAAmB,CAAnB,kBAAmB,CAAnB,oBAAmB,CAAnB,mBAAmB,CAAnB,sBAAmB,CAAnB,oBAAmB,CAAnB,sBAAmB,CAAnB,sCAAmB,CAAnB,+BAAmB,CAAnB,gCAAmB,CAAnB,8CAAmB,CAAnB,gCAAmB,CAAnB,8EAAmB,CAAnB,gFAAmB,CAAnB,wBAAmB,CAAnB,iCAAmB,CAAnB,sCAAmB,CAAnB,sDAAmB,CAAnB,sCAAmB,CAAnB,sDAAmB,CAAnB,8BAAmB,CAAnB,sDAAmB,CAAnB,8BAAmB,CAAnB,qDAAmB,CAAnB,8BAAmB,CAAnB,mDAAmB,CAAnB,kBAAmB,CAAnB,iBAAmB,CAAnB,uBAAmB,CAAnB,kBAAmB,CAAnB,4CAAmB,CAAnB,0BAAmB,CAAnB,mBAAmB,CAAnB,kCAAmB,CAAnB,6CAAmB,CAAnB,kCAAmB,CAAnB,0CAAmB,CAAnB,+BAAmB,CAAnB,6CAAmB,CAAnB,wLAAmB","sources":["index.css"],"sourcesContent":["@tailwind base;\n@tailwind components;\n@tailwind utilities;\n"],"names":[],"sourceRoot":""}
|
||||
3
experimental/web-chat/static/js/main.547d0ff0.js
Normal file
97
experimental/web-chat/static/js/main.547d0ff0.js.LICENSE.txt
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* [hi-base32]{@link https://github.com/emn178/hi-base32}
|
||||
*
|
||||
* @version 0.5.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2015-2018
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Copyright (c) 2014, GMO GlobalSign
|
||||
* Copyright (c) 2015-2022, Peculiar Ventures
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author 2014-2019, Yury Strozhevsky
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||
|
||||
/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
|
||||
|
||||
/**
|
||||
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
||||
*
|
||||
* @version 0.9.3
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2015-2023
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/** @license React v0.20.2
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
1
experimental/web-chat/static/js/main.547d0ff0.js.map
Normal file
1
flush-notes/404.html
Normal file
1
flush-notes/_next/static/chunks/149-4f27ed9900df2b44.js
Normal file
1
flush-notes/_next/static/chunks/472-7e789111541495c4.js
Normal file
52
flush-notes/_next/static/chunks/948-50bbf5866eb892b4.js
Normal file
1
flush-notes/_next/static/chunks/990-35c20412112b0913.js
Normal file
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[990],{4033:function(e,t,n){e.exports=n(94)},5136:function(e,t,n){"use strict";n.d(t,{UF:function(){return I},Mf:function(){return x},oQ:function(){return m}});var r=n(9746),i=n(5867),o=n(5210),a=n(9527),c=n(7761),s=n(4755),u=n(9710),l=n(6398);let f={keySize:32,ivSize:12,algorithm:{name:"AES-GCM",length:128}},y=BigInt(1e6),h={node:c,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0};function p(){if(h.web)return h.web.subtle;if(h.node)return h.node.webcrypto.subtle;throw Error("The environment doesn't have Crypto Subtle API (if in the browser, be sure to use to be in a secure context, ie, https)")}let d=s.P6.randomBytes;function m(){return d(f.keySize)}async function g(e,t){let[n,r]=await s.Xx(e,t,{recovered:!0,der:!1});return(0,u.zo)([n,new Uint8Array([r])],n.length+1)}function w(e){return new Uint8Array(l.keccak256.arrayBuffer(e))}s.P6.sha256,s.$3;var b=n(1363);class v extends r.lY{signature;signaturePublicKey;_decodedPayload;constructor(e,t,n,r,i){super(e,t),this.signature=r,this.signaturePublicKey=i,this._decodedPayload=n}get payload(){return this._decodedPayload}verifySignature(e){return!!this.signaturePublicKey&&(0,b.f)(this.signaturePublicKey,e)}}async function P(e,t,n){return p().importKey("raw",t,f.algorithm,!1,["encrypt"]).then(t=>p().encrypt({iv:e,...f.algorithm},t,n)).then(e=>new Uint8Array(e))}async function K(e,t,n){return p().importKey("raw",t,f.algorithm,!1,["decrypt"]).then(t=>p().decrypt({iv:e,...f.algorithm},t,n)).then(e=>new Uint8Array(e))}async function z(e,t){let n=d(f.ivSize),r=await P(n,(0,u.nr)(t),e);return(0,u.zo)([r,n])}async function T(e,t){let n=e.length-f.ivSize,r=e.slice(0,n),i=e.slice(n);return K(i,(0,u.nr)(t),r)}function S(e){let t=1;for(let n=e.length;n>=256;n/=256)t++;return t}async function U(e,t){let n=new Uint8Array([0]);n=function(e,t){let n=S(t),r=new Uint8Array(4),i=new DataView(r.buffer);return i.setUint32(0,t.length,!0),r=r.slice(0,n),e=(0,u.zo)([e,r]),e[0]|=n,e}(n,e),n=(0,u.zo)([n,e]);let r=1+S(e)+e.length;t&&(r+=65);let i=r%256,o=256-i,a=d(o);if(a.length!==o||!(o<=3)&&-1===a.findIndex(e=>0!==e))throw Error("failed to generate random padding of size "+o);if(n=(0,u.zo)([n,a]),t){n[0]|=4;let e=w(n),r=await g(e,t);n=(0,u.zo)([n,r])}return n}let A=new a.Yd("message-encryption:symmetric");class k{pubsubTopic;contentTopic;symKey;sigPrivKey;ephemeral;metaSetter;constructor(e,t,n,r,i=!1,o){if(this.pubsubTopic=e,this.contentTopic=t,this.symKey=n,this.sigPrivKey=r,this.ephemeral=i,this.metaSetter=o,!t||""===t)throw Error("Content topic must be specified")}async toWire(e){let t=await this.toProtoObj(e);if(t)return o.HE.encode(t)}async toProtoObj(e){let t=e.timestamp??new Date,n=await U(e.payload,this.sigPrivKey),r=await z(n,this.symKey),i={payload:r,version:1,contentTopic:this.contentTopic,timestamp:BigInt(t.valueOf())*y,meta:void 0,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){let e=this.metaSetter(i);return{...i,meta:e}}return i}}function x({pubsubTopic:e=i.nf,pubsubTopicShardInfo:t,contentTopic:n,symKey:r,sigPrivKey:o,ephemeral:c=!1,metaSetter:s}){return new k((0,a.IY)(n,e??t),n,r,o,c,s)}class E extends r.h{symKey;constructor(e,t,n){super(e,t),this.symKey=n}async fromProtoObj(e,t){let n;let r=t.payload;if(1!==t.version){A.error("Failed to decrypt due to incorrect version, expected:",1,", actual:",t.version);return}try{n=await T(r,this.symKey)}catch(e){A.error(`Failed to decrypt message using asymmetric decryption for contentTopic: ${this.contentTopic}`,e);return}if(!n){A.error(`Failed to decrypt payload for contentTopic ${this.contentTopic}`);return}let i=function(e){let t;let n=function(e){let t=new DataView(e.buffer);return 3&t.getUint8(0)}(e);if(0===n)return;let r=function(e,t){let n=e.slice(1,1+t);t<4&&(n=(0,u.zo)([n,new Uint8Array(4-t)],4));let r=new DataView(n.buffer);return r.getInt32(0,!0)}(e,n),i=1+n,o=e.slice(i,i+r),a=function(e){let t=new DataView(e.buffer);return(4&t.getUint8(0))==4}(e);if(a){let n=e.slice(e.length-65,e.length),r=a?w(e.slice(0,e.length-65)):w(e),i=function(e,t){let n=new DataView(t.slice(64).buffer),r=n.getUint8(0),i=s.Pc.fromCompact(t.slice(0,64));return s.LO(e,i,r,!1)}(r,n);t={signature:n,publicKey:i}}return{payload:o,sig:t}}(n);if(!i){A.error(`Failed to decode payload for contentTopic ${this.contentTopic}`);return}return A.info("Message decrypted",t),new v(e,t,i.payload,i.sig?.signature,i.sig?.publicKey)}}function I(e,t,n=i.nf){return new E((0,a.IY)(e,n),e,t)}}}]);
|
||||
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{3155:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_not-found",function(){return n(1038)}])},1038:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let l=n(1024),r=l._(n(2265)),o={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},desc:{display:"inline-block"},h1:{display:"inline-block",margin:"0 20px 0 0",padding:"0 23px 0 0",fontSize:24,fontWeight:500,verticalAlign:"top",lineHeight:"49px"},h2:{fontSize:14,fontWeight:400,lineHeight:"49px",margin:0}};function i(){return r.default.createElement(r.default.Fragment,null,r.default.createElement("title",null,"404: This page could not be found."),r.default.createElement("div",{style:o.error},r.default.createElement("div",null,r.default.createElement("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}),r.default.createElement("h1",{className:"next-error-h1",style:o.h1},"404"),r.default.createElement("div",{style:o.desc},r.default.createElement("h2",{style:o.h2},"This page could not be found.")))))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},function(e){e.O(0,[971,472,744],function(){return e(e.s=3155)}),_N_E=e.O()}]);
|
||||
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{5856:function(){},2678:function(){},5819:function(){},4112:function(){},8080:function(t,i,e){Promise.resolve().then(e.bind(e,5685))},5685:function(t,i,e){"use strict";e.r(i),e.d(i,{default:function(){return h}});var n=e(7437),s=e(1654),r=e.n(s),a=e(2265),u=e(7441),l=e(1177),o=e(6309);let c=a.createContext({status:l.c.Initializing,waku:void 0}),d=t=>{let i=a.useRef(),[e,s]=a.useState(l.c.Initializing);return(a.useEffect(()=>{if(i.current)return;let t=t=>{s(t.detail)};return u.H5.addEventListener(u.J9.Status,t),u.H5.init().then(()=>{i.current=u.H5}),()=>{u.H5.removeEventListener(u.J9.Status,t)}},[i,s]),e===l.c.Failed)?(0,n.jsx)(n.Fragment,{children:e}):e!==l.c.Connected?(0,n.jsx)(o.g,{}):(0,n.jsx)(c.Provider,{value:{status:e,waku:i.current},children:t.children})};function h(t){let{children:i}=t;return(0,n.jsxs)("html",{lang:"en",children:[(0,n.jsx)("title",{children:"Share notes"}),(0,n.jsx)("body",{className:r().className,children:(0,n.jsx)(d,{children:i})})]})}e(2489)},6309:function(t,i,e){"use strict";e.d(i,{g:function(){return s}});var n=e(7437);let s=()=>(0,n.jsx)("div",{className:"loading-block",children:(0,n.jsx)("p",{children:"Loading..."})})},1177:function(t,i,e){"use strict";var n,s;e.d(i,{c:function(){return n},m:function(){return r}});let r="/flush-notes/1/note/proto";(s=n||(n={})).Initializing="Initializing...",s.WaitingForPeers="Waiting for peers...",s.Connected="Connected",s.Failed="Failed to initialize(see logs)"},7441:function(t,i,e){"use strict";e.d(i,{H5:function(){return l},J9:function(){return n}});var n,s=e(1177),r=e(8089),a=e(9527);(n||(n={})).Status="status";class u{async init(){if(!this.initialized&&!this.initializing){this.initializing=!0;try{this.emitStatusEvent(s.c.Initializing),this.pubsubTopic=(0,a.L3)(s.m);let t=await (0,r.pq)({defaultBootstrap:!0,contentTopics:[s.m]});await t.start(),this.emitStatusEvent(s.c.WaitingForPeers),await (0,r.gT)(t,[r.Uw.Filter,r.Uw.LightPush,r.Uw.Store]),this.node=t,this.initialized=!0,this.emitStatusEvent(s.c.Connected)}catch(t){console.error("Failed to initialize Waku node:",t),this.emitStatusEvent(s.c.Failed)}this.initializing=!1}}addEventListener(t,i){return this.emitter.addEventListener(t,i)}removeEventListener(t,i){return this.emitter.removeEventListener(t,i)}send(t,i){var e;return this.ensureWakuInitialized(),null===(e=this.node)||void 0===e?void 0:e.lightPush.send(t,i)}async getHistory(t){this.ensureWakuInitialized();let i=[];for await(let e of this.node.store.queryGenerator([t])){let t=await Promise.all(e),n=t.filter(t=>!!t);i=[...i,...n]}return i}async subscribe(t,i){return this.ensureWakuInitialized(),this.node.filter.subscribe(t,i)}emitStatusEvent(t){this.emitter.dispatchEvent(new CustomEvent("status",{detail:t}))}ensureWakuInitialized(){if(!l.initialized){let t="Waku is not initialized.";throw console.log(t),Error(t)}}constructor(){this.emitter=new EventTarget,this.initialized=!1,this.initializing=!1}}let l=new u},2489:function(){},1654:function(t){t.exports={style:{fontFamily:"'__Inter_36bd41', '__Inter_Fallback_36bd41'",fontStyle:"normal"},className:"__className_36bd41"}}},function(t){t.O(0,[948,971,472,744],function(){return t(t.s=8080)}),_N_E=t.O()}]);
|
||||
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{5856:function(){},7761:function(){},2678:function(){},5819:function(){},4112:function(){},7747:function(t,e,i){Promise.resolve().then(i.bind(i,5721))},5721:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(7437),s=i(2265),r=i(4033),a=i(7923);function o(){let t=(0,r.useRouter)(),{note:e,onNoteChange:i}=u(),s=async()=>{if(e)try{let{id:i,key:n}=await a.$.createNote(e);t.push("/view/".concat(i).concat("?key=".concat(n)))}catch(t){console.error("Failed to create a note:",t)}};return(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"note-info",children:"Your record will be stored for couple of days. Markdown is supported."}),(0,n.jsxs)("div",{className:"create-header",children:[(0,n.jsx)("div",{}),(0,n.jsx)("button",{onClick:s,className:"save-note",children:"Save note"})]}),(0,n.jsx)("textarea",{className:"note-value",value:e,onChange:i})]})}let u=()=>{let[t,e]=s.useState("");return{note:t,onNoteChange:t=>{var i;e(null==t?void 0:null===(i=t.currentTarget)||void 0===i?void 0:i.value)}}}},1177:function(t,e,i){"use strict";var n,s;i.d(e,{c:function(){return n},m:function(){return r}});let r="/flush-notes/1/note/proto";(s=n||(n={})).Initializing="Initializing...",s.WaitingForPeers="Waiting for peers...",s.Connected="Connected",s.Failed="Failed to initialize(see logs)"},7923:function(t,e,i){"use strict";i.d(e,{$:function(){return l}});var n=i(7441),s=i(1177),r=i(5136),a=i(8089),o=i(9710);class u{async createNote(t){var e;let i=(0,r.oQ)(),u=(0,r.Mf)({contentTopic:s.m,symKey:i,pubsubTopic:n.H5.pubsubTopic}),l=self.crypto.randomUUID();if(36!==l.length)throw"Unexpected uuid length";let c=await n.H5.send(u,{payload:(0,a.iY)(l+t)});return(null==c?void 0:null===(e=c.failures)||void 0===e?void 0:e.length)&&c.failures.length>0&&console.error("Failures when pushing note: ",c.failures.map(t=>t.error)),{id:l,key:(0,o.ci)(i)}}async readNote(t,e){await this.initMessages((0,o.nr)(e));let i=this.messages.map(t=>{try{let e=(0,a.Md)(t.payload),i=e.substring(0,36),n=e.substring(36);return{id:i,content:n}}catch(t){console.log("Failed to read message:",t)}}).find(e=>{if((null==e?void 0:e.id)===t)return!0});return null==i?void 0:i.content}async initMessages(t){if(this.subscription)return;let e=(0,r.UF)(s.m,t,n.H5.pubsubTopic);this.messages=await n.H5.getHistory(e),this.subscription=await n.H5.subscribe(e,t=>{this.messages.push(t)})}constructor(){this.messages=[]}}let l=new u},7441:function(t,e,i){"use strict";i.d(e,{H5:function(){return u},J9:function(){return n}});var n,s=i(1177),r=i(8089),a=i(9527);(n||(n={})).Status="status";class o{async init(){if(!this.initialized&&!this.initializing){this.initializing=!0;try{this.emitStatusEvent(s.c.Initializing),this.pubsubTopic=(0,a.L3)(s.m);let t=await (0,r.pq)({defaultBootstrap:!0,contentTopics:[s.m]});await t.start(),this.emitStatusEvent(s.c.WaitingForPeers),await (0,r.gT)(t,[r.Uw.Filter,r.Uw.LightPush,r.Uw.Store]),this.node=t,this.initialized=!0,this.emitStatusEvent(s.c.Connected)}catch(t){console.error("Failed to initialize Waku node:",t),this.emitStatusEvent(s.c.Failed)}this.initializing=!1}}addEventListener(t,e){return this.emitter.addEventListener(t,e)}removeEventListener(t,e){return this.emitter.removeEventListener(t,e)}send(t,e){var i;return this.ensureWakuInitialized(),null===(i=this.node)||void 0===i?void 0:i.lightPush.send(t,e)}async getHistory(t){this.ensureWakuInitialized();let e=[];for await(let i of this.node.store.queryGenerator([t])){let t=await Promise.all(i),n=t.filter(t=>!!t);e=[...e,...n]}return e}async subscribe(t,e){return this.ensureWakuInitialized(),this.node.filter.subscribe(t,e)}emitStatusEvent(t){this.emitter.dispatchEvent(new CustomEvent("status",{detail:t}))}ensureWakuInitialized(){if(!u.initialized){let t="Waku is not initialized.";throw console.log(t),Error(t)}}constructor(){this.emitter=new EventTarget,this.initialized=!1,this.initializing=!1}}let u=new o}},function(t){t.O(0,[948,990,971,472,744],function(){return t(t.s=7747)}),_N_E=t.O()}]);
|
||||
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[803],{5856:function(){},7761:function(){},2678:function(){},5819:function(){},4112:function(){},629:function(t,e,i){Promise.resolve().then(i.bind(i,8815))},8815:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return c}});var n=i(7437),s=i(2265),r=i(9149),a=i(4033);let u=()=>{let t=(0,a.usePathname)(),e=(0,a.useSearchParams)(),i=t.split("/"),n=i.indexOf("view"),s=e.get("key"),r=i[n+1];return{key:s,id:r}};var o=i(7923),l=i(6309),c=()=>{let t=(0,a.useRouter)(),{id:e,key:i}=u(),[c,d]=s.useState("");return(s.useEffect(()=>{if(!e){t.replace("/404");return}o.$.readNote(e,i).then(t=>d(t||""))},[e,i,d]),c)?(0,n.jsx)(r.U,{children:c}):(0,n.jsx)(l.g,{})}},6309:function(t,e,i){"use strict";i.d(e,{g:function(){return s}});var n=i(7437);let s=()=>(0,n.jsx)("div",{className:"loading-block",children:(0,n.jsx)("p",{children:"Loading..."})})},1177:function(t,e,i){"use strict";var n,s;i.d(e,{c:function(){return n},m:function(){return r}});let r="/flush-notes/1/note/proto";(s=n||(n={})).Initializing="Initializing...",s.WaitingForPeers="Waiting for peers...",s.Connected="Connected",s.Failed="Failed to initialize(see logs)"},7923:function(t,e,i){"use strict";i.d(e,{$:function(){return l}});var n=i(7441),s=i(1177),r=i(5136),a=i(8089),u=i(9710);class o{async createNote(t){var e;let i=(0,r.oQ)(),o=(0,r.Mf)({contentTopic:s.m,symKey:i,pubsubTopic:n.H5.pubsubTopic}),l=self.crypto.randomUUID();if(36!==l.length)throw"Unexpected uuid length";let c=await n.H5.send(o,{payload:(0,a.iY)(l+t)});return(null==c?void 0:null===(e=c.failures)||void 0===e?void 0:e.length)&&c.failures.length>0&&console.error("Failures when pushing note: ",c.failures.map(t=>t.error)),{id:l,key:(0,u.ci)(i)}}async readNote(t,e){await this.initMessages((0,u.nr)(e));let i=this.messages.map(t=>{try{let e=(0,a.Md)(t.payload),i=e.substring(0,36),n=e.substring(36);return{id:i,content:n}}catch(t){console.log("Failed to read message:",t)}}).find(e=>{if((null==e?void 0:e.id)===t)return!0});return null==i?void 0:i.content}async initMessages(t){if(this.subscription)return;let e=(0,r.UF)(s.m,t,n.H5.pubsubTopic);this.messages=await n.H5.getHistory(e),this.subscription=await n.H5.subscribe(e,t=>{this.messages.push(t)})}constructor(){this.messages=[]}}let l=new o},7441:function(t,e,i){"use strict";i.d(e,{H5:function(){return o},J9:function(){return n}});var n,s=i(1177),r=i(8089),a=i(9527);(n||(n={})).Status="status";class u{async init(){if(!this.initialized&&!this.initializing){this.initializing=!0;try{this.emitStatusEvent(s.c.Initializing),this.pubsubTopic=(0,a.L3)(s.m);let t=await (0,r.pq)({defaultBootstrap:!0,contentTopics:[s.m]});await t.start(),this.emitStatusEvent(s.c.WaitingForPeers),await (0,r.gT)(t,[r.Uw.Filter,r.Uw.LightPush,r.Uw.Store]),this.node=t,this.initialized=!0,this.emitStatusEvent(s.c.Connected)}catch(t){console.error("Failed to initialize Waku node:",t),this.emitStatusEvent(s.c.Failed)}this.initializing=!1}}addEventListener(t,e){return this.emitter.addEventListener(t,e)}removeEventListener(t,e){return this.emitter.removeEventListener(t,e)}send(t,e){var i;return this.ensureWakuInitialized(),null===(i=this.node)||void 0===i?void 0:i.lightPush.send(t,e)}async getHistory(t){this.ensureWakuInitialized();let e=[];for await(let i of this.node.store.queryGenerator([t])){let t=await Promise.all(i),n=t.filter(t=>!!t);e=[...e,...n]}return e}async subscribe(t,e){return this.ensureWakuInitialized(),this.node.filter.subscribe(t,e)}emitStatusEvent(t){this.emitter.dispatchEvent(new CustomEvent("status",{detail:t}))}ensureWakuInitialized(){if(!o.initialized){let t="Waku is not initialized.";throw console.log(t),Error(t)}}constructor(){this.emitter=new EventTarget,this.initialized=!1,this.initializing=!1}}let o=new u}},function(t){t.O(0,[948,990,149,971,472,744],function(){return t(t.s=629)}),_N_E=t.O()}]);
|
||||
6
flush-notes/_next/static/chunks/main-2fbfa9e37bbc566a.js
Normal file
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{2154:function(e,n,t){Promise.resolve().then(t.t.bind(t,3728,23)),Promise.resolve().then(t.t.bind(t,9928,23)),Promise.resolve().then(t.t.bind(t,6954,23)),Promise.resolve().then(t.t.bind(t,3170,23)),Promise.resolve().then(t.t.bind(t,7264,23)),Promise.resolve().then(t.t.bind(t,8297,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[971,472],function(){return n(2019),n(2154)}),_N_E=e.O()}]);
|
||||
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{1597:function(n,_,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return u(4096)}])}},function(n){var _=function(_){return n(n.s=_)};n.O(0,[774,179],function(){return _(1597),_(7875)}),_N_E=n.O()}]);
|
||||
@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[820],{1981:function(n,_,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return u(4788)}])}},function(n){n.O(0,[888,774,179],function(){return n(n.s=1981)}),_N_E=n.O()}]);
|
||||
@ -0,0 +1 @@
|
||||
!function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}},r=!0;try{a[e].call(n.exports,n,n.exports,s),r=!1}finally{r&&delete l[e]}return n.exports}s.m=a,s.amdO={},e=[],s.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(s.O).every(function(e){return s.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},s.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);s.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},s.d(o,u),o},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){},s.miniCssF=function(e){return"static/css/9efc354ebd501924.css"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",s.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack",o+n),i.src=s.tu(e)),r[e]=[t];var d=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},s.tu=function(e){return s.tt().createScriptURL(e)},s.p="/_next/",i={272:0},s.f.j=function(e,t){var n=s.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),u=Error();s.l(o,function(t){if(s.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}else i[e]=0}},s.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)s.o(u,n)&&(s.m[n]=u[n]);if(c)var a=c(s)}for(e&&e(t);f<o.length;f++)r=o[f],s.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return s.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f))}();
|
||||
1
flush-notes/_next/static/css/9efc354ebd501924.css
Normal file
@ -0,0 +1 @@
|
||||
*{box-sizing:border-box}.loading-block{width:100vw;height:100vh;display:flex;justify-content:center;align-items:center}.note-info{font-size:.8rem;text-align:right}.create-header{display:flex;justify-content:space-between;align-items:center}.to-encrypt{font-size:1rem;padding:5px}.save-note{width:100px;height:50px;margin-bottom:10px}.note-value{width:100%;padding:10px;min-height:500px}@font-face{font-family:__Inter_36bd41;font-style:normal;font-weight:100 900;font-display:swap;src:url(/_next/static/media/55c55f0601d81cf3-s.woff2) format("woff2");unicode-range:U+0460-052f,U+1c80-1c88,U+20b4,U+2de0-2dff,U+a640-a69f,U+fe2e-fe2f}@font-face{font-family:__Inter_36bd41;font-style:normal;font-weight:100 900;font-display:swap;src:url(/_next/static/media/26a46d62cd723877-s.woff2) format("woff2");unicode-range:U+0301,U+0400-045f,U+0490-0491,U+04b0-04b1,U+2116}@font-face{font-family:__Inter_36bd41;font-style:normal;font-weight:100 900;font-display:swap;src:url(/_next/static/media/97e0cb1ae144a2a9-s.woff2) format("woff2");unicode-range:U+1f??}@font-face{font-family:__Inter_36bd41;font-style:normal;font-weight:100 900;font-display:swap;src:url(/_next/static/media/581909926a08bbc8-s.woff2) format("woff2");unicode-range:U+0370-0377,U+037a-037f,U+0384-038a,U+038c,U+038e-03a1,U+03a3-03ff}@font-face{font-family:__Inter_36bd41;font-style:normal;font-weight:100 900;font-display:swap;src:url(/_next/static/media/df0a9ae256c0569c-s.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01a0-01a1,U+01af-01b0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1ea0-1ef9,U+20ab}@font-face{font-family:__Inter_36bd41;font-style:normal;font-weight:100 900;font-display:swap;src:url(/_next/static/media/6d93bde91c0c2823-s.woff2) format("woff2");unicode-range:U+0100-02af,U+0304,U+0308,U+0329,U+1e00-1e9f,U+1ef2-1eff,U+2020,U+20a0-20ab,U+20ad-20c0,U+2113,U+2c60-2c7f,U+a720-a7ff}@font-face{font-family:__Inter_36bd41;font-style:normal;font-weight:100 900;font-display:swap;src:url(/_next/static/media/a34f9d1faa5f3315-s.p.woff2) format("woff2");unicode-range:U+00??,U+0131,U+0152-0153,U+02bb-02bc,U+02c6,U+02da,U+02dc,U+0304,U+0308,U+0329,U+2000-206f,U+2074,U+20ac,U+2122,U+2191,U+2193,U+2212,U+2215,U+feff,U+fffd}@font-face{font-family:__Inter_Fallback_36bd41;src:local("Arial");ascent-override:90.20%;descent-override:22.48%;line-gap-override:0.00%;size-adjust:107.40%}.__className_36bd41{font-family:__Inter_36bd41,__Inter_Fallback_36bd41;font-style:normal}
|
||||
BIN
flush-notes/_next/static/media/26a46d62cd723877-s.woff2
Normal file
BIN
flush-notes/_next/static/media/55c55f0601d81cf3-s.woff2
Normal file
BIN
flush-notes/_next/static/media/581909926a08bbc8-s.woff2
Normal file
BIN
flush-notes/_next/static/media/6d93bde91c0c2823-s.woff2
Normal file
BIN
flush-notes/_next/static/media/97e0cb1ae144a2a9-s.woff2
Normal file
BIN
flush-notes/_next/static/media/a34f9d1faa5f3315-s.p.woff2
Normal file
BIN
flush-notes/_next/static/media/df0a9ae256c0569c-s.woff2
Normal file
@ -0,0 +1 @@
|
||||
self.__BUILD_MANIFEST={__rewrites:{afterFiles:[{has:void 0,source:"/view/:path*",destination:"/view"}],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-deeb844d2074b9d8.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
||||
@ -0,0 +1 @@
|
||||
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()
|
||||
BIN
flush-notes/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
1
flush-notes/index.html
Normal file
12
flush-notes/index.txt
Normal file
@ -0,0 +1,12 @@
|
||||
1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
||||
2:HL["/_next/static/css/9efc354ebd501924.css","style",{"crossOrigin":""}]
|
||||
0:["tU3s5dL7StaqJoznZuW2q",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/9efc354ebd501924.css","precedence":"next","crossOrigin":""}]],"$L4"]]]]
|
||||
5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-81c8309cfee59371.js"],""]
|
||||
6:I[6954,[],""]
|
||||
7:I[7264,[],""]
|
||||
9:I[8297,[],""]
|
||||
a:I[5721,["948","static/chunks/948-50bbf5866eb892b4.js","990","static/chunks/990-35c20412112b0913.js","931","static/chunks/app/page-6f37c3f6b755896a.js"],""]
|
||||
b:{}
|
||||
3:[null,["$","$L5",null,{"children":["$","$L6",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L7",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$L8",["$","$L9",null,{"propsForComponent":{"params":{}},"Component":"$a","isStaticGeneration":true}],null],"segment":"__PAGE__"},"styles":null}],"params":"$b"}],null]
|
||||
4:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","link","2",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"32x32"}],["$","meta","3",{"name":"next-size-adjust"}]]
|
||||
8:null
|
||||
1
flush-notes/view.html
Normal file
12
flush-notes/view.txt
Normal file
@ -0,0 +1,12 @@
|
||||
1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
||||
2:HL["/_next/static/css/9efc354ebd501924.css","style",{"crossOrigin":""}]
|
||||
0:["tU3s5dL7StaqJoznZuW2q",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/9efc354ebd501924.css","precedence":"next","crossOrigin":""}]],"$L4"]]]]
|
||||
5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-81c8309cfee59371.js"],""]
|
||||
6:I[6954,[],""]
|
||||
7:I[7264,[],""]
|
||||
9:I[8297,[],""]
|
||||
a:I[8815,["948","static/chunks/948-50bbf5866eb892b4.js","990","static/chunks/990-35c20412112b0913.js","149","static/chunks/149-4f27ed9900df2b44.js","803","static/chunks/app/view/page-40306218709107ea.js"],""]
|
||||
b:{}
|
||||
3:[null,["$","$L5",null,{"children":["$","$L6",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L7",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$","$L6",null,{"parallelRouterKey":"children","segmentPath":["children","view","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L7",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$L8",["$","$L9",null,{"propsForComponent":{"params":{}},"Component":"$a","isStaticGeneration":true}],null],"segment":"__PAGE__"},"styles":null}],"segment":"view"},"styles":null}],"params":"$b"}],null]
|
||||
4:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","link","2",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"32x32"}],["$","meta","3",{"name":"next-size-adjust"}]]
|
||||
8:null
|
||||
16
index.html
@ -1 +1,15 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><title>React App</title><script defer="defer" src="/static/js/main.4b50e294.js"></script><link href="/static/css/main.f92e5eaa.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta
|
||||
http-equiv="refresh"
|
||||
content="0; url=https://github.com/waku-org/waku-lab"
|
||||
/>
|
||||
<title>Waku Lab Redirect</title>
|
||||
</head>
|
||||
<body>
|
||||
If you are not redirected automatically, follow
|
||||
<a href="https://github.com/waku-org/waku-lab">this link</a>.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
BIN
message-monitor/favicon.ico
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
1
message-monitor/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.4b50e294.js"></script><link href="/static/css/main.f92e5eaa.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
BIN
message-monitor/logo192.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
message-monitor/logo512.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
25
message-monitor/manifest.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||