Commit Graph

131 Commits

Author SHA1 Message Date
Derrick Hammer 9c471e6949
fix: fix outdated reads. port of s5 08c4bda5c1109673fba907ba119c9855fc3fcf68 0d2bf39845b37dd0b2ebe06be34c5d51e7060280 2023-09-04 07:19:19 -04:00
Derrick Hammer b91f33fb65
refactor: add publicKeyRaw method to ed25519 2023-09-02 22:35:38 -04:00
Derrick Hammer a34bd1b813
refactor: move hash types to frozen object group 2023-09-02 06:10:20 -04:00
Derrick Hammer 6d575a1cec
fix: freeze REGISTRY_TYPES 2023-09-02 05:36:31 -04:00
Derrick Hammer d05d011fcd
refactor: switch to using frozen objects to store CID_TYPES, METADATA_TYPES, and PARENT_LINK_TYPES 2023-09-02 05:33:44 -04:00
Derrick Hammer cc66a0d839
feat: add const groups of the different set of types 2023-09-02 05:19:09 -04:00
Derrick Hammer 6cc0bd6500
fix: if a peer completed the handshake, but our node is stopped, end the peer and abort 2023-09-02 04:50:52 -04:00
Derrick Hammer 8373114d5c
fix: utf8ToBytes no longer needed 2023-09-01 23:31:49 -04:00
Derrick Hammer 384e941b09
fix: set sublevel valueEncoding to buffer 2023-09-01 23:10:18 -04:00
Derrick Hammer a6c02bc772
fix: set sublevel valueEncoding to buffer 2023-09-01 23:09:13 -04:00
Derrick Hammer 419c7f85a8
fix: convert binary string to uint8array 2023-09-01 21:48:17 -04:00
Derrick Hammer deebe15c6f
fix: add started state on node and check it on connectToNode 2023-09-01 21:07:28 -04:00
Derrick Hammer e3b7760050
fix: need to use close not end on WS transport 2023-09-01 21:01:24 -04:00
Derrick Hammer dfe9e3f082
fest: add stop method 2023-09-01 20:55:21 -04:00
Derrick Hammer 90c0614773
refactor: add end method to transports 2023-09-01 20:55:08 -04:00
Derrick Hammer fabda024ad
fix: fix iteration of peers 2023-09-01 20:46:37 -04:00
Derrick Hammer daf357cd63
fix: correct argument order on ed25519.verify 2023-09-01 20:41:32 -04:00
Derrick Hammer 1a3241688c
fix: add try/catch on db.get 2023-09-01 20:27:34 -04:00
Derrick Hammer 4e6f1b3ad3
refactor: use node.services.p2p 2023-09-01 20:20:30 -04:00
Derrick Hammer d9af5bd015
fix: set node registry service in service constructor 2023-09-01 20:20:08 -04:00
Derrick Hammer b34b7a3a01
feat: add eventemitter support on p2p service and have the handshakedone message emit peerConnected 2023-09-01 19:49:42 -04:00
Derrick Hammer 2061f6330d
feat: add BOOTSTRAP_NODES constant 2023-09-01 19:21:59 -04:00
Derrick Hammer ca1a3dd5e7
fix: fix import 2023-09-01 09:24:50 -04:00
Derrick Hammer 5d26f1ec61
refactor: export SignedRegistryEntry 2023-09-01 09:20:12 -04:00
Derrick Hammer 1b04799943
refactor: listen only needs to return the done handler 2023-09-01 08:24:55 -04:00
Derrick Hammer 8b1325f631
refactor: rewrite listen 2023-09-01 08:14:59 -04:00
Derrick Hammer a75c57b1e8
feat: port listen method 2023-09-01 08:02:05 -04:00
Derrick Hammer 9645105ec3
fix: await not needed 2023-09-01 07:55:43 -04:00
Derrick Hammer ade87a9934
refactor: signRegistryEntry does not need to be async 2023-09-01 07:51:40 -04:00
Derrick Hammer bda8007cdf
refactor: make timeout a utility function 2023-09-01 07:33:30 -04:00
Derrick Hammer f306ee2166
style: format 2023-09-01 07:30:56 -04:00
Derrick Hammer 1c1ec9703a
fix: export S5Node type 2023-09-01 07:28:21 -04:00
Derrick Hammer 80dd92ddb1
fix: browser returns a Blob, so convert to a buffer if we have a blob 2023-09-01 06:39:25 -04:00
Derrick Hammer 8b7ffa8821
fix: missing uri argument for node WS 2023-09-01 06:38:51 -04:00
Derrick Hammer 0a153379c8
fix: add support for browser WS by checking if we are in node 2023-09-01 06:19:56 -04:00
Derrick Hammer 46098bd07f
refactor: export constants 2023-09-01 03:18:37 -04:00
Derrick Hammer a4c5dd5b5b
fix: make uris optional 2023-08-31 18:49:00 -04:00
Derrick Hammer a7b3129426
fix: only set socket if passed 2023-08-31 18:44:03 -04:00
Derrick Hammer d84aa18174
refactor: make uris default to an empty array 2023-08-31 18:31:43 -04:00
Derrick Hammer 1f391c15b1
refactor: update createTransportPeer 2023-08-31 18:03:47 -04:00
Derrick Hammer 57e2c56d24
refactor: create PeerConstructorOptions type 2023-08-31 18:00:59 -04:00
Derrick Hammer a84c02c36f
refactor: update Peer constructor to take an object bag 2023-08-31 17:53:44 -04:00
Derrick Hammer bc608d00e3
refactor: consolidate to BasePeer class and export BasePeer 2023-08-31 17:32:37 -04:00
Derrick Hammer 16d0c758f3
refactor: export NodeId 2023-08-31 11:10:15 -04:00
Derrick Hammer 9305f3d42c
fix: fix imports 2023-08-31 11:02:17 -04:00
Derrick Hammer 6e74ef6d8f
refactor: move S5NodeConfig to types and make network optional 2023-08-31 10:58:10 -04:00
Derrick Hammer 0af8bb3469
fix: use URL type from url package not global URL 2023-08-31 09:52:22 -04:00
Derrick Hammer 42ef635fb5
fix: add createKeyPair factory that defaults to a random key 2023-08-31 07:22:16 -04:00
Derrick Hammer e110f8f197
refactor: conditionally load tcp transport 2023-08-31 07:10:16 -04:00
Derrick Hammer 87d1e6b0b4
fix: update registered messages 2023-08-31 06:54:16 -04:00
Derrick Hammer 35ebf74f4c
fix: need to use unpacked data from signed message 2023-08-31 06:53:52 -04:00
Derrick Hammer e342982163
fix: fix object references 2023-08-31 06:53:25 -04:00
Derrick Hammer 7afc759ece
fix: need to store peer, set the id the pass it to onNewPeer 2023-08-31 06:50:24 -04:00
Derrick Hammer 5585907591
fix: ed25519.sign arguments are wrong order 2023-08-31 06:49:59 -04:00
Derrick Hammer 6ebc477449
fix: add getter for networkId and hashQueryRoutingTable 2023-08-31 06:49:33 -04:00
Derrick Hammer b5e491b01a
fix: missing p2p object on S5Config 2023-08-31 06:18:59 -04:00
Derrick Hammer aed4865b73
refactor: major refactor to put p2p message routing into map based handlers with types 2023-08-31 06:09:23 -04:00
Derrick Hammer db72e1eefd
refactor: change transport handling to be dynamic, so new ones can be registered 2023-08-31 05:04:33 -04:00
Derrick Hammer 08123762ce
refactor: export SignedRegistryEntry 2023-08-31 04:15:50 -04:00
Derrick Hammer a1549523fb
refactor: update exports and add factory for S5Node 2023-08-31 03:49:31 -04:00
Derrick Hammer a189fab1be
refactor: use a simple S5Node object to coordinate everything with helper getters 2023-08-31 03:29:28 -04:00
Derrick Hammer 5a1dca9775
fix: add some exports 2023-08-31 02:37:32 -04:00
Derrick Hammer 05cbd60373
refactor: make deserializeRegistryEntry a method 2023-08-31 02:37:06 -04:00
Derrick Hammer 1221d7de63
fix: fix retry logic 2023-08-31 02:36:32 -04:00
Derrick Hammer a021243c89
fix: we dont need to strip out auth 2023-08-31 02:35:29 -04:00
Derrick Hammer a4b692b28f
fix: check protocol with colon 2023-08-31 02:34:59 -04:00
Derrick Hammer 17ff5fd96b
fix: unsupported url needs to be a real but dummy one 2023-08-31 02:34:13 -04:00
Derrick Hammer 2ef91a4d9c
refactor: need to use a query chain access 2023-08-31 02:32:59 -04:00
Derrick Hammer 91034708bc
refactor: reconnectDelay and _peers need to store by the string version of peer id 2023-08-31 02:32:04 -04:00
Derrick Hammer 56bb5007f6
refactor: add registry message handling back in 2023-08-31 02:30:19 -04:00
Derrick Hammer 68b7ffa855
fix: do a truthy check on networkId 2023-08-31 02:29:32 -04:00
Derrick Hammer 68e6c3a682
fix: update level imports 2023-08-31 02:29:09 -04:00
Derrick Hammer 91a15bd428
fix: update import 2023-08-31 02:28:33 -04:00
Derrick Hammer ae40d52f9e
fix: remove unneeded getPublicKey call 2023-08-31 02:28:24 -04:00
Derrick Hammer 22e486ea18
fix: add registry to services object in interface 2023-08-31 02:28:01 -04:00
Derrick Hammer eaf35bcd2e
refactor: update db store structure to create sublevel inside p2p service and not pass it to it 2023-08-31 02:27:29 -04:00
Derrick Hammer 42cd101fb2
fix: pass the event data, not the event itself 2023-08-31 02:25:52 -04:00
Derrick Hammer 132f43c34b
fix: import websocket 2023-08-31 02:25:37 -04:00
Derrick Hammer fbffb1da72
fix: need a getter for id 2023-08-31 02:25:27 -04:00
Derrick Hammer 31e63f6c63
fix: _newBuf needs to reset offset to 0 2023-08-31 02:23:49 -04:00
Derrick Hammer 2f2ae2f4fc
feat: initial version 2023-08-30 14:38:53 -04:00