status-go icon indicating copy to clipboard operation
status-go copied to clipboard

Added SetCommunityEncryption

Open Samyoul opened this issue 2 years ago • 5 comments

What's Changed?

I've added a new function to Messenger SetCommunityEncryption(communityID string, useEncryption bool).

SetCommunityEncryption takes a communityID string and an encryption state, then finds the community and encrypts / decrypts the community. Community is republished along with any keys if needed.

I've added a new function to communities.Manager UpdateCommunity(c *Community).

UpdateCommunity takes a Community persists it and republishes it. The clock is incremented meaning even a no change update will be republished by the admin, and parsed by the member.

⚠️ Note:

  • This function cannot decrypt previously encrypted messages, and it cannot encrypt previous unencrypted messages.
  • This functionality has some known race conditions:
    • community description is processed by members before the receiving the key exchange messages
    • members maybe sending encrypted messages after the community description is updated and a new member joins

Why Change?

Sometimes you want to make a community public, sometimes you want to me a community private

closes https://github.com/status-im/status-desktop/issues/9942

Samyoul avatar Apr 20 '23 10:04 Samyoul

Pull Request Checklist

  • [ ] Have you updated the documentation, if impacted (e.g. docs.status.im)?
  • [ ] Have you tested changes with mobile?
  • [ ] Have you tested changes with desktop?

ghost avatar Apr 20 '23 10:04 ghost

Jenkins Builds

Click to see older builds (21)
:grey_question: Commit :hash: Finished (UTC) Duration Platform Result
:heavy_check_mark: aa78a761 #1 2023-04-20 10:05:17 ~2 min linux :package:zip
:heavy_multiplication_x: aa78a761 #1 2023-04-20 10:05:55 ~3 min tests :page_facing_up:log
:heavy_check_mark: aa78a761 #1 2023-04-20 10:06:17 ~3 min ios :package:zip
:heavy_check_mark: aa78a761 #1 2023-04-20 10:06:56 ~4 min android :package:aar
:x: 651e4604 #2 2023-04-21 11:51:19 ~26 sec ios :page_facing_up:log
:heavy_check_mark: 651e4604 #2 2023-04-21 11:53:40 ~2 min linux :package:zip
:heavy_check_mark: 651e4604 #2 2023-04-21 11:55:40 ~4 min android :package:aar
:heavy_multiplication_x: 651e4604 #2 2023-04-21 12:14:29 ~23 min tests :page_facing_up:log
:heavy_check_mark: ff65cc02 #3 2023-04-26 16:13:45 ~2 min linux :package:zip
:heavy_check_mark: ff65cc02 #3 2023-04-26 16:16:34 ~5 min android :package:aar
:heavy_check_mark: ff65cc02 #3 2023-04-26 16:23:42 ~12 min tests :page_facing_up:log
:heavy_check_mark: c81d0a44 #4 2023-04-26 16:36:05 ~2 min linux :package:zip
:heavy_check_mark: c81d0a44 #4 2023-04-26 16:36:27 ~2 min tests :page_facing_up:log
:heavy_check_mark: c81d0a44 #4 2023-04-26 16:38:03 ~4 min android :package:aar
:heavy_check_mark: fbcf7a19 #5 2023-04-26 16:39:49 ~3 min linux :package:zip
:heavy_check_mark: fbcf7a19 #5 2023-04-26 16:40:21 ~4 min ios :package:zip
:heavy_check_mark: fbcf7a19 #5 2023-04-26 16:42:51 ~4 min android :package:aar
:heavy_check_mark: fbcf7a19 #5 2023-04-26 16:49:52 ~13 min tests :page_facing_up:log
:heavy_check_mark: 5b471a3d #6 2023-04-26 16:45:45 ~2 min linux :package:zip
:heavy_check_mark: 5b471a3d #6 2023-04-26 16:46:38 ~3 min android :package:aar
:heavy_check_mark: 5b471a3d #6 2023-04-26 16:47:37 ~4 min ios :package:zip
:grey_question: Commit :hash: Finished (UTC) Duration Platform Result
:heavy_check_mark: 62f6158d #7 2023-04-26 16:49:38 ~2 min linux :package:zip
:heavy_check_mark: 62f6158d #7 2023-04-26 16:50:20 ~2 min ios :package:zip
:heavy_check_mark: 62f6158d #7 2023-04-26 16:51:08 ~3 min android :package:aar
:heavy_multiplication_x: 62f6158d #6 2023-04-26 16:57:35 ~7 min tests :page_facing_up:log
:x: 557589c9 #8 2023-05-11 08:17:35 ~23 sec ios :page_facing_up:log
:heavy_check_mark: 557589c9 #8 2023-05-11 08:19:50 ~2 min linux :package:zip
:heavy_multiplication_x: 557589c9 #7 2023-05-11 08:19:59 ~2 min tests :page_facing_up:log
:heavy_check_mark: 557589c9 #8 2023-05-11 08:21:34 ~4 min android :package:aar

status-im-auto avatar Apr 20 '23 10:04 status-im-auto

@cammellos the functionality for this feature seems to work. But I do not have tests that check if messages sent to the updated community are encrypted or not. This is not very satisfactory as a subset of breaking changes to this functionality would include scenarios where the community has an encryption flag set to a value, but the behaviour does not reflect the community encryption state.

Buuut, I don't know how to test this. Do you (or anyone else) know how to test that the correct keys were received and are being used on the Messenger level?

Samyoul avatar Apr 26 '23 16:04 Samyoul

@Samyoul best way I can think of, is to check the database/expose seq number to check if it was received/decrypted etc, unfortunately with encryption it's completely invisible to the user, so we need to dig into db etc

cammellos avatar Apr 26 '23 17:04 cammellos

@Samyoul is this something we still need?

igor-sirotin avatar Sep 02 '24 22:09 igor-sirotin

Closing as currently out of scope

igor-sirotin avatar Jul 01 '25 12:07 igor-sirotin