From 30c0c0b30be521036ea79b437ef752f3ec9de4f4 Mon Sep 17 00:00:00 2001 From: farhoud Date: Fri, 25 Mar 2022 17:43:05 +0430 Subject: [PATCH 01/11] rewrite private-network RFC --- docs/RFCs/pnet.md | 56 ------------------------------ docs/RFCs/private-network.md | 66 ++++++++++++++++++++++++++++++++++++ sidebars.js | 2 +- 3 files changed, 67 insertions(+), 57 deletions(-) delete mode 100644 docs/RFCs/pnet.md create mode 100644 docs/RFCs/private-network.md diff --git a/docs/RFCs/pnet.md b/docs/RFCs/pnet.md deleted file mode 100644 index 9e2d7b6..0000000 --- a/docs/RFCs/pnet.md +++ /dev/null @@ -1,56 +0,0 @@ -- Feature Name: private-network-for-privacy -- Start Date: 2022-02-01 -- RFC PR: -- Functionland Issue: - -# Summary -[summary]: #summary - -Using build-in p-net of libp2p and creating secure network for user. and isolate his private content from public ipfs -network. we can containerize @functionland/box (ipfs + orbitdb + protocol-suite) and run: -- public @functionland/box for sharing. -- a private @functionland/box pre user of the box. - -# Motivation -[motivation]: #motivation - -IPFS is built around public data and p2p networks. When you start a node it’s trying to find and connect to other peers, -so it finds more peers and content. And what you hold on your ipfs is not only accessible by others, but it's also -publicly broadcast (for purposes of content routing and peer routing) and in our protocol we also have to expose peer-id -of the user. even by using encryption we are putting user at risk. if he loses a key all his content are publicly distributed -on ipfs network. libp2p has a build in future call pnet which we can use to isolate user private data in his own network -and only uses public network for sharing and public data. -We can also bring multi-tenancy by letting owner create network for his family member. - -# Guide-level explanation -[guide-level-explanation]: #guide-level-explanation -base on user configuration we will create a docker swarm which will run @functionland/box in private and public mode. -for creating a private @functionland/box we need to generate key and share it using docker secret. - -# Reference-level explanation -[reference-level-explanation]: #reference-level-explanation - - - -# Drawbacks -[drawbacks]: #drawbacks - -the exchanging and rotation mechanism for this key is on our shoulder. - -# Rationale and alternatives -[rationale-and-alternatives]: #rationale-and-alternatives - - -# Prior art -[prior-art]: #prior-art - - -# Unresolved questions -[unresolved-questions]: #unresolved-questions -- the exchanging and rotation mechanism for private key. -- we can create private network for every user of the box but does it mean we should do it? - - -# Future possibilities -[future-possibilities]: #future-possibilities - diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md new file mode 100644 index 0000000..80347bd --- /dev/null +++ b/docs/RFCs/private-network.md @@ -0,0 +1,66 @@ +- Feature Name: private-network +- Start Date: 2022-02-01 +- RFC PR: +- Functionland Issue: + +## Background +we are using IPFS as our file system. but IPFS is build to use for public data, and it does not support ACL, +so we need to find a way to keep user safe until our security layer become mature. + +## Problem Statement +We need to protect user and his/her data from harms and risk of public network. + +## Motivation +Isolating User from public network can help us relax the problem and build useful product and testing our security layer without putting user in harms way. + +## Proposal +using IPFS build-in private network. base on [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) +Its uses a pre-shared key (PSK) to create a private network with encrypted communication. + +For box setup user provide an environment variable SECRET which is password he should remember. +the secret then convert to a hash of 256 bit by algorithm like sha256 and generate the swarm.key for ipfs and libp2p node's. + +For Fula client when user call createClient he should also provide the password he used for setting the box's. + +For network discovery its manual process that user should provide all box peer id's in config. + +## Scope of work +- human friendly password to swarm.key +- box should look for SECRET env variable and if it exit set the connProtector for libp2p config +- fula-client constructor should get another parameter call secret and if exist set connProtector for libp2p +- create an example for the describing functionality + +## Implementation +### human-readable password +Convert a human-readable password to swarm.key +simplest way is to use ['libp2p-crypto'](https://github.com/libp2p/js-libp2p-crypto#cryptopbkdf2password-salt-iterations-keysize-hash) (it works both on browser and node) +```js +import crypto from 'libp2p-crypto' +const salt = ''; +const passwordToPKey = (password) => { + // it should be somthing like this + const key = crypto.pbkdf2(password, salt, 5, 256, 'sha2-256') + pkey = `/key/swarm/psk/1.0.0/ + /base16/ + ${key}` + return new TextEncoder().encode(key) +} + +``` +the box and client already support pkey input, but we should add the above function to them +and after that we should change existing pkey on both fula and box to use the above function. + +for creating an example we can create copy of react-gallery and add the password field in config.
+note: if example repo would be outside mono-repo we can just use branch for describing every functionality. + + +## Alternative approaches +- Using VPN for creating the private network + - It adds another point of failure to the system. + +## Risks +### Work prioritization +### Anything that impacts the value of RFC +### what could impact delivery of this RFC? +## dependencies +## Impact diff --git a/sidebars.js b/sidebars.js index 53e7b9c..ecf85cd 100644 --- a/sidebars.js +++ b/sidebars.js @@ -65,7 +65,7 @@ const sidebars = { id:'RFCs/rfc-process' }, items:[ - 'RFCs/pnet', + 'RFCs/private-network', 'RFCs/replication' ] } From d5e3598659a64c78e3986f0268c6f3efe5e49c59 Mon Sep 17 00:00:00 2001 From: Farhoud Date: Sat, 26 Mar 2022 13:33:06 +0430 Subject: [PATCH 02/11] Update docs/RFCs/private-network.md Co-authored-by: Masih H. Derkani --- docs/RFCs/private-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 80347bd..2f23753 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -8,7 +8,7 @@ we are using IPFS as our file system. but IPFS is build to use for public data, so we need to find a way to keep user safe until our security layer become mature. ## Problem Statement -We need to protect user and his/her data from harms and risk of public network. +We need to protect user and their data from harms and risk of public network. ## Motivation Isolating User from public network can help us relax the problem and build useful product and testing our security layer without putting user in harms way. From 44ac8d5af137715bd84856a3fc313b3fdfa76502 Mon Sep 17 00:00:00 2001 From: Farhoud Date: Sat, 26 Mar 2022 13:33:19 +0430 Subject: [PATCH 03/11] Update docs/RFCs/private-network.md Co-authored-by: Masih H. Derkani --- docs/RFCs/private-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 2f23753..627475e 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -4,7 +4,7 @@ - Functionland Issue: ## Background -we are using IPFS as our file system. but IPFS is build to use for public data, and it does not support ACL, +We are using IPFS as our file system. But IPFS is built to use for public data, and it does not support ACL, so we need to find a way to keep user safe until our security layer become mature. ## Problem Statement From 10de984222907153d4c4915713a475df7195dd83 Mon Sep 17 00:00:00 2001 From: Farhoud Date: Sat, 26 Mar 2022 13:34:04 +0430 Subject: [PATCH 04/11] Update docs/RFCs/private-network.md Co-authored-by: Masih H. Derkani --- docs/RFCs/private-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 627475e..4b5eb48 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -5,7 +5,7 @@ ## Background We are using IPFS as our file system. But IPFS is built to use for public data, and it does not support ACL, -so we need to find a way to keep user safe until our security layer become mature. +so we need to find a way to keep users safe until our security layer becomes mature. ## Problem Statement We need to protect user and their data from harms and risk of public network. From 041a0b73adea2c1471bf9600451b1540fa93c5fd Mon Sep 17 00:00:00 2001 From: Farhoud Date: Sat, 26 Mar 2022 13:34:28 +0430 Subject: [PATCH 05/11] Update docs/RFCs/private-network.md Co-authored-by: Masih H. Derkani --- docs/RFCs/private-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 4b5eb48..71915fe 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -11,7 +11,7 @@ so we need to find a way to keep users safe until our security layer becomes mat We need to protect user and their data from harms and risk of public network. ## Motivation -Isolating User from public network can help us relax the problem and build useful product and testing our security layer without putting user in harms way. +Isolating users from public network can help us reduce the scope of work while maintaining the usefulness of our product, and testing our security layer without putting users in harm's way. ## Proposal using IPFS build-in private network. base on [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) From d0acb973735f34b6ed4b72c5bcd0d891eba1a32c Mon Sep 17 00:00:00 2001 From: Farhoud Date: Sat, 26 Mar 2022 13:34:42 +0430 Subject: [PATCH 06/11] Update docs/RFCs/private-network.md Co-authored-by: Masih H. Derkani --- docs/RFCs/private-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 71915fe..385a220 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -14,7 +14,7 @@ We need to protect user and their data from harms and risk of public network. Isolating users from public network can help us reduce the scope of work while maintaining the usefulness of our product, and testing our security layer without putting users in harm's way. ## Proposal -using IPFS build-in private network. base on [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) +Using IPFS built-in private network. base on [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) Its uses a pre-shared key (PSK) to create a private network with encrypted communication. For box setup user provide an environment variable SECRET which is password he should remember. From bd04dcd797571b1ae63bfca9942c8e94fc079159 Mon Sep 17 00:00:00 2001 From: Farhoud Date: Sat, 26 Mar 2022 14:09:24 +0430 Subject: [PATCH 07/11] Update docs/RFCs/private-network.md Co-authored-by: Masih H. Derkani --- docs/RFCs/private-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 385a220..26942a7 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -20,7 +20,7 @@ Its uses a pre-shared key (PSK) to create a private network with encrypted commu For box setup user provide an environment variable SECRET which is password he should remember. the secret then convert to a hash of 256 bit by algorithm like sha256 and generate the swarm.key for ipfs and libp2p node's. -For Fula client when user call createClient he should also provide the password he used for setting the box's. +For Fula client when user calls `createClient` they should also provide the password used for setting up the boxes. For network discovery its manual process that user should provide all box peer id's in config. From 683b3d54f77edec8e05d16c24989609635f41584 Mon Sep 17 00:00:00 2001 From: Farhoud Date: Sat, 26 Mar 2022 14:09:47 +0430 Subject: [PATCH 08/11] Update docs/RFCs/private-network.md Co-authored-by: Masih H. Derkani --- docs/RFCs/private-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 26942a7..2f21ea7 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -15,7 +15,7 @@ Isolating users from public network can help us reduce the scope of work while m ## Proposal Using IPFS built-in private network. base on [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) -Its uses a pre-shared key (PSK) to create a private network with encrypted communication. +It uses a pre-shared key (PSK) to create a private network with encrypted communication. For box setup user provide an environment variable SECRET which is password he should remember. the secret then convert to a hash of 256 bit by algorithm like sha256 and generate the swarm.key for ipfs and libp2p node's. From 48e2e0985b51d56c50c61ad04925b8dd33c76426 Mon Sep 17 00:00:00 2001 From: farhoud Date: Sat, 26 Mar 2022 19:44:52 +0430 Subject: [PATCH 09/11] second draft --- docs/RFCs/private-network.md | 118 ++++++++++++++++++++++++----------- 1 file changed, 82 insertions(+), 36 deletions(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 2f21ea7..dea7b96 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -1,62 +1,106 @@ - Feature Name: private-network - Start Date: 2022-02-01 -- RFC PR: -- Functionland Issue: +- RFC PR: https://github.com/functionland/docs/pull/67 +- Functionland Issue: https://github.com/functionland/docs/issues/63 ## Background -We are using IPFS as our file system. But IPFS is built to use for public data, and it does not support ACL, -so we need to find a way to keep users safe until our security layer becomes mature. +We are using IPFS as our file system. But IPFS is built to use for public data, and it does not support ACL, +So we need to find a way to keep users safe until our security layer becomes mature. And also ipfs-cluster [docs](https://cluster.ipfs.io/documentation/guides/security/#ports-overview) recommended to have a secret. + +###Current Network +Our current network topology is too simple, its only base on webrtc-start and peer discovery is disabled. +#### Server +Node with roll of server is a js-libp2p node with our protocol's and server side implementations (use js-ipfs as fs) that listen on [webrtc-start](https://github.com/functionland/fula/blob/main/libraries/fula-client/src/config.ts). + +#### Client +Node with the roll of [client](https://github.com/functionland/fula/tree/main/libraries/fula-client) (phone,webapp) are listening on [webrtc-start](https://github.com/functionland/fula/blob/main/libraries/fula-client/src/config.ts) and when user provide the string peer id (`B58String`) of the box with [connect](https://docs.fx.land/api/client-instance#connect-to-box) API, the api create multiAddress based on webrtc signaling server add it to libp2p peer store and keep the connection alive with the box. +also have to mention inbound connections are blocked. + ## Problem Statement -We need to protect user and their data from harms and risk of public network. +We need to protect users and their data from harms and risks of public networks and also cover the [multi box scenario](https://github.com/functionland/docs/issues/58). +The public network risks are: +- Anyone on the internet can connect to the box. +- Anyone on the internet that is connected to the box can use bitswap to get data from the box. +- Peer routing and Content discovery can leak what you are doing to the public. +- deficiency in our encryption algorithm or key management can leak all user data to the public. +- clusters running without a secret may discover and connect to the main IPFS network, which is mostly useless for the cluster peers (and for the IPFS network). ## Motivation -Isolating users from public network can help us reduce the scope of work while maintaining the usefulness of our product, and testing our security layer without putting users in harm's way. +Isolating users from public networks can help us reduce the scope of work while maintaining the usefulness of our product, and testing our security layer without putting users in harm's way. ## Proposal -Using IPFS built-in private network. base on [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) -It uses a pre-shared key (PSK) to create a private network with encrypted communication. +We can use built-in libp2p components to create a private network with encrypted communication. +The components are: +- Libp2p built-in private network. It uses a [private shared key](https://github.com/libp2p/js-libp2p/tree/master/src/pnet#private-shared-keys) for creating an isolated network with encrypted communication. + - [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) + - [js-doc](https://github.com/libp2p/js-libp2p/tree/master/src/pnet) +- Libp2p bootstrap for bootstrapping the network of boxes: + - [js-doc](https://github.com/libp2p/js-libp2p-bootstrap) -For box setup user provide an environment variable SECRET which is password he should remember. -the secret then convert to a hash of 256 bit by algorithm like sha256 and generate the swarm.key for ipfs and libp2p node's. +In this way when a node comes online, Libp2p uses the key and the list of other node's to join the network. -For Fula client when user calls `createClient` they should also provide the password used for setting up the boxes. +## Scope of work +### Box +For box setup users provide an environment variable `FULA_NET_SECRET` which they should remember. and provide a list of node as `config.json` -For network discovery its manual process that user should provide all box peer id's in config. +### FULA-Client +user calls `createClient` they should also provide the secret they used for setting up the boxes. and when he calls `connect` it should pass the list of string peerId's -## Scope of work -- human friendly password to swarm.key -- box should look for SECRET env variable and if it exit set the connProtector for libp2p config -- fula-client constructor should get another parameter call secret and if exist set connProtector for libp2p -- create an example for the describing functionality - -## Implementation -### human-readable password -Convert a human-readable password to swarm.key -simplest way is to use ['libp2p-crypto'](https://github.com/libp2p/js-libp2p-crypto#cryptopbkdf2password-salt-iterations-keysize-hash) (it works both on browser and node) -```js -import crypto from 'libp2p-crypto' -const salt = ''; -const passwordToPKey = (password) => { - // it should be somthing like this - const key = crypto.pbkdf2(password, salt, 5, 256, 'sha2-256') - pkey = `/key/swarm/psk/1.0.0/ - /base16/ - ${key}` - return new TextEncoder().encode(key) + +## Implementation +The box and client already support private-key but need to add test and fixes namings. +### Box +In the [Config](https://github.com/functionland/fula/blob/main/apps/box/src/config.ts) we should change the name `PKEY` to `FULA_NET_SECRET` + +In the [Config](https://github.com/functionland/fula/blob/main/apps/box/src/config.ts) we should add to support to load `config.json` in this format: + +```json +{ + "nodes": [ + "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", + "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", + "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa" + ] } +``` +Which will be used for creating `js-libp2p-bootstrap` [config](https://github.com/libp2p/js-libp2p-bootstrap). + +### FULA-client +In [fula-client](https://github.com/functionland/fula/blob/main/libraries/fula-client/src/index.ts) We have to change pkey to fulaSecret so: +```ts +createClient(config?: Partial, pKey = undefined): Promise ``` -the box and client already support pkey input, but we should add the above function to them -and after that we should change existing pkey on both fula and box to use the above function. +to +```ts +createClient(config?: Partial, fulaSecret = undefined): Promise +``` +and change connect interface to get a list of peerId`s from: +``` + connect: (peerId: string) => Connection +``` +to +``` + connect: (peerId: [string]) => Connection +``` +And change the logic to connect to all the boxes and keep connection alive. + +## Case Study +For dogfooding of new changes we can copy of [react-gallery](https://github.com/functionland/fula/tree/main/examples/react-gallery). and change +the [`BoxConfig`](https://github.com/functionland/fula/blob/main/examples/react-gallery/src/components/BoxConfig.jsx) +to get list of comma seperated peerIds. -for creating an example we can create copy of react-gallery and add the password field in config.
note: if example repo would be outside mono-repo we can just use branch for describing every functionality. ## Alternative approaches -- Using VPN for creating the private network +### VPN +Using VPN for creating the private network. + +Disadvantage: - It adds another point of failure to the system. + - It is also not that decentralized. ## Risks ### Work prioritization @@ -64,3 +108,5 @@ note: if example repo would be outside mono-repo we can just use branch for desc ### what could impact delivery of this RFC? ## dependencies ## Impact + + From 10225f9395fc9e0369937c048eccb15ec55e9513 Mon Sep 17 00:00:00 2001 From: farhoud Date: Mon, 28 Mar 2022 13:04:07 +0430 Subject: [PATCH 10/11] Add more details on implementation and case study --- docs/RFCs/private-network.md | 50 ++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index dea7b96..4f3ff7d 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -33,10 +33,10 @@ Isolating users from public networks can help us reduce the scope of work while We can use built-in libp2p components to create a private network with encrypted communication. The components are: - Libp2p built-in private network. It uses a [private shared key](https://github.com/libp2p/js-libp2p/tree/master/src/pnet#private-shared-keys) for creating an isolated network with encrypted communication. - - [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) - - [js-doc](https://github.com/libp2p/js-libp2p/tree/master/src/pnet) +- [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) +- [js-doc](https://github.com/libp2p/js-libp2p/tree/master/src/pnet) - Libp2p bootstrap for bootstrapping the network of boxes: - - [js-doc](https://github.com/libp2p/js-libp2p-bootstrap) +- [js-doc](https://github.com/libp2p/js-libp2p-bootstrap) In this way when a node comes online, Libp2p uses the key and the list of other node's to join the network. @@ -51,17 +51,18 @@ user calls `createClient` they should also provide the secret they used for sett ## Implementation The box and client already support private-key but need to add test and fixes namings. ### Box -In the [Config](https://github.com/functionland/fula/blob/main/apps/box/src/config.ts) we should change the name `PKEY` to `FULA_NET_SECRET` +In the [Config](https://github.com/functionland/fula/blob/main/apps/box/src/config.ts) we should change the name `PKEY` to `FULA_NET_SECRET` +We need to add [`js-libp2p-bootstrap`](https://github.com/libp2p/js-libp2p-bootstrap) and In the [Config](https://github.com/functionland/fula/blob/main/apps/box/src/config.ts) we should add to support to load `config.json` in this format: ```json { - "nodes": [ - "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa" - ] + "nodes": [ + "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", + "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", + "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa" + ] } ``` Which will be used for creating `js-libp2p-bootstrap` [config](https://github.com/libp2p/js-libp2p-bootstrap). @@ -78,20 +79,29 @@ createClient(config?: Partial, fulaSecret = ``` and change connect interface to get a list of peerId`s from: ``` - connect: (peerId: string) => Connection +connect: (peerId: string) => Connection ``` to ``` - connect: (peerId: [string]) => Connection + connect: (peerId: [string]) => Connection ``` -And change the logic to connect to all the boxes and keep connection alive. + +We need to change [`Connection`](https://github.com/functionland/fula/blob/main/libraries/fula-client/src/connection.ts) in the way that: +- Connection `Status` +- If we connect to at least one box we are `Online`. +- When we are not connected to any box and try to connect we are at `Connecting`. +- When connection fails to all the serverPeerIds we Are `Offline`. +- Connection should have a list of `serverPeerId`. +- Connect to all the `serverPeerId` and keep the connection alive. + + ## Case Study -For dogfooding of new changes we can copy of [react-gallery](https://github.com/functionland/fula/tree/main/examples/react-gallery). and change +For dogfooding of new changes we can use a copy of [react-gallery](https://github.com/functionland/fula/tree/main/examples/react-gallery) and change the [`BoxConfig`](https://github.com/functionland/fula/blob/main/examples/react-gallery/src/components/BoxConfig.jsx) -to get list of comma seperated peerIds. +to get list of comma seperated peerIds and [`App`](https://github.com/functionland/fula/blob/main/examples/react-gallery/src/App.js) should change to pass the list of peerId's to fula-client. -note: if example repo would be outside mono-repo we can just use branch for describing every functionality. +Note: if example repo would be outside mono-repo we can just use branch for describing every functionality. ## Alternative approaches @@ -99,14 +109,16 @@ note: if example repo would be outside mono-repo we can just use branch for desc Using VPN for creating the private network. Disadvantage: - - It adds another point of failure to the system. - - It is also not that decentralized. +- It adds another point of failure to the system. +- It is also not that decentralized. ## Risks ### Work prioritization ### Anything that impacts the value of RFC -### what could impact delivery of this RFC? -## dependencies +### What could impact delivery of this RFC? +## Dependencies ## Impact + + From 7bc9efdfd4fb77815f07d41830ceb7ddda858993 Mon Sep 17 00:00:00 2001 From: farhoud Date: Mon, 28 Mar 2022 14:24:06 +0430 Subject: [PATCH 11/11] fix indent. --- docs/RFCs/private-network.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/RFCs/private-network.md b/docs/RFCs/private-network.md index 4f3ff7d..2b5c1f6 100644 --- a/docs/RFCs/private-network.md +++ b/docs/RFCs/private-network.md @@ -33,10 +33,10 @@ Isolating users from public networks can help us reduce the scope of work while We can use built-in libp2p components to create a private network with encrypted communication. The components are: - Libp2p built-in private network. It uses a [private shared key](https://github.com/libp2p/js-libp2p/tree/master/src/pnet#private-shared-keys) for creating an isolated network with encrypted communication. -- [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) -- [js-doc](https://github.com/libp2p/js-libp2p/tree/master/src/pnet) + - [spec](https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md) + - [js-doc](https://github.com/libp2p/js-libp2p/tree/master/src/pnet) - Libp2p bootstrap for bootstrapping the network of boxes: -- [js-doc](https://github.com/libp2p/js-libp2p-bootstrap) + - [js-doc](https://github.com/libp2p/js-libp2p-bootstrap) In this way when a node comes online, Libp2p uses the key and the list of other node's to join the network. @@ -88,9 +88,9 @@ to We need to change [`Connection`](https://github.com/functionland/fula/blob/main/libraries/fula-client/src/connection.ts) in the way that: - Connection `Status` -- If we connect to at least one box we are `Online`. -- When we are not connected to any box and try to connect we are at `Connecting`. -- When connection fails to all the serverPeerIds we Are `Offline`. + - If we connect to at least one box we are `Online`. + - When we are not connected to any box and try to connect we are at `Connecting`. + - When connection fails to all the serverPeerIds we Are `Offline`. - Connection should have a list of `serverPeerId`. - Connect to all the `serverPeerId` and keep the connection alive.