mirror of https://github.com/waku-org/js-waku.git
Merge pull request #236 from status-im/doc
This commit is contained in:
commit
4e6848bb1c
16
README.md
16
README.md
|
@ -117,7 +117,7 @@ waku.store.queryHistory({
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Encryption & Signature
|
### Encryption & Signature
|
||||||
|
|
||||||
With js-waku, you can:
|
With js-waku, you can:
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ With js-waku, you can:
|
||||||
- Encrypt messages over the wire using a unique key to both encrypt and decrypt (symmetric encryption),
|
- Encrypt messages over the wire using a unique key to both encrypt and decrypt (symmetric encryption),
|
||||||
- Sign and verify your waku messages (must use encryption, compatible with both symmetric and asymmetric).
|
- Sign and verify your waku messages (must use encryption, compatible with both symmetric and asymmetric).
|
||||||
|
|
||||||
### Cryptographic Libraries
|
#### Cryptographic Libraries
|
||||||
|
|
||||||
A quick note on the cryptographic libraries used as it is a not a straightforward affair:
|
A quick note on the cryptographic libraries used as it is a not a straightforward affair:
|
||||||
- Asymmetric encryption:
|
- Asymmetric encryption:
|
||||||
|
@ -152,7 +152,7 @@ const publicKey = getPublicKey(privateKey);
|
||||||
const symKey = generatePrivateKey();
|
const symKey = generatePrivateKey();
|
||||||
```
|
```
|
||||||
|
|
||||||
### Encrypt Waku Messages
|
#### Encrypt Waku Messages
|
||||||
|
|
||||||
To encrypt your waku messages, simply pass the encryption key when creating it:
|
To encrypt your waku messages, simply pass the encryption key when creating it:
|
||||||
|
|
||||||
|
@ -172,9 +172,9 @@ const message = await WakuMessage.fromBytes(payload, {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### Decrypt Waku Messages
|
#### Decrypt Waku Messages
|
||||||
|
|
||||||
#### Waku Relay
|
##### Waku Relay
|
||||||
|
|
||||||
If you expect to receive encrypted messages then simply add private decryption key(s) to `WakuRelay`.
|
If you expect to receive encrypted messages then simply add private decryption key(s) to `WakuRelay`.
|
||||||
Waku Relay will attempt to decrypt incoming messages with each keys, both for symmetric and asymmetric encryption.
|
Waku Relay will attempt to decrypt incoming messages with each keys, both for symmetric and asymmetric encryption.
|
||||||
|
@ -193,7 +193,7 @@ waku.relay.addObserver(callback, [contentTopic]);
|
||||||
|
|
||||||
Keys can be removed using `WakuMessage.deleteDecryptionKey`.
|
Keys can be removed using `WakuMessage.deleteDecryptionKey`.
|
||||||
|
|
||||||
#### Waku Store
|
##### Waku Store
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const messages = await waku.store.queryHistory({
|
const messages = await waku.store.queryHistory({
|
||||||
|
@ -204,7 +204,7 @@ const messages = await waku.store.queryHistory({
|
||||||
|
|
||||||
Similarly to relay, only decrypted or clear messages will be returned.
|
Similarly to relay, only decrypted or clear messages will be returned.
|
||||||
|
|
||||||
### Sign Waku Messages
|
#### Sign Waku Messages
|
||||||
|
|
||||||
As per version 1`s [specs](https://rfc.vac.dev/spec/26/), signatures are only included in encrypted messages.
|
As per version 1`s [specs](https://rfc.vac.dev/spec/26/), signatures are only included in encrypted messages.
|
||||||
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.
|
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.
|
||||||
|
@ -231,7 +231,7 @@ const message = await WakuMessage.fromBytes(payload, {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### Verify Waku Message signatures
|
#### Verify Waku Message signatures
|
||||||
|
|
||||||
Two fields are available on `WakuMessage` regarding signatures:
|
Two fields are available on `WakuMessage` regarding signatures:
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -54,7 +54,6 @@
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"prettier": "^2.1.1",
|
"prettier": "^2.1.1",
|
||||||
"standard-version": "^9.0.0",
|
|
||||||
"ts-node": "^9.1.1",
|
"ts-node": "^9.1.1",
|
||||||
"typedoc": "^0.20.29",
|
"typedoc": "^0.20.29",
|
||||||
"typescript": "^4.0.2"
|
"typescript": "^4.0.2"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -90,7 +90,6 @@
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"codecov": "^3.5.0",
|
"codecov": "^3.5.0",
|
||||||
"cspell": "^4.1.0",
|
"cspell": "^4.1.0",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
|
||||||
"eslint": "^7.8.0",
|
"eslint": "^7.8.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||||
|
@ -109,7 +108,6 @@
|
||||||
"p-timeout": "^4.1.0",
|
"p-timeout": "^4.1.0",
|
||||||
"prettier": "^2.1.1",
|
"prettier": "^2.1.1",
|
||||||
"puppeteer": "^10.1.0",
|
"puppeteer": "^10.1.0",
|
||||||
"standard-version": "^9.0.0",
|
|
||||||
"tail": "^2.2.0",
|
"tail": "^2.2.0",
|
||||||
"ts-node": "^9.1.1",
|
"ts-node": "^9.1.1",
|
||||||
"typedoc": "^0.20.29",
|
"typedoc": "^0.20.29",
|
||||||
|
|
Loading…
Reference in New Issue