mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-02 12:53:12 +00:00
remove verifySignature till deployment
This commit is contained in:
parent
8748b59e12
commit
fab54ea06d
@ -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
|
||||
@ -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.
|
||||
:::
|
||||
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 -->
|
||||
@ -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?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user