Commit Graph

164 Commits

Author SHA1 Message Date
Patryk Osmaczko bafb0a71d0 fix: prevent `panic: send on closed channel` 2024-02-27 11:00:29 +01:00
Igor Sirotin 432bfeea2f
fix: flaky `MessengerStoreNodeRequestSuite` (#4721) 2024-02-12 22:30:19 +00:00
Mikhail Rogachev 3ea2002904
Feat: Modify grants for profile showcase use (#4694)
* chore: regenerate proto binaries

* feat: remove unused grant code for community's canPost
2024-02-11 15:11:04 +03:00
Andrea Maria Piana 605fe40e32 Fix encryption metadata issues #4613
This commit fixes a few issues with communities encryption:

Key distribution was disconnected from the community description, this created a case where the key would arrive after the community description and that would result in the client thinking that it was kicked.
To overcome this, we added a message that signals the user that is kicked. Also, we distribute the key with the community description so that there's no more issues with timing.
This is a bit expensive for large communities, and it will require some further optimizations.

Key distribution is now also connected to the request to join response, so there are no timing issues.

Fixes an issue with key distribution (race condition) where the community would be modified before being compared, resulting in a comparison of two identical communities, which would result in no key being distributed. This commit only partially address the issue.
2024-02-07 10:25:41 +00:00
Michal Iskierko 73a5189398 feat(BridgeMessage): Add new type of chat message content: BridgeMessage
BridgeMessage is a type of chat message content which will be sent from  Matterbridge.
It contains fields:
- bridge name - depends on the used bridge, eg. "discord", "slack", etc...
- user name - username the message was received from
- content - message content
- user avatar
- message id
- parent message id - used in case of replies

Message is saved to a separated table: bridge_messages, similarly to discord messages.
The user_messages table is untouched.
bridge_messages table contains user_messages_id in order to join with user_messages table.

Issue #13098
2024-01-30 12:14:54 +01:00
Godfrain Jacques 5f6f7e502d
(fix/status-go) fix profile picture update/removal (#4570)
This PR fixes [9947](status-im/status-desktop#9947) and contains :

    - Commit to fix the changing of custom picture and having the change
      reflected on contact's side
    - Commit to fix the deleting of picture and having the change reflected
      on contact's side
    - Rename confusing `ImageType` to `ImageFormat`
2024-01-24 12:09:28 -08:00
Andrea Maria Piana e65760ca85 Add basic peersyncing
This commit adds basic syncing capabilities with peers if they are both
online.

It updates the work done on MVDS, but I decided to create the code in
status-go instead, since it's very tight to the application (similarly
the code that was the inspiration for mvds, bramble, is all tight
together at the database level).

I reused parts of the protobufs.

The flow is:

1) An OFFER message is sent periodically with a bunch of message-ids and
   group-ids.
2) Anyone can REQUEST some of those messages if not present in their
   database.

3) The peer will then send over those messages.

It's disabled by default, but I am planning to add a way to set up the
flags.
2024-01-23 12:46:17 +00:00
Michal Iskierko 3d7ab79d91 fix: execute BeforeDispatch only once
Issue #4557
2024-01-15 17:03:33 +01:00
Godfrain Jacques 9d8b55e3d9
This PR (status-go) fixes #12821 (#4516)
- Add album_images column to the user_messages table
- Migrate the database
2024-01-08 10:18:57 -08:00
Michal Iskierko 53ac61bb8b fix: a few adjustments for matterbridge
- exposig Online info
- adding ability to disable backup loop and auto message loop

