Skip to content

Commit

Permalink
remove verifySignature till deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
LordGhostX committed Jan 11, 2024
1 parent 8748b59 commit fab54ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions docs/guides/js-waku/message-encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<!-- or use the `verifySignature()` function -->
<!-- if (wakuMessage.verifySignature(alicePublicKey)) { -->

```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
Expand All @@ -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");
Expand Down Expand Up @@ -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.
:::
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.
:::

<!-- [flush-notes](https://github.com/waku-org/js-waku-examples/tree/master/examples/flush-notes) and -->
2 changes: 1 addition & 1 deletion docs/learn/waku-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit fab54ea

Please sign in to comment.