Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/topic negotiation #1466

Merged
merged 4 commits into from
Jun 19, 2019
Merged

Feature/topic negotiation #1466

merged 4 commits into from
Jun 19, 2019

Conversation

cammellos
Copy link
Contributor

@cammellos cammellos commented May 17, 2019

Add topic negotiation

This commit add topic negotiation to the protocol.

On receiving a message from a client with version >= 1, we will generate
a shared key using Diffie-Hellman. We will record also which
installationID has sent us a message.

This key will be passed back to the above layer, which will then use to
start listening to a whisper topic (the chat namespace has no
knowledge of whisper).

When sending a message to a set of InstallationIDs, we check whether we
have agreed on a topic with all of them, and if so, we will send on this separate topic, otherwise we fallback on discovery.

This change is backward compatible with other peers, as long as there is no downgrade of the app on the other side, but it changes some of the APIs so, but it's a breaking change for status-react, I'd rather focus on the status-react PR instead of making it backward compatible, but happy to do so if necessary (it's should be pretty simple, restore one endpoint and set ProtocolVersion to 0).

A few changes:

  • Factored out the DB in a separate namespace as now it is
    being used by multiple services (TopicService and EncryptionService).
  • Factored out multidevice management in a separate namespace
  • Moved all the test to test the whole protoocl rather than just the encryption service
  • moved all the filter management in status-go

I still would like to move some parts of status-react to status-go, but I might push them in separate PRs.
Also don't mind the logs please, used as I am still testing, I will remove them.

Sorry for the large PR, I have been carried away, happy to split it if necessary.

status: ready

@cammellos cammellos self-assigned this May 17, 2019
@status-github-bot
Copy link

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?

@status-im-auto
Copy link
Member

status-im-auto commented May 17, 2019

Jenkins Builds

Click to see older builds (216)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 4f2d3b0 #1 2019-05-17 14:46:47 ~50 sec linux 📦 zip
✔️ 4f2d3b0 #1 2019-05-17 14:50:04 ~4 min ios 📦 zip
✔️ 4f2d3b0 #1 2019-05-17 14:53:35 ~7 min android 📦 aar
✔️ da6477e #2 2019-05-17 15:27:47 ~1 min linux 📦 zip
✔️ da6477e #2 2019-05-17 15:30:15 ~3 min ios 📦 zip
✔️ da6477e #2 2019-05-17 15:31:36 ~5 min android 📦 aar
✔️ 2c95c57 #3 2019-05-17 17:30:38 ~33 sec linux 📦 zip
✔️ 2c95c57 #3 2019-05-17 17:33:26 ~3 min ios 📦 zip
✔️ 2c95c57 #3 2019-05-17 17:35:10 ~5 min android 📦 aar
✔️ 81b20ea #4 2019-05-17 18:14:06 ~1 min linux 📦 zip
✔️ 81b20ea #4 2019-05-17 18:17:01 ~3 min ios 📦 zip
✔️ 81b20ea #4 2019-05-17 18:18:16 ~5 min android 📦 aar
✔️ 021215a #5 2019-05-20 07:29:05 ~33 sec linux 📦 zip
✔️ 021215a #5 2019-05-20 07:31:45 ~3 min ios 📦 zip
✔️ 021215a #5 2019-05-20 07:34:53 ~6 min android 📦 aar
✔️ 2be840c #6 2019-05-20 08:36:37 ~1 min linux 📦 zip
✔️ 2be840c #6 2019-05-20 08:38:46 ~3 min ios 📦 zip
✔️ 2be840c #6 2019-05-20 08:41:24 ~6 min android 📦 aar
✔️ f310d7a #7 2019-05-20 09:55:26 ~37 sec linux 📦 zip
✔️ f310d7a #7 2019-05-20 09:58:44 ~3 min ios 📦 zip
✔️ f310d7a #7 2019-05-20 10:00:14 ~5 min android 📦 aar
✔️ 039f9ca #8 2019-05-20 10:05:17 ~34 sec linux 📦 zip
✔️ 039f9ca #8 2019-05-20 10:07:58 ~3 min ios 📦 zip
✔️ 039f9ca #8 2019-05-20 10:10:33 ~5 min android 📦 aar
✔️ 58edd09 #9 2019-05-20 10:57:56 ~32 sec linux 📦 zip
✔️ 58edd09 #9 2019-05-20 11:00:25 ~3 min ios 📦 zip
✔️ 58edd09 #9 2019-05-20 11:02:45 ~5 min android 📦 aar
✔️ 8d77666 #10 2019-05-20 11:55:41 ~1 min linux 📦 zip
✔️ 8d77666 #10 2019-05-20 11:58:12 ~3 min ios 📦 zip
✔️ 8d77666 #10 2019-05-20 11:59:55 ~5 min android 📦 aar
✔️ dbcbea5 #11 2019-05-20 12:26:28 ~7 min ios 📦 zip
✔️ dbcbea5 #11 2019-05-20 12:41:16 ~22 min linux 📦 zip
✔️ dbcbea5 #11 2019-05-20 12:48:39 ~29 min android 📦 aar
✔️ 2a2c15c #12 2019-05-20 13:24:01 ~3 min ios 📦 zip
✔️ 2a2c15c #12 2019-05-20 13:30:16 ~9 min linux 📦 zip
✔️ 2a2c15c #12 2019-05-20 13:38:39 ~18 min android 📦 aar
✔️ b6dbeea #13 2019-05-21 08:56:09 ~36 sec linux 📦 zip
✔️ b6dbeea #13 2019-05-21 08:58:19 ~2 min ios 📦 zip
✔️ b6dbeea #13 2019-05-21 09:01:02 ~5 min android 📦 aar
✔️ 2335239 #14 2019-05-21 09:38:08 ~42 sec linux 📦 zip
✔️ 2335239 #14 2019-05-21 09:40:51 ~3 min ios 📦 zip
✔️ 2335239 #14 2019-05-21 09:42:49 ~5 min android 📦 aar
✔️ a2e1a1d #15 2019-05-21 12:33:45 ~1 min linux 📦 zip
✔️ a2e1a1d #15 2019-05-21 12:35:32 ~2 min ios 📦 zip
✔️ a2e1a1d #15 2019-05-21 12:38:11 ~5 min android 📦 aar
✔️ 04d1ecc #16 2019-05-22 14:26:35 ~39 sec linux 📦 zip
✔️ 04d1ecc #16 2019-05-22 14:31:45 ~5 min android 📦 aar
✔️ 04d1ecc #16 2019-05-22 14:33:00 ~7 min ios 📦 zip
✔️ df282a7 #17 2019-05-23 07:55:32 ~39 sec linux 📦 zip
✔️ df282a7 #17 2019-05-23 07:59:33 ~4 min ios 📦 zip
✔️ df282a7 #17 2019-05-23 08:00:35 ~5 min android 📦 aar
✔️ 9588294 #18 2019-05-23 07:58:03 ~41 sec linux 📦 zip
✔️ 4e7ea9b #19 2019-05-23 07:59:00 ~39 sec linux 📦 zip
✔️ 4e7ea9b #18 2019-05-23 08:02:23 ~2 min ios 📦 zip
✔️ 4e7ea9b #18 2019-05-23 08:07:03 ~6 min android 📦 aar
✔️ e445fae #20 2019-05-23 08:48:13 ~44 sec linux 📦 zip
✔️ e445fae #19 2019-05-23 08:50:59 ~3 min ios 📦 zip
✔️ e445fae #19 2019-05-23 08:54:49 ~7 min android 📦 aar
✔️ defdb98 #21 2019-05-23 11:26:38 ~1 min linux 📦 zip
✔️ defdb98 #20 2019-05-23 11:28:42 ~3 min ios 📦 zip
✔️ defdb98 #20 2019-05-23 11:31:12 ~5 min android 📦 aar
✔️ 6068cd7 #22 2019-05-23 14:33:49 ~1 min linux 📦 zip
✔️ 6068cd7 #21 2019-05-23 14:35:51 ~3 min ios 📦 zip
✔️ d9dc789 #23 2019-05-23 14:52:09 ~58 sec linux 📦 zip
✔️ d9dc789 #21 2019-05-23 14:56:55 ~5 min android 📦 aar
✔️ d9dc789 #22 2019-05-23 15:01:42 ~10 min ios 📦 zip
✔️ 0fbbc03 #24 2019-05-24 07:31:51 ~46 sec linux 📦 zip
✔️ 0fbbc03 #23 2019-05-24 07:33:59 ~2 min ios 📦 zip
✔️ 0fbbc03 #22 2019-05-24 07:37:14 ~6 min android 📦 aar
✔️ 44a8c34 #24 2019-05-24 10:52:02 ~3 min ios 📦 zip
✔️ 44a8c34 #25 2019-05-24 10:56:25 ~7 min linux 📦 zip
✔️ 44a8c34 #23 2019-05-24 11:00:40 ~12 min android 📦 aar
✔️ 860792c #26 2019-05-24 12:00:15 ~45 sec linux 📦 zip
✔️ 860792c #25 2019-05-24 12:02:49 ~3 min ios 📦 zip
✔️ 860792c #24 2019-05-24 12:05:18 ~5 min android 📦 aar
✔️ 51b402d #27 2019-05-25 07:11:34 ~46 sec linux 📦 zip
✔️ 51b402d #26 2019-05-25 07:13:53 ~3 min ios 📦 zip
✔️ 51b402d #25 2019-05-25 07:15:59 ~5 min android 📦 aar
✔️ 473eadb #28 2019-05-25 07:59:42 ~35 sec linux 📦 zip
473eadb #27 2019-05-25 07:59:46 ~40 sec ios 📄 log
473eadb #26 2019-05-25 08:00:33 ~1 min android 📄 log
✔️ 5887e07 #29 2019-05-25 08:02:08 ~33 sec linux 📦 zip
✔️ 5887e07 #28 2019-05-25 08:04:50 ~3 min ios 📦 zip
✔️ 5887e07 #27 2019-05-25 08:06:50 ~5 min android 📦 aar
47f485e #29 2019-05-25 08:40:15 ~47 sec ios 📄 log
✔️ 47f485e #30 2019-05-25 08:40:43 ~1 min linux 📦 zip
47f485e #28 2019-05-25 08:40:56 ~1 min android 📄 log
✔️ b71e76e #31 2019-05-25 08:47:51 ~1 min linux 📦 zip
✔️ b71e76e #30 2019-05-25 08:51:09 ~4 min ios 📦 zip
✔️ b71e76e #29 2019-05-25 08:52:15 ~5 min android 📦 aar
✔️ d38d3a3 #32 2019-05-31 08:18:52 ~1 min linux 📦 zip
✔️ d38d3a3 #31 2019-05-31 08:22:16 ~4 min ios 📦 zip
✔️ d38d3a3 #30 2019-05-31 08:25:28 ~7 min android 📦 aar
✔️ 15ee4e1 #33 2019-05-31 08:21:03 ~36 sec linux 📦 zip
✔️ 15ee4e1 #32 2019-05-31 08:25:16 ~2 min ios 📦 zip
✔️ 15ee4e1 #31 2019-05-31 08:31:09 ~5 min android 📦 aar
✔️ 0a1ff29 #34 2019-05-31 08:57:12 ~31 sec linux 📦 zip
✔️ 0a1ff29 #33 2019-05-31 08:59:27 ~2 min ios 📦 zip
✔️ 0a1ff29 #32 2019-05-31 09:01:58 ~5 min android 📦 aar
✔️ e432061 #35 2019-05-31 09:16:00 ~1 min linux 📦 zip
✔️ e432061 #33 2019-05-31 09:20:04 ~5 min android 📦 aar
✔️ e432061 #34 2019-05-31 09:20:35 ~5 min ios 📦 zip
✔️ f0aa2d2 #35 2019-05-31 09:35:59 ~4 min ios 📦 zip
✔️ f0aa2d2 #34 2019-05-31 09:37:50 ~5 min android 📦 aar
✔️ f0aa2d2 #36 2019-05-31 09:38:25 ~6 min linux 📦 zip
✔️ 6607471 #37 2019-05-31 09:43:16 ~49 sec linux 📦 zip
✔️ 6607471 #36 2019-05-31 09:45:19 ~2 min ios 📦 zip
✔️ 6607471 #35 2019-05-31 09:48:12 ~5 min android 📦 aar
✔️ 6f84bcc #38 2019-05-31 13:34:09 ~38 sec linux 📦 zip
✔️ 6f84bcc #37 2019-05-31 13:36:41 ~3 min ios 📦 zip
✔️ 6f84bcc #36 2019-05-31 13:39:39 ~6 min android 📦 aar
✔️ 7a8bf70 #39 2019-06-03 06:58:25 ~35 sec linux 📦 zip
✔️ 7a8bf70 #38 2019-06-03 07:01:29 ~3 min ios 📦 zip
✔️ 7a8bf70 #37 2019-06-03 07:04:56 ~7 min android 📦 aar
✔️ 152675c #40 2019-06-03 07:03:03 ~30 sec linux 📦 zip
✔️ 152675c #39 2019-06-03 07:06:37 ~4 min ios 📦 zip
✔️ 152675c #38 2019-06-03 07:10:06 ~5 min android 📦 aar
✔️ 2dd8283 #41 2019-06-03 08:53:21 ~35 sec linux 📦 zip
✔️ 2dd8283 #40 2019-06-03 08:55:37 ~2 min ios 📦 zip
✔️ 2dd8283 #39 2019-06-03 08:58:06 ~5 min android 📦 aar
✔️ 5075770 #42 2019-06-03 09:22:13 ~35 sec linux 📦 zip
✔️ 5075770 #41 2019-06-03 09:24:28 ~2 min ios 📦 zip
✔️ 5075770 #40 2019-06-03 09:26:42 ~5 min android 📦 aar
✔️ 723a988 #43 2019-06-03 09:48:27 ~57 sec linux 📦 zip
✔️ 723a988 #42 2019-06-03 09:50:49 ~3 min ios 📦 zip
✔️ 723a988 #41 2019-06-03 09:52:34 ~5 min android 📦 aar
✔️ 76a5ec4 #44 2019-06-03 09:48:57 ~29 sec linux 📦 zip
✔️ 76a5ec4 #43 2019-06-03 09:53:35 ~2 min ios 📦 zip
✔️ 76a5ec4 #42 2019-06-03 09:57:43 ~5 min android 📦 aar
✔️ 3d7f9fa #45 2019-06-03 11:31:02 ~33 sec linux 📦 zip
✔️ 3d7f9fa #44 2019-06-03 11:34:51 ~4 min ios 📦 zip
✔️ 3d7f9fa #43 2019-06-03 11:36:35 ~6 min android 📦 aar
✔️ bdfe73d #46 2019-06-03 13:18:29 ~1 min linux 📦 zip
✔️ bdfe73d #45 2019-06-03 13:20:27 ~3 min ios 📦 zip
✔️ bdfe73d #44 2019-06-03 13:22:49 ~5 min android 📦 aar
✔️ 0010fdd #47 2019-06-03 14:30:50 ~1 min linux 📦 zip
✔️ 0010fdd #46 2019-06-03 14:32:29 ~2 min ios 📦 zip
✔️ 0010fdd #45 2019-06-03 14:35:00 ~5 min android 📦 aar
✔️ 863f074 #48 2019-06-03 14:51:22 ~53 sec linux 📦 zip
✔️ 863f074 #47 2019-06-03 14:53:18 ~2 min ios 📦 zip
✔️ 863f074 #46 2019-06-03 14:57:31 ~7 min android 📦 aar
✔️ 9f37fc9 #49 2019-06-03 17:26:17 ~39 sec linux 📦 zip
✔️ 9f37fc9 #48 2019-06-03 17:28:35 ~3 min ios 📦 zip
✔️ 9f37fc9 #47 2019-06-03 17:30:41 ~5 min android 📦 aar
✔️ df237d0 #50 2019-06-04 06:58:13 ~43 sec linux 📦 zip
✔️ df237d0 #49 2019-06-04 07:00:32 ~3 min ios 📦 zip
✔️ df237d0 #48 2019-06-04 07:03:41 ~6 min android 📦 aar
✔️ aef3925 #51 2019-06-04 07:09:28 ~2 min linux 📦 zip
✔️ aef3925 #50 2019-06-04 07:11:10 ~3 min ios 📦 zip
✔️ aef3925 #49 2019-06-04 07:12:50 ~5 min android 📦 aar
✔️ a543d10 #52 2019-06-04 08:56:05 ~36 sec linux 📦 zip
✔️ a543d10 #51 2019-06-04 08:58:35 ~3 min ios 📦 zip
✔️ a543d10 #50 2019-06-04 09:01:28 ~6 min android 📦 aar
✔️ eb7580c #53 2019-06-04 12:42:43 ~35 sec linux 📦 zip
✔️ eb7580c #52 2019-06-04 12:46:12 ~4 min ios 📦 zip
✔️ eb7580c #51 2019-06-04 12:47:34 ~5 min android 📦 aar
✔️ 8422e3e #54 2019-06-04 12:45:54 ~42 sec linux 📦 zip
✔️ 8422e3e #53 2019-06-04 12:49:56 ~3 min ios 📦 zip
✔️ 8422e3e #52 2019-06-04 12:53:14 ~5 min android 📦 aar
✔️ 52f2e7f #55 2019-06-04 13:03:14 ~39 sec linux 📦 zip
✔️ 52f2e7f #54 2019-06-04 13:05:56 ~3 min ios 📦 zip
✔️ 52f2e7f #53 2019-06-04 13:08:17 ~5 min android 📦 aar
✔️ 5d47393 #56 2019-06-04 16:18:26 ~36 sec linux 📦 zip
5d47393 #55 2019-06-04 16:18:27 ~39 sec ios 📄 log
5d47393 #54 2019-06-04 16:19:40 ~1 min android 📄 log
✔️ cab2ec6 #57 2019-06-04 16:18:56 ~28 sec linux 📦 zip
cab2ec6 #56 2019-06-04 16:19:06 ~37 sec ios 📄 log
cab2ec6 #55 2019-06-04 16:21:03 ~1 min android 📄 log
ecd4e83 #57 2019-06-04 16:28:51 ~41 sec ios 📄 log
✔️ ecd4e83 #58 2019-06-04 16:29:17 ~1 min linux 📦 zip
ecd4e83 #56 2019-06-04 16:29:31 ~1 min android 📄 log
✔️ 2428d3e #59 2019-06-04 19:54:55 ~36 sec linux 📦 zip
2428d3e #58 2019-06-04 19:54:59 ~41 sec ios 📄 log
2428d3e #57 2019-06-04 19:55:45 ~1 min android 📄 log
✔️ 2c75439 #60 2019-06-04 20:18:15 ~1 min linux 📦 zip
✔️ 2c75439 #59 2019-06-04 20:21:27 ~4 min ios 📦 zip
✔️ 2c75439 #58 2019-06-04 20:22:22 ~5 min android 📦 aar
✔️ fc321df #61 2019-06-05 05:10:14 ~59 sec linux 📦 zip
✔️ fc321df #60 2019-06-05 05:13:08 ~3 min ios 📦 zip
✔️ fc321df #59 2019-06-05 05:14:59 ~5 min android 📦 aar
a3c3f8b #61 2019-06-05 07:06:57 ~40 sec ios 📄 log
a3c3f8b #60 2019-06-05 07:08:02 ~1 min android 📄 log
✔️ a3c3f8b #62 2019-06-05 07:08:28 ~2 min linux 📦 zip
✔️ 8a1564c #63 2019-06-05 07:14:19 ~52 sec linux 📦 zip
✔️ 8a1564c #62 2019-06-05 07:16:46 ~3 min ios 📦 zip
✔️ 8a1564c #61 2019-06-05 07:20:10 ~6 min android 📦 aar
✔️ 47d3182 #64 2019-06-05 12:38:20 ~37 sec linux 📦 zip
✔️ 47d3182 #63 2019-06-05 12:40:24 ~2 min ios 📦 zip
✔️ 47d3182 #62 2019-06-05 12:43:25 ~5 min android 📦 aar
✔️ b4ee02f #65 2019-06-05 14:02:03 ~39 sec linux 📦 zip
✔️ b4ee02f #64 2019-06-05 14:04:28 ~3 min ios 📦 zip
✔️ b4ee02f #63 2019-06-05 14:07:15 ~5 min android 📦 aar
✔️ 745d68a #66 2019-06-07 12:55:28 ~34 sec linux 📦 zip
745d68a #65 2019-06-07 12:55:39 ~46 sec ios 📄 log
745d68a #64 2019-06-07 12:56:27 ~1 min android 📄 log
✔️ c2682d6 #67 2019-06-07 13:02:19 ~1 min linux 📦 zip
✔️ c2682d6 #66 2019-06-07 13:03:50 ~2 min ios 📦 zip
✔️ c2682d6 #65 2019-06-07 13:06:18 ~5 min android 📦 aar
✔️ a0ea5e6 #68 2019-06-10 12:43:43 ~32 sec linux 📦 zip
✔️ a0ea5e6 #67 2019-06-10 12:45:52 ~2 min ios 📦 zip
✔️ a0ea5e6 #66 2019-06-10 12:48:29 ~5 min android 📦 aar
28a9f16 #67 2019-06-11 09:22:06 ~12 sec android 📄 log
28a9f16 #69 2019-06-11 09:22:06 ~10 sec linux 📄 log
✔️ 28a9f16 #68 2019-06-11 09:27:09 ~5 min ios 📦 zip
8053c75 #68 2019-06-11 09:22:42 ~6.9 sec android 📄 log
8053c75 #70 2019-06-11 09:22:44 ~6.4 sec linux 📄 log
✔️ 8053c75 #69 2019-06-11 09:30:18 ~3 min ios 📦 zip
5e17ab6 #69 2019-06-11 10:03:00 ~12 sec android 📄 log
5e17ab6 #71 2019-06-11 10:03:02 ~11 sec linux 📄 log
✔️ 5e17ab6 #70 2019-06-11 10:05:36 ~2 min ios 📦 zip
3a39c66 #70 2019-06-13 09:37:35 ~12 sec android 📄 log
3a39c66 #72 2019-06-13 09:37:35 ~10 sec linux 📄 log
3a39c66 #71 2019-06-13 09:44:49 ~7 min ios 📄 log
✔️ 990271f #73 2019-06-13 10:25:57 ~40 sec linux 📦 zip
✔️ 990271f #72 2019-06-13 10:28:57 ~3 min ios 📦 zip
✔️ 990271f #71 2019-06-13 10:31:30 ~6 min android 📦 aar
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ e42df50 #74 2019-06-13 11:03:56 ~51 sec linux 📦 zip
✔️ e42df50 #73 2019-06-13 11:05:51 ~2 min ios 📦 zip
✔️ e42df50 #72 2019-06-13 11:08:41 ~5 min android 📦 aar
✔️ e02f7c0 #75 2019-06-13 12:24:08 ~34 sec linux 📦 zip
✔️ e02f7c0 #74 2019-06-13 12:27:15 ~3 min ios 📦 zip
✔️ e02f7c0 #73 2019-06-13 12:30:12 ~6 min android 📦 aar

@cammellos cammellos force-pushed the feature/topic-negotiation branch 10 times, most recently from 44a8c34 to 860792c Compare May 24, 2019 11:59
@cammellos cammellos force-pushed the feature/topic-negotiation branch 4 times, most recently from 47f485e to b71e76e Compare May 25, 2019 08:46
@cammellos cammellos force-pushed the feature/topic-negotiation branch 5 times, most recently from 6607471 to 6f84bcc Compare May 31, 2019 13:33
@cammellos cammellos force-pushed the feature/topic-negotiation branch 4 times, most recently from 723a988 to 76a5ec4 Compare June 3, 2019 09:47
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
This commit add topic negotiation to the protocol.

On receiving a message from a client with version >= 1, we will generate
a shared key using Diffie-Hellman. We will record also which
installationID has sent us a message.

This key will be passed back to the above layer, which will then use to
start listening to a whisper topic (the `chat` namespace has no
knowledge of whisper).

When sending a message to a set of InstallationIDs, we check whether we
have agreed on a topic with all of them, and if so, we will send on this
separate topic, otherwise we fallback on discovery.

This change is backward compatible, as long as there is no downgrade of
the app on the other side.

A few changes:

* Factored out the DB in a separate namespace as now it is
being used by multiple services (TopicService and EncryptionService).

* Factored out multidevice management in a separate namespace

* Moved all the test to test the whole protoocl rather than just the encryption service

* Moved all the filter management in status-go
@cammellos cammellos force-pushed the feature/topic-negotiation branch 2 times, most recently from 990271f to e42df50 Compare June 13, 2019 11:02
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 16, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 18, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
@cammellos cammellos merged commit f6fba1d into develop Jun 19, 2019
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 19, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 24, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 24, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos added a commit to status-im/status-mobile that referenced this pull request Jun 24, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
pacamara pushed a commit to pacamara/status-react that referenced this pull request Jul 2, 2019
All the code has been implemented in statusgo: status-im/status-go#1466

Basically all the whisper filter management is done at that level.

Technical description
On startup we load all chats and send a list of them to status go:
For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat.

For each contact added by us, each user in a group chat and each one to one chat open, we send:
{:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code.

Any previously negotiated topic is also returned.

Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded.
In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore.

On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically.

Some more logic can be pushed in status-go, but that will be in subsequent PRs.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
@adambabik adambabik deleted the feature/topic-negotiation branch December 27, 2019 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants