Updates
This commit is contained in:
parent
1941c704f9
commit
f9e853f2e5
|
@ -42,13 +42,14 @@
|
||||||
|
|
||||||
<script src="https://unpkg.com/@multiformats/multiaddr@12.1.1/dist/index.min.js"></script>
|
<script src="https://unpkg.com/@multiformats/multiaddr@12.1.1/dist/index.min.js"></script>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import * as utils from "https://unpkg.com/@waku/utils@0.0.5/bundle/bytes.js";
|
|
||||||
import { createLightNode } from "https://unpkg.com/@waku/create@0.0.13/bundle/index.js";
|
|
||||||
import {
|
import {
|
||||||
|
createLightNode,
|
||||||
waitForRemotePeer,
|
waitForRemotePeer,
|
||||||
createEncoder,
|
createEncoder,
|
||||||
createDecoder,
|
createDecoder,
|
||||||
} from "https://unpkg.com/@waku/core@0.0.17/bundle/index.js";
|
utf8ToBytes,
|
||||||
|
bytesToUtf8,
|
||||||
|
} from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js";
|
||||||
|
|
||||||
const peerIdDiv = document.getElementById("peer-id");
|
const peerIdDiv = document.getElementById("peer-id");
|
||||||
const remotePeerIdDiv = document.getElementById("remote-peer-id");
|
const remotePeerIdDiv = document.getElementById("remote-peer-id");
|
||||||
|
@ -101,7 +102,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const callback = (wakuMessage) => {
|
const callback = (wakuMessage) => {
|
||||||
const text = utils.bytesToUtf8(wakuMessage.payload);
|
const text = bytesToUtf8(wakuMessage.payload);
|
||||||
const timestamp = wakuMessage.timestamp.toString();
|
const timestamp = wakuMessage.timestamp.toString();
|
||||||
messages.push(text + " - " + timestamp);
|
messages.push(text + " - " + timestamp);
|
||||||
updateMessages(messages, messagesDiv);
|
updateMessages(messages, messagesDiv);
|
||||||
|
@ -124,7 +125,7 @@
|
||||||
const text = textInput.value;
|
const text = textInput.value;
|
||||||
|
|
||||||
await node.lightPush.send(encoder, {
|
await node.lightPush.send(encoder, {
|
||||||
payload: utils.utf8ToBytes(text),
|
payload: utf8ToBytes(text),
|
||||||
});
|
});
|
||||||
console.log("Message sent!");
|
console.log("Message sent!");
|
||||||
textInput.value = null;
|
textInput.value = null;
|
||||||
|
|
1619
noise-js/index.js
1619
noise-js/index.js
File diff suppressed because one or more lines are too long
2577
noise-rtc/index.js
2577
noise-rtc/index.js
File diff suppressed because one or more lines are too long
|
@ -33,16 +33,14 @@
|
||||||
* Recommended payload is protobuf. Using simple utf-8 string for demo purposes only.
|
* Recommended payload is protobuf. Using simple utf-8 string for demo purposes only.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
|
||||||
bytesToUtf8,
|
|
||||||
utf8ToBytes,
|
|
||||||
} from "https://unpkg.com/@waku/utils@0.0.5/bundle/bytes.js";
|
|
||||||
import { createRelayNode } from "https://unpkg.com/@waku/create@0.0.13/bundle/index.js";
|
|
||||||
import {
|
import {
|
||||||
waitForRemotePeer,
|
waitForRemotePeer,
|
||||||
createDecoder,
|
createDecoder,
|
||||||
createEncoder,
|
createEncoder,
|
||||||
} from "https://unpkg.com/@waku/core@0.0.17/bundle/index.js";
|
bytesToUtf8,
|
||||||
|
utf8ToBytes,
|
||||||
|
createRelayNode,
|
||||||
|
} from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js";
|
||||||
|
|
||||||
const statusDiv = document.getElementById("status");
|
const statusDiv = document.getElementById("status");
|
||||||
const messagesDiv = document.getElementById("messages");
|
const messagesDiv = document.getElementById("messages");
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import * as utils from "https://unpkg.com/@waku/utils@0.0.4/bundle/bytes.js";
|
import * as utils from "https://unpkg.com/@waku/utils@0.0.8/bundle/bytes.js";
|
||||||
import { createLightNode } from "https://unpkg.com/@waku/create@0.0.12/bundle/index.js";
|
|
||||||
import {
|
import {
|
||||||
createEncoder,
|
createEncoder,
|
||||||
createDecoder,
|
createDecoder,
|
||||||
waitForRemotePeer,
|
waitForRemotePeer,
|
||||||
} from "https://unpkg.com/@waku/core@0.0.16/bundle/index.js";
|
createLightNode,
|
||||||
|
} from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js";
|
||||||
import { protobuf } from "https://taisukef.github.io/protobuf-es.js/dist/protobuf-es.js";
|
import { protobuf } from "https://taisukef.github.io/protobuf-es.js/dist/protobuf-es.js";
|
||||||
import {
|
import {
|
||||||
create,
|
create,
|
||||||
|
@ -284,8 +284,8 @@ function initUI() {
|
||||||
const membershipIdInput = document.getElementById("membership-id");
|
const membershipIdInput = document.getElementById("membership-id");
|
||||||
const idSecretHashInput = document.getElementById("id-secret-hash");
|
const idSecretHashInput = document.getElementById("id-secret-hash");
|
||||||
const commitmentKeyInput = document.getElementById("commitment-key");
|
const commitmentKeyInput = document.getElementById("commitment-key");
|
||||||
const idTrapdoorInput = document.getElementById("id-trapdoor")
|
const idTrapdoorInput = document.getElementById("id-trapdoor");
|
||||||
const idNullifierInput = document.getElementById("id-nullifier")
|
const idNullifierInput = document.getElementById("id-nullifier");
|
||||||
const importManually = document.getElementById("import-manually-button");
|
const importManually = document.getElementById("import-manually-button");
|
||||||
const importFromWalletButton = document.getElementById(
|
const importFromWalletButton = document.getElementById(
|
||||||
"import-from-wallet-button"
|
"import-from-wallet-button"
|
||||||
|
@ -418,9 +418,13 @@ function initUI() {
|
||||||
const idCommitment = utils.hexToBytes(commitmentKeyInput.value);
|
const idCommitment = utils.hexToBytes(commitmentKeyInput.value);
|
||||||
const idSecretHash = utils.hexToBytes(idSecretHashInput.value);
|
const idSecretHash = utils.hexToBytes(idSecretHashInput.value);
|
||||||
|
|
||||||
|
|
||||||
const membershipId = membershipIdInput.value;
|
const membershipId = membershipIdInput.value;
|
||||||
const credentials = new IdentityCredential(idTrapdoor, idNullifier, idSecretHash, idCommitment);
|
const credentials = new IdentityCredential(
|
||||||
|
idTrapdoor,
|
||||||
|
idNullifier,
|
||||||
|
idSecretHash,
|
||||||
|
idCommitment
|
||||||
|
);
|
||||||
|
|
||||||
fn(membershipId, credentials);
|
fn(membershipId, credentials);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue