You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
- Examples (web-chat): New `/fleet` command to switch connection between Status prod and test fleets.
12
+
- Export `generatePrivateKey` and `getPublicKey` directly from the root.
13
+
- Usage of the encryption and signature APIs to the readme.
14
+
15
+
### Changed
16
+
-**Breaking**: Renamed `WakuRelay.(add|delete)PrivateDecryptionKey` to `WakuRelay.(add|delete)DecryptionKey` to make it clearer that it accepts both symmetric keys and asymmetric private keys.
17
+
18
+
### Fix
19
+
- Align `WakuMessage` readme example with actual code behaviour.
You can also use `getStatusFleetNodes` to connect to nodes run by Status:
38
35
39
-
```javascript
36
+
```ts
40
37
import { getStatusFleetNodes } from'js-waku';
41
38
42
-
constnodes=awaitgetStatusFleetNodes();
43
-
awaitPromise.all(
44
-
nodes.map((addr) => {
45
-
returnwaku.dial(addr);
46
-
})
47
-
);
39
+
getStatusFleetNodes().then((nodes) => {
40
+
nodes.forEach((addr) => {
41
+
waku.dial(addr);
42
+
});
43
+
});
48
44
```
49
45
46
+
### Listen for messages
47
+
50
48
The `contentTopic` is a metadata `string` that allows categorization of messages on the waku network.
51
49
Depending on your use case, you can either create one (or several) new `contentTopic`(s) or look at the [RFCs](https://rfc.vac.dev/) and use an existing `contentTopic`.
52
50
See the [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for more details.
53
51
54
52
For example, if you were to use a new `contentTopic` such as `/my-cool-app/1/my-use-case/proto`,
55
53
here is how to listen to new messages received via [Waku v2 Relay](https://rfc.vac.dev/spec/11/):
If you expect to receive encrypted messages then simply add private decryption key(s) to `WakuRelay`.
180
+
Waku Relay will attempt to decrypt incoming messages with each keys, both for symmetric and asymmetric encryption.
181
+
Messages that are successfully decrypted (or received in clear) will be passed to the observers, other messages will be omitted.
182
+
183
+
```ts
184
+
// Asymmetric
185
+
waku.relay.addDecryptionKey(privateKey);
186
+
187
+
// Symmetric
188
+
waku.relay.addDecryptionKey(symKey);
189
+
190
+
// Then add the observer
191
+
waku.relay.addObserver(callback, [contentTopic]);
192
+
```
193
+
194
+
Keys can be removed using `WakuMessage.deleteDecryptionKey`.
195
+
196
+
#### Waku Store
197
+
198
+
```ts
199
+
const messages =awaitwaku.store.queryHistory({
200
+
contentTopics: [],
201
+
decryptionKeys: [privateKey, symKey],
202
+
});
203
+
```
204
+
205
+
Similarly to relay, only decrypted or clear messages will be returned.
206
+
207
+
### Sign Waku Messages
208
+
209
+
As per version 1`s [specs](https://rfc.vac.dev/spec/26/), signatures are only included in encrypted messages.
210
+
In the case where your app does not need encryption then you could use symmetric encryption with a trivial key, I intend to dig [more on the subject](https://github.com/status-im/js-waku/issues/74#issuecomment-880440186) and come back with recommendation and examples.
211
+
212
+
Signature keys can be generated the same way asymmetric keys for encryption are:
0 commit comments