@waku/message-encryption 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.0.5] - 2022-12-16
11
+
12
+ ### Fixed
13
+
14
+ - Type resolution when using `moduleResolution: node`.
15
+
16
+ ## [0.0.5] - 2022-12-15
17
+
18
+ ### Added
19
+
20
+ - Add `@multiformats/multiaddr` as peer dependency.
21
+ - New `createEncoder` and `createDecoder` functions so that the consumer does not deal with Encoder/Decoder classes.
22
+ -
23
+
24
+ ### Changed
25
+
26
+ - `Asymmetric` renamed to `ECIES` to follow RFC terminology.
27
+ - Split `ECIES` and `symmetric` packages, all items are now export from two different paths: `@waku/message-encryption/ecies` and `@waku/message-encryption/symmetric`.
28
+ - remove `asym` and `sym` prefix from exported items as they are now differentiated from their export path: `createEncoder`, `createDecoder`, `DecodedMessage`.
29
+ - Remove usage for `Partial` with `Message` as `Message`'s field are all optional.
30
+
31
+ ## [0.0.4] - 2022-11-18
32
+
33
+ ### Added
34
+
35
+ - Alpha version of `@waku/message-encryption`.
36
+
37
+ [unreleased]: https://github.com/waku-org/js-waku/compare/@waku/message-encryption@0.0.6...HEAD
38
+ [0.0.6]: https://github.com/waku-org/js-waku/compare/@waku/message-encryption@0.0.5...@waku/message-encryption@0.0.6
39
+ [0.0.5]: https://github.com/waku-org/js-waku/compare/@waku/message-encryption@0.0.4...@waku/message-encryption@0.0.5
40
+ [0.0.4]: https://github.com/waku-org/js-waku/compare/@waku/message-encryption@0.0.3...@waku/message-encryption@0.0.4
41
+ [0.0.3]: https://github.com/waku-org/js-waku/compare/@waku/message-encryption@0.0.2...%40waku/message-encryption@0.0.3
42
+ [0.0.2]: https://github.com/waku-org/js-waku/compare/@waku/message-encryption@0.0.1...%40waku/message-encryption@0.0.2
43
+ [0.0.1]: https://github.com/status-im/js-waku/compare/a20b7809d61ff9a9732aba82b99bbe99f229b935...%40waku/message-encryption%400.0.2
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # `@waku/message-encryption`
2
+
3
+ Provide Waku Message Version 1 payload encryption as defined in [26/WAKU2-PAYLOAD](https://rfc.vac.dev/spec/26/).
4
+
5
+ ## Symmetric Encryption
6
+
7
+ Symmetric encryption uses a unique key to encrypt and decrypt messages.
8
+
9
+ ```typescript
10
+ import {
11
+ createDecoder,
12
+ createEncoder,
13
+ generateSymmetricKey,
14
+ } from "@waku/message-encryption/symmetric";
15
+
16
+ // Generate a random key
17
+ const key = generateSymmetricKey();
18
+
19
+ // To send messages, create an encoder
20
+ const encoder = createEncoder(contentTopic, key);
21
+
22
+ // For example
23
+ waku.lightPush.push(encoder, { payload });
24
+
25
+ // To receive messages, create a decoder
26
+ const decoder = createDecoder(contentTopic, key);
27
+
28
+ // For example
29
+ await waku.store.queryOrderedCallback([decoder], (msg) => {
30
+ // ...
31
+ });
32
+ ```
33
+
34
+ ## ECIES Encryption
35
+
36
+ ECIES encryption enables encryption for a public key and decryption using a private key.
37
+
38
+ ```typescript
39
+ import {
40
+ createDecoder,
41
+ createEncoder,
42
+ generatePrivateKey,
43
+ getPublicKey,
44
+ } from "@waku/message-encryption/ecies";
45
+
46
+ // Generate a random private key
47
+ const privateKey = generatePrivateKey();
48
+
49
+ // Keep the private key secure, provide the public key to the sender
50
+ const publicKey = getPublicKey(privateKey);
51
+
52
+ // To send messages, create an encoder
53
+ const encoder = createEncoder(contentTopic, publicKey);
54
+
55
+ // For example
56
+ waku.lightPush.push(encoder, { payload });
57
+
58
+ // To receive messages, create a decoder
59
+ const decoder = createDecoder(contentTopic, privateKey);
60
+
61
+ // For example
62
+ await waku.store.queryOrderedCallback([decoder], (msg) => {
63
+ // ...
64
+ });
65
+ ```
@@ -0,0 +1 @@
1
+ export { D as DecodedMessage, b as createDecoder, c as createEncoder, g as generatePrivateKey, a as getPublicKey } from './index-80756c1f.js';