From fe4c41f2d1bd17919f14722998288942f09fa359 Mon Sep 17 00:00:00 2001 From: LordGhostX Date: Mon, 4 Mar 2024 12:29:40 +0100 Subject: [PATCH] add sending media FAQ --- .cspell.json | 1 + docs/guides/js-waku/faq.md | 6 +++++- docs/guides/js-waku/message-encryption.md | 8 ++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.cspell.json b/.cspell.json index 62b8370..e9e5dc6 100644 --- a/.cspell.json +++ b/.cspell.json @@ -79,6 +79,7 @@ "txid", "baarerstrasse", "FDPIC", + "IPFS", ], "flagWords": [], "ignorePaths": [ diff --git a/docs/guides/js-waku/faq.md b/docs/guides/js-waku/faq.md index 8a3588a..8a5390a 100644 --- a/docs/guides/js-waku/faq.md +++ b/docs/guides/js-waku/faq.md @@ -35,7 +35,7 @@ import { AccordionItem } from '@site/src/components/mdx' - Though the JavaScript SDK isn't directly usable in NodeJS due to certain limitations, we suggest running nwaku in a Docker container and consuming its REST API in a NodeJS application. + Though the JavaScript SDK isn't directly usable in NodeJS due to certain limitations, we recommend running nwaku in a Docker container and consuming its REST API in a NodeJS application. @@ -44,4 +44,8 @@ import { AccordionItem } from '@site/src/components/mdx' We recommend regularly pinging peers to check for an active connection and reinitiating the subscription when it disconnects. Check out the Manage Your Filter Subscriptions guide for a detailed explanation and step-by-step instructions. + + + + While it's possible to transmit media such as images as bytes on Waku, we recommend uploading your media to a CDN or a file system like IPFS and then sharing the corresponding URL via Waku. \ No newline at end of file diff --git a/docs/guides/js-waku/message-encryption.md b/docs/guides/js-waku/message-encryption.md index 88a3c37..0a1706a 100644 --- a/docs/guides/js-waku/message-encryption.md +++ b/docs/guides/js-waku/message-encryption.md @@ -171,15 +171,11 @@ await subscription.subscribe([ECIESEncoder], callback); await node.lightPush.send(ECIESEncoder, { payload }); ``` -You can extract the `signature` and its public key (`signaturePublicKey`) from the [DecodedMessage](https://js.waku.org/classes/_waku_message_encryption.DecodedMessage.html) and compare it with the expected public key to verify the message origin: - - - +You can extract the `signature` and its public key (`signaturePublicKey`) from the [DecodedMessage](https://js.waku.org/classes/_waku_message_encryption.DecodedMessage.html) and compare it with the expected public key or use the `verifySignature()` function to verify the message origin: ```js title="Bob (receiver) client" import { generatePrivateKey } from "@waku/message-encryption"; import { createEncoder } from "@waku/message-encryption/symmetric"; -import { equals } from "uint8arrays/equals"; // Generate a random private key for signing messages // For this example, we'll call the receiver of the message Bob @@ -201,7 +197,7 @@ const callback = (wakuMessage) => { // Verify the message was actually signed and sent by Alice // Alice's public key can be gotten from broadcasting or out-of-band methods - if (equals(signaturePublicKey, alicePublicKey)) { + if (wakuMessage.verifySignature(alicePublicKey)) { console.log("This message was signed by Alice"); } else { console.log("This message was NOT signed by Alice");