diff --git a/docs/guides/js-waku/message-encryption.md b/docs/guides/js-waku/message-encryption.md index 83abc3d..88a3c37 100644 --- a/docs/guides/js-waku/message-encryption.md +++ b/docs/guides/js-waku/message-encryption.md @@ -171,11 +171,15 @@ 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 or use the `verifySignature()` function 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 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 @@ -197,7 +201,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 (wakuMessage.verifySignature(alicePublicKey)) { + if (equals(signaturePublicKey, alicePublicKey)) { console.log("This message was signed by Alice"); } else { console.log("This message was NOT signed by Alice"); @@ -230,5 +234,7 @@ const restoredPrivateKey = hexToBytes(privateKeyHex); ``` :::tip Congratulations! -You have successfully encrypted, decrypted, and signed your messages using `Symmetric` and `ECIES` encryption methods. Have a look at the [flush-notes](https://github.com/waku-org/js-waku-examples/tree/master/examples/flush-notes) and [eth-pm](https://github.com/waku-org/js-waku-examples/tree/master/examples/eth-pm) examples for working demos. -::: \ No newline at end of file +You have successfully encrypted, decrypted, and signed your messages using `Symmetric` and `ECIES` encryption methods. Have a look at the [eth-pm](https://github.com/waku-org/js-waku-examples/tree/master/examples/eth-pm) example for a working demo. +::: + + \ No newline at end of file diff --git a/docs/learn/waku-network.md b/docs/learn/waku-network.md index 31f50c0..1e846cd 100644 --- a/docs/learn/waku-network.md +++ b/docs/learn/waku-network.md @@ -13,7 +13,7 @@ The Waku Network is a shared p2p messaging network that is open-access, useful f If you want to learn more about the Waku Network, the [WAKU2-NETWORK RFC](https://rfc.vac.dev/spec/64/) provides an in-depth look under the hood. :::info -The public Waku Network replaces the previous experimental shared routing layer based on a default pubsub topic (`/waku/2/default-waku/proto`). If your project currently uses this or any other shared pubsub topics, we encourage you to migrate to the public Waku Network with built-in DoS protection, with built-in DoS protection, scalability, and reasonable bandwidth usage. +The public Waku Network replaces the previous experimental shared routing layer based on a default pubsub topic (`/waku/2/default-waku/proto`). If your project currently uses this or any other shared pubsub topics, we encourage you to migrate to the public Waku Network with built-in DoS protection, scalability, and reasonable bandwidth usage. ::: ## Why join the Waku network?