Commit Graph

176 Commits

Author SHA1 Message Date
Franck Royer 0cf12f3b55
Release 0.14.1
### Fixed
- Issue when importing the `utils` module.
2021-10-22 14:40:38 +11:00
Franck Royer 5009792fca
Remove exports field
TypeScript does not play nice with it just yet:
https://github.com/microsoft/TypeScript/issues/33079
2021-10-19 15:22:38 +11:00
Franck Royer 2c1ff58f93
Release 0.14.0
### Added
- If the `callback` function passed to`WakuStore.queryHistory` returns
  `true`, then no further pages are retrieved from the store.
- Use webpack to build UMD bundle of the library, see
  [README](./README.md) for usage.

### Changed
- **Breaking**: Renamed `WakuStore.QueryOptions`'s `direction` to
  `pageDirection` (and its type) as it only affects the page ordering,
  not the ordering of messages with the page.

### Fixed
- Docs: Ensure that `WakuStore`'s `QueryOptions` documentation is
  available [online](https://status-im.github.io/js-waku/docs/).
2021-10-13 11:14:40 +11:00
Franck Royer bafa30fb05
Add doc location for UMD bundle 2021-10-13 10:21:40 +11:00
Franck Royer 4ff61f4bf9
Update changelog 2021-10-12 11:43:30 +11:00
Franck Royer 8d469ff842
Enable caller to abort store query
If the `callback` function passed to`WakuStore.queryHistory` returns
`true`, then no further pages are retrieved from the store.
2021-10-07 15:33:00 +11:00
Franck Royer b216cd3b22
Update changelog 2021-10-05 13:36:04 +11:00
Franck Royer f5a0416efd
Rename to page direction
As the direction only affects the page ordering,
not the message ordering in the pages.
2021-10-05 13:36:03 +11:00
Franck Royer 6bc8136204
Merge branch 'main' of github.com:status-im/waku-js into release/0.12.2 2021-09-21 15:41:23 +10:00
Franck Royer e3dce12ae8
Release 0.12.2 2021-09-21 15:33:42 +10:00
Franck Royer ff8f151fbd
Update Changelog 2021-09-21 15:23:19 +10:00
Franck Royer 129b6a97d4
Release 0.13.1 2021-09-21 15:00:57 +10:00
Franck Royer 6b11bc7183
Update Changelog 2021-09-21 14:47:45 +10:00
Franck Royer 5443e3b4a7
Merge branch 'main' of github.com:status-im/waku-js into release/0.12.0 2021-09-21 14:31:28 +10:00
Franck Royer def38b4234
Release 0.12.1 2021-09-16 15:21:45 +10:00
Franck Royer 8a4e7f5f3c
Connects to a limited number of bootstrap nodes, defaults to 1 2021-09-16 15:16:32 +10:00
Franck Royer 6bd114f551
Release 0.13.0 2021-09-16 14:57:10 +10:00
Franck Royer 6504106a9e
Connects to a limited number of bootstrap nodes, defaults to 1 2021-09-16 10:38:01 +10:00
Franck Royer ca09c34ac6
Upgrade libp2p libraries 2021-09-03 16:02:22 +10:00
Franck Royer 3bf7e2250c
Release 0.12.0 2021-09-02 16:38:56 +10:00
Franck Royer a21d641280
Added `Waku.waitForConnectedPeer` helper
To ensure that we are connected to Waku peers when using the bootstrap
option.
2021-09-02 15:46:23 +10:00
Franck Royer 3c0884a96e
Update changelog 2021-09-02 15:27:39 +10:00
Franck Royer cfb97b6bde
Allow passing decryption keys to `Waku` instance
Keys can be set at creation or at run time.
They are passed to `WakuStore` and `WakuRelay` instances.
2021-09-02 15:20:43 +10:00
Franck Royer 911ce5bab7
Allow passing decryption keys to `WakuStore` instance
To avoid having to pass them at every `queryHistory` call.
2021-09-02 15:17:40 +10:00
Franck Royer 931a414a3c
Allow passing decryption keys in hex string format 2021-09-02 15:13:50 +10:00
Franck Royer 75352abcac
Promote dedicated symmetric key generation API
Using the private key API for symmetric key is confusing.
2021-09-02 15:09:31 +10:00
Franck Royer 880746a0df
Add guide to encrypt messages using version 1 2021-08-26 16:34:29 +10:00
Franck Royer 5af6d84852
Encrypt Public Key Messages using symmetric encryption 2021-08-26 16:12:53 +10:00
Franck Royer 398f34b57f
Fixed Buffer.concat error when using symmetric encryption in the browser 2021-08-26 16:12:53 +10:00
Franck Royer 5b34da6b5f
Both or neither time parameters must be passed
The protocol does not support open-ended time filtering windows. See
https://github.com/status-im/nim-waku/issues/706
2021-08-25 12:14:53 +10:00
Franck Royer 8fce1ad884
Release 0.11.0
### Added
- Examples: New Ethereum Private Message Using Wallet Encryption
  [Web App](./examples/eth-pm-wallet-encryption/README.md)
  example that demonstrates the usage of `eth_encrypt` API (available on
  Metamask) and EIP-712 for typed structured data signing.
- New `bootstrap` option for `Waku.create` to easily connect to Waku
  nodes upon start up.
- Support for `startTime` and `endTime` in Store queries to filter by
  time window as per [21/WAKU2-FTSTORE](https://rfc.vac.dev/spec/21/).

### Changed
- Renamed `discover.getStatusFleetNodes` to
  `discovery.getBootstrapNodes`;
  Changed the API to allow retrieval of bootstrap nodes from other
  sources.
- Examples: Renamed `eth-dm` to `eth-pm`; "Direct Message" can lead to
  confusion with "Direct Connection" that
  refers to low latency network connections.
- Examples (eth-pm): Use sign typed data EIP-712 instead of personal
  sign.
- Upgraded dependencies to remove warning at installation.
- **Breaking**: Moved `DefaultPubSubTopic` to `waku.ts` and fixed the
  casing.
- **Breaking**: Rename all `pubsubTopic` occurrences to `pubSubTopic`,
  across all interfaces.

### Removed
- Examples (cli-chat): The focus of this library is Web environment;
  Several examples now cover usage of Waku Relay and Waku Store making cli-chat example obsolete;
  web-chat POC should be preferred to use the [TOY-CHAT](https://rfc.vac.dev/spec/22/) protocol.
- `ChatMessage` has been moved from js-waku to web-chat example;
  it is a type used for the [TOY-CHAT](https://rfc.vac.dev/spec/22/) protocol;
  js-waku users should not build on top if this toy protocol and instead design message data structures appropriate to their use case.
- Unused dependencies & scripts.
2021-08-20 12:15:23 +10:00
Franck Royer ac03a9e54b
Update changelog 2021-08-20 10:54:13 +10:00
Franck Royer b7693853d2
Added support for `startTime` and `endTime` in Store queries 2021-08-20 10:37:58 +10:00
Franck Royer 1d48dc4372
Rename all `pubsubTopic` occurrences to `pubSubTopic` 2021-08-20 10:13:02 +10:00
Franck Royer 60290e8d84
Moved `DefaultPubSubTopic` to `waku.ts` and fixed the casing
The pubsub topic is used by several protocol, not just relay.
2021-08-20 10:12:55 +10:00
Franck Royer 0c09d60c91
Update changelog 2021-08-19 11:27:03 +10:00
Franck Royer 0b03952542
Update changelog 2021-08-19 11:13:34 +10:00
Franck Royer 9692b4af72
Rename Eth-DM to Eth-PM
"Direct Message" can lead to confusion with "Direct Connection" that
refers to low latency network connections.
2021-08-17 16:06:46 +10:00
Franck Royer 0f0b083586
Update changelog for Eth-PM Wallet Encryption changes 2021-08-13 16:44:29 +10:00
Franck Royer 140791cc91
Provide easy way to bootstrap when creating Waku node 2021-08-13 16:18:00 +10:00
Franck Royer c3855112d7
Rename `getStatusFleetNodes`
To make it more generic to allow retrieval of bootstrap nodes from
other sources.
2021-08-13 16:17:15 +10:00
Franck Royer 319f44a0b1
`WakuStore.queryHistory` throws when encountering an error
Instead of returning a `null` value.
2021-08-09 12:36:24 +10:00
Franck Royer b422c9a10b
Move `contentTopics` out the `WakuStore.queryHistory`'s optional params 2021-08-09 12:36:12 +10:00
Franck Royer ad9d629daa
`ChatMessage` has been moved from js-waku to web-chat example
It is a type used for the [TOY-CHAT](https://rfc.vac.dev/spec/22/)
 protocol;
js-waku users should not build on top if this toy protocol and instead
design message data structures appropriate to their use case.
2021-08-06 17:25:12 +10:00
Franck Royer 0c3995a810
Remove cli-chat example
The focus of this library is on Web environment; Several examples now
cover usage of Waku Relay and Waku Store; web-chat POC should be
preferred to use the [TOY-CHAT](https://rfc.vac.dev/spec/22/) protocol.
2021-08-06 17:25:11 +10:00
Franck Royer 70c58c8c49
Release 0.10.0
### Added
- Relay and ReactJS guides and examples
  ([#56](https://github.com/status-im/js-waku/issues/56)).

### 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/.

### Fixed
- `WakuMessage.payloadAsUtf8` returning garbage on utf-8 non-ascii
  characters.
- `ChatMessage.payloadAsUtf8` returning garbage on utf-8 non-ascii
  characters.
2021-08-06 16:38:55 +10:00
Franck Royer 1b82c21297
Update changelog 2021-08-05 13:39:42 +10:00
Franck Royer 45dc8f81c9
Fixed `ChatMessage.payloadAsUtf8` returning garbage on utf-8 non-ascii 2021-08-02 10:36:50 +10:00
Franck Royer 1f692f1683
Fixed `payloadAsUtf8` returning garbage on utf-8 non-ascii characters 2021-08-02 09:51:37 +10:00
Franck Royer 0cfdd34284
Removed `DefaultContentTopic`
As developers must choose a content topic for their app.
The`WakuMessage` APIs have been changed to move `contentTopic` out of
the optional parameters. Recommendations for content topic can be found
at https://rfc.vac.dev/spec/23/.
2021-07-28 12:03:51 +10:00
Franck Royer 53ef23362c
Remove faulty fleet feature
It does not work as it can lead to infinite loops due to the handling of
the Waku instance. It should disconnect and reconnect to peers instead
of starting a new waku instance.
2021-07-28 11:58:02 +10:00
Franck Royer 9638f6db10
Introduced new `relayKeepAlive` option
..on `Waku` with a default to 5min to send ping messages over relay
to ensure the relay stream stays open.

This is a workaround until
[js-libp2p#744](https://github.com/libp2p/js-libp2p/issues/744) is done
as there are issues when TCP(?) timeouts and the stream gets closed.
2021-07-27 16:24:04 +10:00
Franck Royer ea33b9cd8a
Rename `keepAlive` option to `pingKeepAlive`
In preparation for introducing a relay keep alive feature.
2021-07-27 16:06:57 +10:00
Franck Royer 36a5a51aa8
Upgrade to libp2p 0.32.0 2021-07-27 14:31:06 +10:00
Franck Royer c35fe74dad
Release 0.9.0
### Changed
- **Breaking**: Store Response Protobuf changed to align with
  nim-waku v0.5
  ([nim-waku#676](https://github.com/status-im/nim-waku/pull/676)).
2021-07-26 16:49:30 +10:00
Franck Royer 5f7eee394b
Store Response Protobuf change to align with nim-waku
status-im/nim-waku#676
2021-07-26 11:35:08 +10:00
Franck Royer be007f4839
Ensure there is no infinite loop on error 2021-07-21 15:44:00 +10:00
Franck Royer 92a76b3be0
Support multiple protocol id for relay
Support id of latest nim-waku release 0.4 and current master.
2021-07-21 15:43:30 +10:00
Franck Royer 0753184079
Release 0.8.1
### Added
- Examples (web-chat): New `/fleet` command to switch connection between
  Status prod and test fleets.
- Export `generatePrivateKey` and `getPublicKey` directly from the root.
- Usage of the encryption and signature APIs to the readme.

### Changed
- **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.

### Fix
- Align `WakuMessage` readme example with actual code behaviour.
2021-07-16 12:00:43 +10:00
Franck Royer 4f796ab920
Add encryption/signature documentation 2021-07-16 11:19:38 +10:00
Franck Royer 1d4137e2c4
Rename so that it does make dev thinks it's for asymmetric enc only 2021-07-16 10:24:29 +10:00
Franck Royer 07cba4f8ca
Update changelog for readme changes 2021-07-16 09:51:59 +10:00
Franck Royer a3c4eed656
Update changelog for fleet command 2021-07-16 09:50:44 +10:00
Franck Royer addf9543a2
Export `generatePrivateKey` and `getPublicKey` directly from the root 2021-07-16 09:43:10 +10:00
Franck Royer 3a3e718749
Release 0.8.0
### Added
- `WakuRelay.deleteObserver` to allow removal of observers, useful when
  a React component add observers when mounting and needs to delete it
  when unmounting.
- Keep alive feature that pings host regularly, reducing the chance of
  connections being dropped due to idle.
  Can be disabled or default frequency (10s) can be changed when calling
  `Waku.create`.
- New `lib/utils` module for easy, dependency-less hex/bytes
  conversions.
- New `peers` and `randomPeer` methods on `WakuStore` and
  `WakuLightPush` to have a better idea of available peers;
  Note that it does not check whether Waku node is currently connected
  to said peers.
- Enable passing decryption private keys to `WakuStore.queryHistory`.
- Test: Introduce testing in browser environment (Chrome) using Karma.
- Add support for Waku Message version 1: Asymmetric encryption,
  symmetric encryption, and signature of the data.

### Changed
- **Breaking**: Auto select peer if none provided for store and light
  push protocols.
- Upgrade to `libp2p@0.31.7` and `libp2p-gossipsub@0.10.0` to avoid
  `TextEncoder` errors in ReactJS tests.
- Disable keep alive by default as latest nim-waku release does not
  support ping protocol.
- **Breaking**: Optional parameters for `WakuMessage.fromBytes` and
  `WakuMessage.fromUtf8String` are now passed in a single `Options`
   object.
- **Breaking**: `WakuMessage` static functions are now async to allow
  for encryption and decryption.
- **Breaking**: `WakuMessage` constructor is now private, `from*` and
  `decode*` function should be used.
- `WakuMessage` version 1 is partially supported, enabling asymmetrical
  encryption and signature of messages;
  this can be done by passing keys to `WakuMessage.from*` and
  `WakuMessage.decode*` methods.
- Examples (eth-dm): Use Waku Message version 1 encryption scheme
  instead of `eth-crypto`.
- Examples (eth-dm): Use Protobuf for direct messages instead of JSON
  ([#214](https://github.com/status-im/js-waku/issues/214)).

### Fixed
- Disable `keepAlive` if set to `0`.
2021-07-15 12:48:47 +10:00
Franck Royer 6afecd9989
Mention encryption support 2021-07-15 10:36:24 +10:00
Franck Royer 8c66022a18
Update changelog for Karma 2021-07-14 15:35:46 +10:00
Franck Royer c2cef05c2d
Use protobuf instead of JSON for direct messages 2021-07-12 17:29:52 +10:00
Franck Royer 48bdb0b3f2
Use WakuMessage version 1 instead of eth-crypto 2021-07-12 17:09:44 +10:00
Franck Royer 0e9c482a19
Enable decryption of messages retrieve via `WakuStore.queryHistory` 2021-07-12 13:15:19 +10:00
Franck Royer d68ee3fb74
New `peers` and `randomPeer` methods to return available peers 2021-07-12 13:15:19 +10:00
Franck Royer 4fe0116039
Use ecies library that provide right ECIES parameters 2021-07-12 11:30:19 +10:00
Franck Royer 8cd5a52eba
Provide hex/bytes utils as part of js-waku 2021-07-09 15:50:17 +10:00
Franck Royer 34e6ac5247
Add version 1 support to WakuMessage 2021-07-09 15:50:15 +10:00
Franck Royer 2266f31d30
Move optional parameters to a single `Options` object. 2021-07-09 15:50:15 +10:00
Franck Royer aaf3b1867e
Disable keep alive by default as latest nim-waku release does not
support ping protocol.
2021-07-05 09:40:07 +10:00
Franck Royer 370a347ff2
Actually disable keep alive if set to 0 2021-07-02 10:51:58 +10:00
Franck Royer 6cb92dd4b9
Upgrade to latest libp2p versions
And few other packages
2021-06-22 13:21:23 +10:00
Franck Royer e3b4a42822
Add keep alive feature
Using libp2p ping protocol.
2021-06-21 09:46:29 +10:00
Franck Royer 939b5fb20a
Auto select peer if none provided for store and light push protocols 2021-06-16 23:51:20 +10:00
Franck Royer 60eb473047
Add `WakuRelay.deleteObserver` to allow removal of observers
Useful when a React component add observers when mounting and needs to
delete it when unmounting.
2021-06-16 16:37:04 +10:00
Franck Royer 6ed7445d83
Release 0.7.0
### Changed
- Test: Upgrade nim-waku node to v0.4.
- Waku Light Push upgraded to `2.0.0-beta1`.
- Examples (web chat): Catch error if chat message decoding fails.
- Examples (web chat): Do not send message if shift/alt/ctrl is pressed,
 enabling multiline messages.
2021-06-15 15:36:47 +10:00
Franck Royer c293e268e8
Do not send message if a modifier is pressed to enable multiline msgs 2021-06-11 14:38:31 +10:00
Franck Royer 8073021d82
Do not fail if a chat message is malformed 2021-06-11 14:38:22 +10:00
Franck Royer bc544c8e0b
Update Light Push protocol string to match nim-waku v0.4 2021-06-11 14:38:08 +10:00
Franck Royer ba8390f02a
Upgrade nim-waku to v0.4 2021-06-11 14:37:54 +10:00
Franck Royer e75fb91d3f
Release 0.6.0
### Changed
- **Breaking**: Websocket protocol is not automatically added anymore
  if the user specifies a protocol in `libp2p.modules` when using
  `Waku.create`.
- **Breaking**: Options passed to `Waku.create` used to be passed to
  `Libp2p.create`; Now, only the `libp2p` property is passed to
  `Libp2p.create`, allowing for a cleaner interface.
- Examples (cli chat): Use tcp protocol instead of websocket.

### Added
- Enable access to `WakuMessage.timestamp`.
- Examples (web chat): Use `WakuMessage.timestamp` as unique key for
  list items.
- Doc: Link to new [topic guidelines](https://rfc.vac.dev/spec/23/) in
  README.
- Doc: Link to [Waku v2 Toy Chat specs](https://rfc.vac.dev/spec/22/) in
  README.
- Examples (web chat): Persist nick.
- Support for custom PubSub Topics to `Waku`, `WakuRelay`, `WakuStore`
  and `WakuLightPush`;
  Passing a PubSub Topic is optional and still defaults to
  `/waku/2/default-waku/proto`;
  JS-Waku currently supports one, and only, PubSub topic per instance.
2021-06-09 20:49:19 +10:00
Franck Royer 2350ce5a6f
Clarify new libp2p modules transport behaviour 2021-06-09 16:59:27 +10:00
Franck Royer 1bb1f8f6b6
Use tcp protocol only
Due to #201, Websocket protocol is not added by default if the caller
specifies a protocol for libp2p.

In the case cli-chat. We were using both tcp and ws.
As the web-chat already demonstrates usage of websocket protocol, we
cli-chat to tcp only.
2021-06-09 16:58:08 +10:00
Franck Royer 5ce0717f05
Enable passing a custom pubsub topic
Note that we currently only support one, and only one, pubsub topic for
a given instance across the codebase. The PubSub topic needs to be set
when instantiating the Waku* classes.

At this stage, we believe that most DApp will use, and only use, the
default PubSub topic. Some application want to use an alternative topic
but not use the default one so this behaviour should be fine. See #174
for details.
2021-06-09 15:00:03 +10:00
Franck Royer f17a008278
Separate the libp2p create options from Waku's 2021-06-09 15:00:02 +10:00
Franck Royer 6b48c55266
Persist nick 2021-06-04 15:15:07 +10:00
Franck Royer 39f96f4a56
Add link to Waku v2 Toy Chat specs 2021-06-01 16:35:52 +10:00
Franck Royer 5de796ea70
Add link to new topic usage recommendation 2021-06-01 16:35:52 +10:00
Franck Royer 553c0154d9
Use waku message timestamp as better unique key 2021-05-28 22:38:00 +10:00
Franck Royer 9e64eec2a6
Enable test encoding and decoding of WakuMessage.timestamp 2021-05-28 22:35:59 +10:00
Franck Royer 80e7ae9d1e
Release 0.5.0 2021-05-21 15:43:34 +10:00
Franck Royer 90e224577f
Add `--help` command 2021-05-19 12:29:30 +10:00
Franck Royer 2ea17bfdfa
Use light push to send messages if it's passed 2021-05-19 12:29:29 +10:00
Franck Royer fb7e9f2b9e
Get messages from store in chronological order 2021-05-19 12:29:29 +10:00