Merge pull request #244 from status-im/remove-default-content-topic

This commit is contained in:
Franck Royer 2021-07-28 12:34:06 +10:00 committed by GitHub
commit aede51f752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 175 additions and 157 deletions

View File

@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- **Breaking**: The `WakuMessage` APIs have been changed to move `contentTopic` out of the optional parameters.
### Removed
- Examples (web-chat): Remove broken `/fleet` command.
- **Breaking**: Removed `DefaultContentTopic` as developers must choose a content topic for their app;
recommendations for content topic can be found at https://rfc.vac.dev/spec/23/.
## [0.9.0] - 2021-07-26
### Changed

View File

@ -73,7 +73,7 @@ However, it does not give you any delivery information.
```ts
import { WakuMessage } from 'js-waku';
const msg = await WakuMessage.fromUtf8String("Here is a message!", { contentTopic: "/my-cool-app/1/my-use-case/proto" })
const msg = await WakuMessage.fromUtf8String("Here is a message!", "/my-cool-app/1/my-use-case/proto")
await waku.relay.send(msg);
```
@ -157,19 +157,18 @@ const symKey = generatePrivateKey();
To encrypt your waku messages, simply pass the encryption key when creating it:
```ts
import { WakuMessage } from 'js-waku';
import { WakuMessage } from "js-waku";
// Asymmetric
const message = await WakuMessage.fromBytes(payload, {
contentTopic: myAppContentTopic,
encPublicKey: publicKey,
});
const message1 = await WakuMessage.fromBytes(payload, myAppContentTopic, {
encPublicKey: publicKey,
});
// Symmetric
const message = await WakuMessage.fromBytes(payload, {
contentTopic: myAppContentTopic,
symKey: symKey,
});
const message2 = await WakuMessage.fromBytes(payload, myAppContentTopic, {
symKey: symKey,
});
```
#### Decrypt Waku Messages
@ -212,23 +211,22 @@ In the case where your app does not need encryption then you could use symmetric
Signature keys can be generated the same way asymmetric keys for encryption are:
```ts
import { generatePrivateKey, getPublicKey, WakuMessage } from 'js-waku';
import { generatePrivateKey, getPublicKey, WakuMessage } from "js-waku";
const signPrivateKey = generatePrivateKey();
// Asymmetric Encryption
const message = await WakuMessage.fromBytes(payload, {
contentTopic: myAppContentTopic,
encPublicKey: recipientPublicKey,
sigPrivKey: signPrivateKey
});
const message1 = await WakuMessage.fromBytes(payload, myAppContentTopic, {
encPublicKey: recipientPublicKey,
sigPrivKey: signPrivateKey,
});
// Symmetric Encryption
const message = await WakuMessage.fromBytes(payload, {
contentTopic: myAppContentTopic,
encPublicKey: symKey,
sigPrivKey: signPrivateKey
});
const message2 = await WakuMessage.fromBytes(payload, myAppContentTopic, {
encPublicKey: symKey,
sigPrivKey: signPrivateKey,
});
```
#### Verify Waku Message signatures

View File