Issue #12710
2024-01-08 14:21:26 +01:00
Mykhailo Prakhov 134137f9c5
feat: implemented a mechanism to retrieve shard information for a given community ID (#4499)
* feat: a mechanism to retrieve shard information for a given community ID
2023-12-22 13:37:37 +01:00
Andrea Maria Piana 88fd1ce942 Surface acks, offers, requests to messenger 2023-12-18 10:33:05 +00:00
Igor Sirotin e32c5546e1
test: request community from storenode (#4364)
* feat: request community info from storenode test

* shutdownWaitGroup

* fix requestCommunityInfoFromMailserver timestamp roundin
2023-11-25 23:24:20 +00:00
Patryk Osmaczko d73d1e2488 chore_: adapt tracking for segmented messages
closes: #4310
2023-11-24 17:41:52 +01:00
Patryk Osmaczko bddc48f265 fix: allocate space for hashes instead of creation
Otherwise hashes would be twice in size and messages tracking
wouldn't work.
2023-11-20 21:26:19 +01:00
Patryk Osmaczko 4a9220bf96 refactor: eliminate datasync initialization logic duplication 2023-11-18 15:37:54 +01:00
Patryk Osmaczko 7b3013a010 chore: remove message chunking from datasync
It was redundant to recently introduced messages segmentation layer.
2023-11-18 15:37:54 +01:00
Vitaly Vlasov 1794b93c16 Always set PubsubTopic in filters 2023-11-18 02:26:34 +02:00
Patryk Osmaczko d04f99d56d chore: cleanup message segments
closes: #4297
2023-11-15 16:52:35 +01:00
Patryk Osmaczko de29ec71ae feat: enable messages segmentation
closes: status-im/status-desktop#12188
2023-11-13 17:32:00 +01:00
Patryk Osmaczko 6bb806caad feat: introduce messages segmentation 2023-11-13 17:32:00 +01:00
Patryk Osmaczko fa44e03ac2 refactor: eliminate logic duplication in MessageSender.HandleMessages 2023-11-13 17:32:00 +01:00
richΛrd 2c954d42cf
feat: replace DefaultPubsubTopic by Shard 32 (#4161) 2023-11-09 20:29:15 -04:00
Mikhail Rogachev 03c32f620f
feat: Profile showcase data sharing (#4209)
* feat: Add profile showcase messaging part with ecrypted data

* feat: Separate profile showcase categories to provide ablity to store custom data

* fix: review fixes

* feat: move profile showcase out of contact data

* fix: create index on contact id for profile tables

* chore: remove logger from link preview
2023-11-09 22:59:01 +04:00
Igor Sirotin f8236fb555
fix: link previews public keys (#4272) 2023-11-09 16:24:35 +00:00
Patryk Osmaczko f7042e4b9e refactor: extract layers in StatusMessage
Extracted:
- TransportLayer
- EncryptionLayer
- ApplicationLayer
2023-11-08 21:46:22 +01:00
Andrea Maria Piana 85f8c92cde Delete processed messages & add tests
This commit adds a test for out of order messages, which were only
implicitly tested.
It also deletes them after being processed, otherwise they would be
reproceessed each time a message was sent
2023-10-30 14:11:29 +00:00
Andrea Maria Piana 360c2d50d4 Fix issues with out of order encryption and batched messages
This commit fixes 3 issues:

1) In some cases, the hash ratchet was not correctly found
2) Out of order messages were not processed correctly as the wrong error
   was returned
3) Batched non datasync messages were not processed correctly

Fixes: #4170
2023-10-30 10:11:32 +00:00
Andrea Maria Piana 23f71c1125 Fix encryption id && rekey with a single message
This commit changes the format of the encryption id to be based off 3
things:

1) The group id
2) The timestamp
3) The actual key

Previously this was solely based on the timestamp and the group id, but
this might lead to conflicts. Moreover the format of the key was an
uint32 and so it would wrap periodically.

The migration is a bit tricky, so first we cleared the cache of keys,
that's easier than migrating, and second we set the new field hash_id to
the concatenation of group_id / key_id.
This might lead on some duplication in case keys are re-received, but it
should not have an impact on the correctness of the code.

I have added 2 tests covering compatibility between old/new clients, as
this should not be a breaking change.

