Commit Graph

396 Commits

Author SHA1 Message Date
Franck R c31972de02
Reorganize tests to ensure they all display under a section (#421) 2022-01-24 11:00:41 +11:00
Franck R 34e4cbba73
Use websocket instead of tcp in interop tests (#418) 2022-01-20 13:00:58 +11:00
Franck R cba5212872
Upgrade nim-waku to v0.7 (#417) 2022-01-19 15:43:45 +11:00
Franck R e1629b1a96
Fix DNS Discovery (#411) 2022-01-17 14:21:23 +11:00
Franck R 96cf24d34e
Allow specifying decryption methods and content topic (#409) 2022-01-17 14:11:05 +11:00
Franck Royer 2c16f0befb
Separate tests that use DNS data in CI 2022-01-14 12:44:06 +11:00
Franck Royer b65ab17cb9
Expose types to ensure documentation is complete 2022-01-13 16:40:11 +11:00
Franck Royer 6276b1537f
Remove unnecessary declaration of Buffer
It's handled by the polyfill config in webpack.
2022-01-13 16:40:10 +11:00
Franck Royer fa4e94750f
Make parseBootstrap a class
Makes it easier to use the resulting function and document defaults.
2022-01-13 16:40:10 +11:00
Franck Royer ae0faa2146
Clarify default DNS servers 2022-01-13 16:39:52 +11:00
Franck Royer f0eb9d1609
Rename libp2p bootstrap import
To avoid name conflict.
2022-01-13 16:39:52 +11:00
Franck Royer e871da056f
Export enr, dns, entree modules 2022-01-13 16:39:52 +11:00
Franck Royer 4bfe060064
Export BootstrapOptions 2022-01-13 16:39:52 +11:00
Franck Royer 284644b822
Fix-up new bootstrap API 2022-01-13 16:39:52 +11:00
Franck Royer e47335f4c0
Implement DNS Discovery and ENR tree 2022-01-13 15:38:22 +11:00
Franck Royer e244bae03d
Renamed `getBootstrapNodes` to `getNodesFromHostedJson`
So that the name better matches the function's behaviour.
2022-01-13 15:33:37 +11:00
Franck Royer f4f6b4a808
Create discovery submodule 2022-01-12 14:54:00 +11:00
dependabot[bot] 7adb51a9cc
Bump ts-proto from 1.97.0 to 1.100.0
Bumps [ts-proto](https://github.com/stephenh/ts-proto) from 1.97.0 to 1.100.0.
- [Release notes](https://github.com/stephenh/ts-proto/releases)
- [Changelog](https://github.com/stephenh/ts-proto/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stephenh/ts-proto/compare/v1.97.0...v1.100.0)

---
updated-dependencies:
- dependency-name: ts-proto
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 15:31:46 +11:00
Franck 06d89418aa
Format change 2022-01-05 11:27:37 +11:00
Franck 8000afbc72
typo 2022-01-04 17:33:04 +11:00
Franck fa3ab19176
Generate proto files withts-protoa 1.97.0 2022-01-03 10:56:37 +11:00
Franck 7a3e46a384
Add encoded value for reference for other implementations 2021-12-07 09:16:32 +11:00
Franck eb1b384be4
Remove console.log 2021-12-06 14:32:18 +11:00
F 01c66f7e89
Add ENR with multiaddr
Imported from https://github.com/D4nte/discv5/pull/1
Replaced bcrypto backend with secp256k1.
2021-12-06 14:29:08 +11:00
F eb9057fc8f
doc: Remove warnings 2021-12-02 23:51:54 +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 6f4d765e30
Remove useless log 2021-10-05 13:36:04 +11:00
Franck Royer 62b30b3f33
Log queried store peer info 2021-10-05 13:36:04 +11:00
Franck Royer 92ee5b060c
doc: Move comments to ensure they appear in generated documentation 2021-10-05 13:36:03 +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 c990660fb9
Rename node only suites 2021-09-24 17:15:46 +10:00
Franck Royer 928d888ad8
Remove 'browser' from test filename
These tests are run both on node and in browser.
2021-09-24 17:09:34 +10:00
Franck Royer d900945b6d
Add 'node' in test file names that only run on node 2021-09-24 17:09:34 +10:00
Franck Royer d875994908
Fix hearbeat tick handler rounding issue
807bf282c5
2021-09-24 10:36:19 +10:00
Franck Royer 2eb88068ae
Test default discovery as part of the CI 2021-09-21 14:47:45 +10:00
Franck Royer 640a672257
Do not setup libp2p discovery module if we fail to retrieve node addrs 2021-09-21 14:47:45 +10:00
Franck Royer a95315eeb5
Ensure node address is returned for Object type responses 2021-09-21 14:47:45 +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 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 75f605a676
Improve error text
To make it clearer what the issue is.
2021-09-02 15:20:44 +10:00
Franck Royer 50fb533e44
test: Increase timeouts + add debug logs 2021-09-02 15:20:43 +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 f4cae60ef8
Fix documentation 2021-09-02 15:15:43 +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 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 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 026aaaf67e
Remove default value
Default value is handled one layer above.
2021-08-20 10:12:56 +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 3f95934250
Replace deprecated package for libp2p-noise 2021-08-19 11:26:34 +10:00
Franck Royer 6d42c39298
export values so they are included in the documentation 2021-08-13 16:18:03 +10:00
Franck Royer bac26ea3da
fixup 2021-08-13 16:18:02 +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 355b8414d8
Separate shutdown process to pinpoint CI failure 2021-08-09 12:27:52 +10:00
Franck Royer dcdab3203d
Replace nim-waku log grep with new pattern 2021-08-09 12:27:22 +10:00
Franck Royer 80cfa3c87a
Increase timeout to shutdown node 2021-08-09 12:09:21 +10:00
Franck Royer c14951cb0e
Increase timeout for nim-waku starts
Took 5 seconds in CI run.
2021-08-09 11:58:58 +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 d035359616
Workaround the fact that ni-waku does not accept integers as timestamp 2021-08-05 13:32:37 +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 5e056d8b81
Shorten imports, remove warning 2021-07-28 11:58:05 +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 c4d0501c6a
nim-waku v0.5 uses new waku relay protocol id 2021-07-26 11:35:08 +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 6817a2f6b2
Pass timestamp to RPC call 2021-07-26 11:32:50 +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 6135127e5d
Correct name 2021-07-21 15:02: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 addf9543a2
Export `generatePrivateKey` and `getPublicKey` directly from the root 2021-07-16 09:43:10 +10:00
Franck Royer f3738b1eac
doc: Fix keep alive default value 2021-07-15 14:00:24 +10:00
Franck Royer 0b3f1a33c2
test: Symmetric encryption with waku store 2021-07-15 12:26:05 +10:00
Franck Royer 44efd28ac1
Update terminology and docs to cater for both sym and asym encryption 2021-07-15 12:25:47 +10:00
Franck Royer b74acd73dc
Remove unknown type 2021-07-15 12:16:21 +10:00
Franck Royer 75d1b3834c
Simplify expression 2021-07-15 12:16:03 +10:00
Franck Royer 13c8a0527b
Test symmetric encryption with nim-waku using relay 2021-07-15 12:12:43 +10:00
Franck Royer 302fc20243
Remove dupe tests 2021-07-15 10:36:24 +10:00
Franck Royer 9374de1931
Karma: Remove tests folder and use in place files & update contrib guide
*.browser.spec.ts files will be tested on both node and browser.
Other files only tested on node.
2021-07-15 10:36:24 +10:00
Franck Royer 25fccb4c9a
Add symmetric encryption support to Waku Message 2021-07-15 10:23:40 +10:00
Franck Royer 56c30059b2
Add comments on Waku Message Options 2021-07-15 10:23:34 +10:00
Franck Royer 57f65267c2
Implement and test symmetric encryption in the browser 2021-07-14 16:31:11 +10:00
Franck Royer 06ee0ac1d8
Symmetric encryption for node 2021-07-14 15:34:48 +10:00
Franck Royer ac4f0aab98
Only include lib files, segregate browser tests 2021-07-14 13:04:11 +10:00
Franck Royer a9c83dac13
Do not use same key value for both constants 2021-07-14 13:03:22 +10:00
Franck Royer e443237a81
Remove local type definitions for Karma to not return "not found" 2021-07-14 12:25:23 +10:00
Franck Royer 70058f0e36
Split browser and node tests 2021-07-14 11:56:48 +10:00
Franck Royer a0d3a21762
Improve importing of Muxed Stream type 2021-07-14 11:38:59 +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 63923f4368
Prefer usage of utils 2021-07-09 16:06:49 +10:00
Franck Royer b70f7c5a95
Use DOM random generator if available 2021-07-09 16:06:49 +10:00
Franck Royer 1f6ed9b525
Prefer secp256k1 lib over ecies 2021-07-09 15:50:17 +10:00
Franck Royer 2b1a6dafea
Skip nim-waku interop tests
ecies-parity does not provide the same ECIES that waku:
ecies-parity uses a shared hmac of `[0,0]` whereas waku uses `[]`.

Work is needed to find or create a new library.
2021-07-09 15:50:17 +10:00
Franck Royer 8cd5a52eba
Provide hex/bytes utils as part of js-waku 2021-07-09 15:50:17 +10:00
Franck Royer 22c716e0e6
Add API to generate keys 2021-07-09 15:50:16 +10:00
Franck Royer f123cd7e62
Test asymmetric encryption against nim-waku 2021-07-09 15:50:16 +10:00
Franck Royer f95d9aec3c
Add version 1 support to waku relay, test decryption against nim-waku 2021-07-09 15:50:16 +10:00
Franck Royer acdc032253
Simplify code 2021-07-09 15:50:16 +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 381333347e
Remove dupe code 2021-07-09 15:50:15 +10:00
Franck Royer f2a2233c77
Add encrypt/decrypt asymmetric 2021-07-09 15:50:15 +10:00
Franck Royer f97dc4de81
Implement Waku Message Version 1 encoding and signature 2021-07-09 14:49:09 +10:00
Franck Royer 7b5c8d6094
Move waku_message to dedicated folder 2021-07-09 14:49:09 +10:00
Franck Royer c3b726cb99
Remove deprecated call 2021-07-09 14:49:08 +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 354dcd66a5
Constructor is more appropriate when comparing function signatures 2021-07-02 13:52:50 +10:00
Franck Royer 370a347ff2
Actually disable keep alive if set to 0 2021-07-02 10:51:58 +10:00
Franck Royer 8cecfc205b
Use plain websocket in tests
Thanks to the libp2p upgrade, waku actually tries to listen to a
secure websocket. Using plain websocket for now, testing secure
websocket is tracked with #50.
2021-06-22 14:11:38 +10:00
Franck Royer 6cb92dd4b9
Upgrade to latest libp2p versions
And few other packages
2021-06-22 13:21:23 +10:00
Franck Royer dbab0cc582
Unnecessary and create conflicts due to disparity of version
Between libp2p-interfaces from libp2p and libp2p-gossipsub.
2021-06-22 10:08:02 +10:00
Franck Royer 381fc8b82c
Add keep alive feature
Using libp2p ping protocol.
2021-06-21 09:46:41 +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 af1e97fafe
Use Set to facilitate removal of observers 2021-06-16 16:37:04 +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 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 f0f14f9995
Rename type before introducing CreateOptions 2021-06-09 15:00:03 +10:00
Franck Royer eb521b4dbd
Extract subscription logic from start method 2021-06-09 15:00:02 +10:00
Franck Royer d8629b7fbc
Define type for WakuRelay create options 2021-06-09 15:00:02 +10:00
Franck Royer f17a008278
Separate the libp2p create options from Waku's 2021-06-09 15:00:02 +10:00
Franck Royer 9e64eec2a6
Enable test encoding and decoding of WakuMessage.timestamp 2021-05-28 22:35:59 +10:00
Franck Royer 3055881c57
Proto message is expected, not the wrapping class 2021-05-28 15:59:57 +10:00
Franck Royer b13ecdd45f
Do not inherit doc for Waku Relay
As it clutters the documentation and at this stage we do not expect
users to use inherited methods.
2021-05-21 11:47:17 +10:00
Franck Royer c347ec28b4
Ensure that no unnecessary js node are started for interop tests
Indeed, the beforeEach/afterEach methods are called for all tests in the
block, including interop tests.
2021-05-20 15:49:13 +10:00
Franck Royer ed69122ac3
Remove warning 2021-05-19 12:55:39 +10:00
Franck Royer fb7e9f2b9e
Get messages from store in chronological order 2021-05-19 12:29:29 +10:00
Franck Royer de3aea626a
Implement Light Push protocol 2021-05-19 12:29:29 +10:00
Franck Royer 2cd87b561d
Expose `Enviroment` & `Protocol` enums to pass to `getStatusFleetNodes` 2021-05-18 13:45:49 +10:00
Franck Royer 537a2b73a7
Use prod nodes by default instead of test 2021-05-18 13:26:42 +10:00
Franck Royer 243b6629c3
Add callback option to store query 2021-05-17 16:32:34 +10:00
Franck Royer 4b6fe84392
Use one object as we are increasing the number of parameters 2021-05-17 16:32:33 +10:00
Franck Royer 79bef35460
Add and use `getStatusFleetNodes` to connect to Status' wakunodes 2021-05-15 19:52:05 +10:00
Franck Royer a8d4d494f8
Add getPeers method
To know if relay messages would be published.
2021-05-13 20:48:33 +10:00
Franck Royer eb9955314c
Align terminology with specs
In specs, this is referenced as a `pubsubTopic`.
2021-05-13 20:48:30 +10:00
Franck Royer 065593b0cf
Revert naming to js-waku
To align with go-waku and nim-waku and keep bors working.
2021-05-13 20:27:38 +10:00