@ -104,10 +104,13 @@ export default async function startChat(): Promise<void> {
rl.prompt();
const chatMessage = ChatMessage.fromUtf8String(new Date(), nick, line);
const msg = await WakuMessage.fromBytes(chatMessage.encode(), {
contentTopic: ChatContentTopic,
timestamp: new Date(),
});
const msg = await WakuMessage.fromBytes(
chatMessage.encode(),
ChatContentTopic,
{
timestamp: new Date(),
}
);
if (opts.lightPush) {
await waku.lightPush.push(msg);
} else {

View File

@ -31,7 +31,7 @@ export default function BroadcastPublicKey({
console.error('Failed to send Public Key Message', e);
});
})
.catch((e) => {
.catch(() => {
console.log('Failed to encode Public Key Message in Waku Message');
});
} else {
@ -47,7 +47,7 @@ export default function BroadcastPublicKey({
console.error('Failed to send Public Key Message', e);
});
})
.catch((e) => {
.catch(() => {
console.log(
'Failed to encode Public Key Message in Waku Message'
);
@ -75,7 +75,5 @@ async function encodePublicKeyWakuMessage(
publicKeyMessage: PublicKeyMessage
): Promise<WakuMessage> {
const payload = publicKeyMessage.encode();
return await WakuMessage.fromBytes(payload, {
contentTopic: PublicKeyContentTopic,
});
return await WakuMessage.fromBytes(payload, PublicKeyContentTopic);
}

View File

@ -115,8 +115,7 @@ async function encodeEncryptedWakuMessage(
});
const payload = directMsg.encode();
return WakuMessage.fromBytes(payload, {
contentTopic: DirectMessageContentTopic,
return WakuMessage.fromBytes(payload, DirectMessageContentTopic, {
encPublicKey: publicKey,
});
}

View File

@ -2,8 +2,8 @@ import PeerId from 'peer-id';
import { useEffect, useState } from 'react';
import './App.css';
import {
getStatusFleetNodes,
Environment,
getStatusFleetNodes,
StoreCodec,
Waku,
WakuMessage,
@ -81,17 +81,16 @@ export default function App() {
const persistedNick = window.localStorage.getItem('nick');
return persistedNick !== null ? persistedNick : generate();
});
const [fleetEnv, setFleetEnv] = useState<Environment>(defaultFleetEnv);
useEffect(() => {
localStorage.setItem('nick', nick);
}, [nick]);
useEffect(() => {
initWaku(fleetEnv, setWaku)
initWaku(setWaku)
.then(() => console.log('Waku init done'))
.catch((e) => console.log('Waku init failed ', e));
}, [fleetEnv]);
}, []);
useEffect(() => {
if (!waku) return;
@ -160,15 +159,8 @@ export default function App() {
nick={nick}
newMessages={newMessages}
archivedMessages={archivedMessages}
fleetEnv={fleetEnv}
commandHandler={(input: string) => {
const { command, response } = handleCommand(
input,
waku,
setNick,
fleetEnv,
setFleetEnv
);
const { command, response } = handleCommand(input, waku, setNick);
const commandMessages = response.map((msg) => {
return Message.fromUtf8String(command, msg);
});
@ -181,7 +173,7 @@ export default function App() {
);
}
async function initWaku(fleetEnv: Environment, setter: (waku: Waku) => void) {
async function initWaku(setter: (waku: Waku) => void) {
try {
const waku = await Waku.create({
libp2p: {
@ -196,7 +188,7 @@ async function initWaku(fleetEnv: Environment, setter: (waku: Waku) => void) {
setter(waku);
const nodes = await getStatusFleetNodes(fleetEnv);
const nodes = await getStatusFleetNodes(selectFleetEnv());
await Promise.all(
nodes.map((addr) => {
return waku.dial(addr);
@ -207,7 +199,7 @@ async function initWaku(fleetEnv: Environment, setter: (waku: Waku) => void) {
}
}
function defaultFleetEnv() {
function selectFleetEnv() {
// Works with react-scripts
if (process?.env?.NODE_ENV === 'development') {
return Environment.Test;

View File

@ -1,4 +1,4 @@
import { ChatMessage, Environment, WakuMessage } from 'js-waku';
import { ChatMessage, WakuMessage } from 'js-waku';
import { ChatContentTopic } from './App';
import ChatList from './ChatList';
import MessageInput from './MessageInput';
@ -11,7 +11,6 @@ interface Props {
archivedMessages: Message[];
commandHandler: (cmd: string) => void;
nick: string;
fleetEnv: Environment;
}
export default function Room(props: Props) {
@ -30,7 +29,7 @@ export default function Room(props: Props) {
style={{ height: '98vh', display: 'flex', flexDirection: 'column' }}
>
<TitleBar
leftIcons={`Peers: ${relayPeers} relay, ${storePeers} store. Fleet: ${props.fleetEnv}`}
leftIcons={`Peers: ${relayPeers} relay, ${storePeers} store.`}
title="Waku v2 chat app"
/>
<ChatList
@ -66,10 +65,11 @@ async function handleMessage(
} else {
const timestamp = new Date();
const chatMessage = ChatMessage.fromUtf8String(timestamp, nick, message);
const wakuMsg = await WakuMessage.fromBytes(chatMessage.encode(), {
contentTopic: ChatContentTopic,
timestamp,
});
const wakuMsg = await WakuMessage.fromBytes(
chatMessage.encode(),
ChatContentTopic,
{ timestamp }
);
return messageSender(wakuMsg);
}
}

View File

@ -1,13 +1,12 @@
import { multiaddr } from 'multiaddr';
import PeerId from 'peer-id';
import { Environment, Waku } from 'js-waku';
import { Waku } from 'js-waku';
function help(): string[] {
return [
'/nick <nickname>: set a new nickname',
'/info: some information about the node',
'/connect <Multiaddr>: connect to the given peer',
'/fleet <prod|test>: connect to this fleet; beware it restarts waku node.',
'/help: Display this help',
];
}
@ -23,14 +22,11 @@ function nick(
return [`New nick: ${nick}`];
}
function info(waku: Waku | undefined, fleetEnv: Environment): string[] {
function info(waku: Waku | undefined): string[] {
if (!waku) {
return ['Waku node is starting'];
}
return [
`PeerId: ${waku.libp2p.peerId.toB58String()}`,
`Fleet environment: ${fleetEnv}`,
];
return [`PeerId: ${waku.libp2p.peerId.toB58String()}`];
}
function connect(peer: string | undefined, waku: Waku | undefined): string[] {
@ -82,28 +78,6 @@ function peers(waku: Waku | undefined): string[] {
return response;
}
function fleet(
newFleetEnv: string | undefined,
currFleetEnv: Environment,
setFleetEnv: (fleetEnv: Environment) => void
): string[] {
switch (newFleetEnv) {
case Environment.Test:
setFleetEnv(newFleetEnv);
break;
case Environment.Prod:
setFleetEnv(newFleetEnv);
break;
default:
return [
`Incorrect values, acceptable values are ${Environment.Test}, ${Environment.Prod}`,
`Current fleet environment is ${currFleetEnv}`,
];
}
return [`New fleet Environment: ${newFleetEnv}`];
}
function connections(waku: Waku | undefined): string[] {
if (!waku) {
return ['Waku node is starting'];
@ -133,9 +107,7 @@ function connections(waku: Waku | undefined): string[] {
export default function handleCommand(
input: string,
waku: Waku | undefined,
setNick: (nick: string) => void,
currFleetEnv: Environment,
setFleetEnv: (fleetEnv: Environment) => void
setNick: (nick: string) => void
): { command: string; response: string[] } {
let response: string[] = [];
const args = parseInput(input);
@ -148,7 +120,7 @@ export default function handleCommand(
nick(args.shift(), setNick).map((str) => response.push(str));
break;
case '/info':
info(waku, currFleetEnv).map((str) => response.push(str));
info(waku).map((str) => response.push(str));
break;
case '/connect':
connect(args.shift(), waku).map((str) => response.push(str));
@ -159,11 +131,6 @@ export default function handleCommand(
case '/connections':
connections(waku).map((str) => response.push(str));
break;
case '/fleet':
fleet(args.shift(), currFleetEnv, setFleetEnv).map((str) =>
response.push(str)
);
break;
default:
response.push(`Unknown Command '${command}'`);
}

View File

@ -246,9 +246,9 @@ export class Waku {
if (relayPeriodSecs !== 0) {
this.relayKeepAliveTimers[peerIdStr] = setInterval(() => {
WakuMessage.fromBytes(new Uint8Array(), {
contentTopic: RelayPingContentTopic,
}).then((wakuMsg) => this.relay.send(wakuMsg));
WakuMessage.fromBytes(new Uint8Array(), RelayPingContentTopic).then(
(wakuMsg) => this.relay.send(wakuMsg)
);
}, relayPeriodSecs * 1000);
}
}

View File

@ -8,6 +8,8 @@ import { delay } from '../delay';
import { Waku } from '../waku';
import { WakuMessage } from '../waku_message';
const TestContentTopic = '/test/1/waku-light-push/utf8';
describe('Waku Light Push', () => {
let waku: Waku;
let nimWaku: NimWaku;
@ -35,7 +37,10 @@ describe('Waku Light Push', () => {
});
const messageText = 'Light Push works!';
const message = await WakuMessage.fromUtf8String(messageText);
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic
);
const pushResponse = await waku.lightPush.push(message);
expect(pushResponse?.isSuccess).to.be.true;
@ -75,7 +80,10 @@ describe('Waku Light Push', () => {
const nimPeerId = await nimWaku.getPeerId();
const messageText = 'Light Push works!';
const message = await WakuMessage.fromUtf8String(messageText);
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic
);
const pushResponse = await waku.lightPush.push(message, {
peerId: nimPeerId,

View File

@ -1,14 +1,17 @@
import { expect } from 'chai';
import fc from 'fast-check';
import { WakuMessage } from '../../lib/waku_message';
import { getPublicKey } from '../../lib/waku_message/version_1';
import { getPublicKey } from './version_1';
import { WakuMessage } from './index';
const TestContentTopic = '/test/1/waku-message/utf8';
describe('Waku Message: Browser & Node', function () {
it('Waku message round trip binary serialization [clear]', async function () {
await fc.assert(
fc.asyncProperty(fc.string(), async (s) => {
const msg = await WakuMessage.fromUtf8String(s);
const msg = await WakuMessage.fromUtf8String(s, TestContentTopic);
const binary = msg.encode();
const actual = await WakuMessage.decode(binary);
@ -20,7 +23,7 @@ describe('Waku Message: Browser & Node', function () {
it('Payload to utf-8', async function () {
await fc.assert(
fc.asyncProperty(fc.string(), async (s) => {
const msg = await WakuMessage.fromUtf8String(s);
const msg = await WakuMessage.fromUtf8String(s, TestContentTopic);
const utf8 = msg.payloadAsUtf8;
return utf8 === s;
@ -36,7 +39,7 @@ describe('Waku Message: Browser & Node', function () {
async (payload, privKey) => {
const publicKey = getPublicKey(privKey);
const msg = await WakuMessage.fromBytes(payload, {
const msg = await WakuMessage.fromBytes(payload, TestContentTopic, {
encPublicKey: publicKey,
});
@ -59,7 +62,7 @@ describe('Waku Message: Browser & Node', function () {
const sigPubKey = getPublicKey(sigPrivKey);
const encPubKey = getPublicKey(encPrivKey);
const msg = await WakuMessage.fromBytes(payload, {
const msg = await WakuMessage.fromBytes(payload, TestContentTopic, {
encPublicKey: encPubKey,
sigPrivKey: sigPrivKey,
});
@ -80,7 +83,7 @@ describe('Waku Message: Browser & Node', function () {
fc.uint8Array({ minLength: 1 }),
fc.uint8Array({ minLength: 32, maxLength: 32 }),
async (payload, key) => {
const msg = await WakuMessage.fromBytes(payload, {
const msg = await WakuMessage.fromBytes(payload, TestContentTopic, {
symKey: key,
});
@ -102,7 +105,7 @@ describe('Waku Message: Browser & Node', function () {
async (payload, sigPrivKey, symKey) => {
const sigPubKey = getPublicKey(sigPrivKey);
const msg = await WakuMessage.fromBytes(payload, {
const msg = await WakuMessage.fromBytes(payload, TestContentTopic, {
symKey: symKey,
sigPrivKey: sigPrivKey,
});

View File

@ -16,10 +16,12 @@ import { Waku } from '../waku';
import { generatePrivateKey, getPublicKey } from './version_1';
import { DefaultContentTopic, WakuMessage } from './index';
import { WakuMessage } from './index';
const dbg = debug('waku:test:message');
const TestContentTopic = '/test/1/waku-message/utf8';
describe('Waku Message: Node only', function () {
describe('Interop: Nim', function () {
let waku: Waku;
@ -56,7 +58,7 @@ describe('Waku Message: Node only', function () {
const messageText = 'Here is an encrypted message.';
const message: WakuRelayMessage = {
contentTopic: DefaultContentTopic,
contentTopic: TestContentTopic,
payload: Buffer.from(messageText, 'utf-8').toString('hex'),
};
@ -89,9 +91,13 @@ describe('Waku Message: Node only', function () {
const publicKey = hexToBuf(keyPair.publicKey);
const messageText = 'This is a message I am going to encrypt';
const message = await WakuMessage.fromUtf8String(messageText, {
encPublicKey: publicKey,
});
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic,
{
encPublicKey: publicKey,
}
);
await waku.relay.send(message);
@ -112,7 +118,7 @@ describe('Waku Message: Node only', function () {
const messageText = 'Here is a message encrypted in a symmetric manner.';
const message: WakuRelayMessage = {
contentTopic: DefaultContentTopic,
contentTopic: TestContentTopic,
payload: Buffer.from(messageText, 'utf-8').toString('hex'),
};
@ -143,9 +149,13 @@ describe('Waku Message: Node only', function () {
const messageText =
'This is a message I am going to encrypt with a symmetric key';
const message = await WakuMessage.fromUtf8String(messageText, {
symKey: symKey,
});
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic,
{
symKey: symKey,
}
);
await waku.relay.send(message);

View File

@ -9,16 +9,10 @@ import * as proto from '../../proto/waku/v2/message';
import * as version_1 from './version_1';
export const DefaultContentTopic = '/waku/2/default-content/proto';
const DefaultVersion = 0;
const dbg = debug('waku:message');
export interface Options {
/**
* Content topic to set on the message, defaults to {@link DefaultContentTopic}
* if not passed.
*/
contentTopic?: string;
/**
* Timestamp to set on the message, defaults to now if not passed.
*/
@ -54,10 +48,11 @@ export class WakuMessage {
*/
static async fromUtf8String(
utf8: string,
contentTopic: string,
opts?: Options
): Promise<WakuMessage> {
const payload = Buffer.from(utf8, 'utf-8');
return WakuMessage.fromBytes(payload, opts);
return WakuMessage.fromBytes(payload, contentTopic, opts);
}
/**
@ -74,13 +69,13 @@ export class WakuMessage {
*/
static async fromBytes(
payload: Uint8Array,
contentTopic: string,
opts?: Options
): Promise<WakuMessage> {
const { timestamp, contentTopic, encPublicKey, symKey, sigPrivKey } =
Object.assign(
{ timestamp: new Date(), contentTopic: DefaultContentTopic },
opts ? opts : {}
);
const { timestamp, encPublicKey, symKey, sigPrivKey } = Object.assign(
{ timestamp: new Date() },
opts ? opts : {}
);
let _payload = payload;
let version = DefaultVersion;

View File

@ -18,6 +18,8 @@ import { DefaultPubsubTopic } from './index';
const log = debug('waku:test');
const TestContentTopic = '/test/1/waku-relay/utf8';
describe('Waku Relay', () => {
describe('js only', () => {
afterEach(function () {
@ -81,9 +83,13 @@ describe('Waku Relay', () => {
const messageText = 'JS to JS communication works';
const messageTimestamp = new Date('1995-12-17T03:24:00');
const message = await WakuMessage.fromUtf8String(messageText, {
timestamp: messageTimestamp,
});
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic,
{
timestamp: messageTimestamp,
}
);
const receivedMsgPromise: Promise<WakuMessage> = new Promise(
(resolve) => {
@ -108,12 +114,14 @@ describe('Waku Relay', () => {
const fooMessageText = 'Published on content topic foo';
const barMessageText = 'Published on content topic bar';
const fooMessage = await WakuMessage.fromUtf8String(fooMessageText, {
contentTopic: 'foo',
});
const barMessage = await WakuMessage.fromUtf8String(barMessageText, {
contentTopic: 'bar',
});
const fooMessage = await WakuMessage.fromUtf8String(
fooMessageText,
'foo'
);
const barMessage = await WakuMessage.fromUtf8String(
barMessageText,
'bar'
);
const receivedBarMsgPromise: Promise<WakuMessage> = new Promise(
(resolve) => {
@ -148,9 +156,10 @@ describe('Waku Relay', () => {
const messageText =
'Published on content topic with added then deleted observer';
const message = await WakuMessage.fromUtf8String(messageText, {
contentTopic: 'added-then-deleted-observer',
});
const message = await WakuMessage.fromUtf8String(
messageText,
'added-then-deleted-observer'
);
// The promise **fails** if we receive a message on this observer.
const receivedMsgPromise: Promise<WakuMessage> = new Promise(
@ -207,7 +216,10 @@ describe('Waku Relay', () => {
]);
const messageText = 'Communicating using a custom pubsub topic';
const message = await WakuMessage.fromUtf8String(messageText);
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic
);
const waku2ReceivedMsgPromise: Promise<WakuMessage> = new Promise(
(resolve) => {
@ -278,7 +290,10 @@ describe('Waku Relay', () => {
this.timeout(5000);
const messageText = 'This is a message';
const message = await WakuMessage.fromUtf8String(messageText);
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic
);
await waku.relay.send(message);
@ -297,7 +312,10 @@ describe('Waku Relay', () => {
it('Nim publishes to js', async function () {
this.timeout(5000);
const messageText = 'Here is another message.';
const message = await WakuMessage.fromUtf8String(messageText);
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic
);
const receivedMsgPromise: Promise<WakuMessage> = new Promise(
(resolve) => {
@ -363,7 +381,10 @@ describe('Waku Relay', () => {
this.timeout(30000);
const messageText = 'This is a message';
const message = await WakuMessage.fromUtf8String(messageText);
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic
);
await delay(1000);
await waku.relay.send(message);
@ -384,7 +405,10 @@ describe('Waku Relay', () => {
await delay(200);
const messageText = 'Here is another message.';
const message = await WakuMessage.fromUtf8String(messageText);
const message = await WakuMessage.fromUtf8String(
messageText,
TestContentTopic
);
const receivedMsgPromise: Promise<WakuMessage> = new Promise(
(resolve) => {
@ -466,7 +490,10 @@ describe('Waku Relay', () => {
).to.be.false;
const msgStr = 'Hello there!';
const message = await WakuMessage.fromUtf8String(msgStr);
const message = await WakuMessage.fromUtf8String(
msgStr,
TestContentTopic
);
const waku2ReceivedMsgPromise: Promise<WakuMessage> = new Promise(
(resolve) => {

View File

@ -12,13 +12,15 @@ import {
} from '../../test_utils';
import { delay } from '../delay';
import { Waku } from '../waku';
import { DefaultContentTopic, WakuMessage } from '../waku_message';
import { WakuMessage } from '../waku_message';
import { generatePrivateKey, getPublicKey } from '../waku_message/version_1';
import { Direction } from './history_rpc';
const dbg = debug('waku:test:store');
const TestContentTopic = '/test/1/waku-store/utf8';
describe('Waku Store', () => {
let waku: Waku;
let nimWaku: NimWaku;
@ -37,7 +39,7 @@ describe('Waku Store', () => {
for (let i = 0; i < 2; i++) {
expect(
await nimWaku.sendMessage(
await WakuMessage.fromUtf8String(`Message ${i}`)
await WakuMessage.fromUtf8String(`Message ${i}`, TestContentTopic)
)
).to.be.true;
}
@ -73,7 +75,7 @@ describe('Waku Store', () => {
for (let i = 0; i < 15; i++) {
expect(
await nimWaku.sendMessage(
await WakuMessage.fromUtf8String(`Message ${i}`)
await WakuMessage.fromUtf8String(`Message ${i}`, TestContentTopic)
)
).to.be.true;
}
@ -90,7 +92,7 @@ describe('Waku Store', () => {
});
const messages = await waku.store.queryHistory({
contentTopics: [DefaultContentTopic],
contentTopics: [],
direction: Direction.FORWARD,
});
@ -114,7 +116,7 @@ describe('Waku Store', () => {
for (let i = 0; i < 2; i++) {
expect(
await nimWaku.sendMessage(
await WakuMessage.fromUtf8String(`Message ${i}`),
await WakuMessage.fromUtf8String(`Message ${i}`, TestContentTopic),
customPubSubTopic
)
).to.be.true;
@ -171,14 +173,22 @@ describe('Waku Store', () => {
clearMessage,
otherEncMessage,
] = await Promise.all([
WakuMessage.fromUtf8String(encryptedAsymmetricMessageText, {
encPublicKey: publicKey,
}),
WakuMessage.fromUtf8String(encryptedSymmetricMessageText, {
symKey: symKey,
}),
WakuMessage.fromUtf8String(clearMessageText),
WakuMessage.fromUtf8String(otherEncMessageText, {
WakuMessage.fromUtf8String(
encryptedAsymmetricMessageText,
TestContentTopic,
{
encPublicKey: publicKey,
}
),
WakuMessage.fromUtf8String(
encryptedSymmetricMessageText,
TestContentTopic,
{
symKey: symKey,
}
),
WakuMessage.fromUtf8String(clearMessageText, TestContentTopic),
WakuMessage.fromUtf8String(otherEncMessageText, TestContentTopic, {
encPublicKey: getPublicKey(generatePrivateKey()),
}),
]);