It also adds a new message to rekey in a single go, instead of having to
send multiple messages
2023-10-24 20:48:54 +01:00
frank 3326362b90
optimised finding server cert (#4148)
* optimised finding server cert

* make sure `close(done)` invoked only once

* remove sleep

* resolve IDE warning

* refactor for findServerCert
2023-10-18 14:17:49 +08:00
Igor Sirotin aded258ccb
feature: Unfurl status links (#4033) 2023-10-13 13:25:34 +01:00
Richard Ramos de5c7b8e5b feat: shard fleet
Adds shard.test fleet and changes the non protected shard index to 64
2023-10-12 17:07:57 -04:00
Richard Ramos ace5b26137 fix: do not send the requests to join and cancel in the protected topic 2023-10-12 17:07:57 -04:00
richΛrd ba5ed725ce
waku2: static shards (#3944)
- use protected topics for communities
- associate chats to pubsub topics and populate these depending if the chat belongs to a community or not
- mailserver functions should be aware of pubsub topics
- generate private key for pubsub topic protection when creating a community
- add shard cluster and index to communities
- setup shards for existing communities
- distribute pubsubtopic password
- fix: do not send the requests to join and cancel in the protected topic
- fix: undefined shard values for backward compatibility
- refactor: use shard message in protobuffers
2023-10-12 15:21:49 -04:00
Alexander e17a247d0f
Revert unviewed message count changes (#4101) 2023-10-12 14:27:56 +02:00
Patryk Osmaczko 53423e58ba fix: use proper migrations for protocol's test database
- use `appdatabse.DbInitializer{}` in tests to ensure consistent migrations

- remove protocol's open database functions due to improper
  initialization caused by missing node config migration

- introduce `PushNotificationServerConfig` to resolve cyclic dependency
  issues
2023-10-03 15:11:58 +02:00
Jonathan Rainville 2afe5a269d
feat: up mention count for 1-1 messages each 2 min (#4035) 2023-09-25 11:29:36 -04:00
Alexander 717e0f9ba5
Optimized counter increment logic for 1-1 chat messages (#3889)
* Optimized counter increment logic for 1-1 chat messages

* Updated

* Updated condition
2023-09-22 12:31:35 +02:00
Richard Ramos d900974519 fix: code review 2023-08-23 13:56:00 -04:00
Richard Ramos f9ec588c4e feat: use protected topics for communities
refactor: associate chats to pubsub topics and populate these depending if the chat belongs to a community or not
refactor: add pubsub topic to mailserver batches
chore: ensure default relay messages continue working as they should
refactor: mailserver functions should be aware of pubsub topics
fix: use []byte for communityIDs
2023-08-23 13:56:00 -04:00
Andrea Maria Piana 8dd1b66d69 Always use protobufs by reference & generate handlers 2023-08-22 12:08:54 +01:00
Icaro Motta 084d4bac0c
feat: Unfurl image URLs (#3901)
This commit adds support for unfurling static image URLs (not GIFs, not animated WebPs), such as https://placehold.co/600x400@2x.png. It also compresses images before returning them as data URIs to clients.

About compression: the compression strategy leverages the existing function images.CompressToFileLimits. A more comprehensive logic to consider the possibility of multiple image URLs being unfurled simultaneously is yet to be implemented.

Closes #3761
2023-08-21 16:48:07 +00:00
Patryk Osmaczko 367b7722d1 feat: introduce channel-level encryption
- distribute ratchet keys at both community and channel levels
- use explicit `HashRatchetGroupID` in ecryption layer, instead of
  inheriting `groupID` from `CommunityID`
- populate `HashRatchetGroupID` with `CommunityID+ChannelID` for
  channels, and `CommunityID` for whole community
- hydrate channels with members; channel members are now subset of
  community members
- include channel permissions in periodic permissions check

closes: status-im/status-desktop#10998
2023-07-27 11:35:59 +02:00
Samuel Hawksby-Robinson d60beb2283 refactor to remove rekeyedAt and use group current key 2023-07-24 17:18:42 +01:00
Samuel Hawksby-Robinson 2536d9c8ba Implemented testing to check rekeying is happening 2023-07-24 17:18:42 +01:00
Patryk Osmaczko 2613064356 chore: remove unused `applicationLayer` parameter of `HandleMessages` 2023-07-07 16:33:44 +02:00
Patryk Osmaczko 5bb787fadb chore: rename RawMessage.SkipEncryption->SkipProtocolLayer
`SkipEncryption` was misleading, as it wasn't really always related with
encryption.
2023-07-07 10:30:50 +02:00
Andrea Maria Piana d91d11a01c Call before dispatch for group chat messages 2023-06-29 13:04:49 +01:00
Andrea Maria Piana efad2ef6a2 Add BeforeDispatch callback 2023-06-26 13:36:20 +01:00
Andrea Maria Piana 14e3eafaeb Handle async raw message confirmations
Sometimes confirmation for raw messages are received before the record
is actually saved in the database.

In this case, the code will preserve the Sent status.
2023-06-26 13:36:20 +01:00