Commit Graph

1257 Commits

Author SHA1 Message Date
Patryk Osmaczko dbd52edcd7 feat: sign community events
closes: status-im/status-desktop#11834
2023-08-09 13:53:32 +02:00
Pascal Precht 4b07960fba feat: rehydrate community_tokens table upon account recovery
Closes https://github.com/status-im/status-desktop/issues/11188
2023-08-09 13:38:59 +02:00
Pascal Precht 688fb333a0 chore: don't expose `RevealedAccount`s on community description
Prior to this commit a control node would add the revealed addresses to
the member struct on the community description, which exposes all those
addresses to the public.

We don't want that. Revealed addresses are exclusively shared with
control nodes and should stay there (although, they might be privately
shared among token masters, see
https://github.com/status-im/status-desktop/issues/11610).

In this commit, we no longer add the revealed addresses to the community
description. The addresses are already stored in the requestToJoin
database table so we can take them from there if we need them.

Closes: https://github.com/status-im/status-desktop/issues/11573
2023-08-08 19:02:47 +02:00
Mykhailo Prakhov ebadfb3e7b
feat: allow owner without community private key to manage privileged community permissions (#3861)
feat: allow owner without community private key to manage privileged permissions
2023-08-08 17:02:56 +02:00
Pascal Precht 248e4a7f24 refactor: EventSenders forward RequestToJoin decision to control node
This is a bigger change in how community membership requests are handled
among admins, token masters, owners, and control nodes.

Prior to this commit, all privileged users, also known as
`EventSenders`, were able to accept and reject community membership
requests and those changes would be applied by all users.

This commit changes this behaviour such that:

1. EventSenders can make a decision (accept, reject), but merely forward
   their decision to the control node, which ultimately has to confirm
   it
2. EventSenders are no longer removing or adding members to and from
   communities
3. When an eventsender signaled a decision, the membership request will
   enter a pending state (acceptedPending or rejectedPending)
4. Once a decision was made by one eventsender, no other eventsender can
   override that decision

This implementation is covered with a bunch of tests:

- Ensure that decision made by event sender is shared with other event
  senders
  - `testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders()`
  - `testRejectMemberRequestToJoinResponseSharedWithOtherEventSenders()`
- Ensure memebrship request stays pending, until control node has
  confirmed decision by event senders
  - `testAcceptMemberRequestToJoinNotConfirmedByControlNode()`
  - `testRejectMemberRequestToJoinNotConfirmedByControlNode()`
- Ensure that decision made by event sender cannot be overriden by other
  event senders
  - `testEventSenderCannotOverrideRequestToJoinState()`

These test cases live in three test suites for different event sender
types respectively

- `OwnerWithoutCommunityKeyCommunityEventsSuite`
- `TokenMasterCommunityEventsSuite`
- `AdminCommunityEventsSuite`

In addition to the changes mentioned above, there's also a smaller
changes that ensures membership requests to *not* attached revealed wallet
addresses when the requests are sent to event senders (in addition to
control nodes).

Requests send to a control node will still include revealed addresses as
the control node needs them to verify token permissions.

This commit does not yet handle the case of event senders attempting to
kick and ban members.

Similar to accepting and rejecting membership requests, kicking and
banning need a new pending state. However, we don't track such state in
local databases yet so those two cases will be handled in future commit
to not have this commit grow larger.
2023-08-08 14:46:03 +02:00
Volodymyr Kozieiev 7560540392
Regularly update the list of curated communities (#3827)
Regularly update the list of curated communities
2023-08-07 13:54:00 +01:00
Patryk Osmaczko ce82a8c0e5 chore: remove community invitations 2023-08-05 11:49:00 +02:00
Igor Sirotin bbb8e99492
Fix syncing `blocked` contacts (#3799)
* fix(messenger_testing_utils): Always return response
* feat: test blocking/unblocking contacts with paired devices 
* fix: Remove recursive sync on contact blocking
* rename `syncing` flag to `fromSyncing`
2023-08-04 13:41:24 +03:00
Mykhailo Prakhov 3bd972dec4
chore: Added TokenMaster permission token type (#3848) 2023-08-04 12:28:46 +02:00
Igor Sirotin d535cd95f8
fx: deprecate profile and timeline chats (#3809) 2023-08-03 17:16:11 +03:00
Mikhail Rogachev fbffcdc7a7
chore: test mutual state messages on contact remove (#3844) 2023-08-03 12:14:13 +04:00
frank 60143556ff
add api to create community for testing (#3818) 2023-08-03 08:24:11 +08:00
Patryk Osmaczko 9ae632893c refactor: rename 'permissions' to 'roles' in community module
This renames various instances of 'permissions' to 'roles' where
appropriate to ensure consistency and clarity of purpose.
2023-08-02 23:04:58 +02:00
Patryk Osmaczko 47c568fb08 refactor: improve wrapped community description naming 2023-08-02 20:57:19 +02:00
Patryk Osmaczko 9eaf229161 refactor: improve community functions naming 2023-08-02 19:59:16 +02:00
Jonathan Rainville 9267e58143
feat(api): add GetCommunityPublicKeyFromPrivateKey to api (#3828) 2023-08-02 13:11:26 -04:00
Mikhail Rogachev 4ad84d80cc
feat: Collecting community messages count metrics (#3802)
* feat: proposal for collecting community metrics

https://github.com/status-im/status-desktop/issues/11152

* feat: collecting community message metrics with test

* feat: implement both strategies for fetching community metrics

* fix: review fixes

* fix: calc counts for timestamps
2023-08-01 17:08:57 +04:00
Sale Djenic 0ae7aa44f0 feat: `deleteKeystoreFilesForKeypair` function added 2023-08-01 13:26:10 +02:00
Pascal Precht 75cd002863 chore: don't process request to join if admin and community is set to
auto-accept
2023-08-01 12:19:22 +02:00
Pascal Precht d5203c5e53 chore: add token masterr to `MemberRole()` 2023-08-01 11:51:19 +02:00
Anthony Laibe 1df8c1c511 feat: save preferred networks 2023-07-31 22:50:02 +02:00
Mykhailo Prakhov f2770b6e5e
fix: unstable *RequestToJoin* tests fix (#3824)
fix: unstable *RequestToJoin* tests fix
2023-07-31 17:52:41 +02:00
Jonathan Rainville cbb845b574
fix(messenger): fix handling reply with only one image (#3816)
If a message is sent with only 1 image, the album is not generated (no albumID), so then, in the notification handling code, it didn't use the right ID, because it thought it had to use the AlbumID for the message ID
2023-07-28 16:02:20 -04:00
Mykhailo Prakhov 89253ac684
fix: owner without community private key and token master was not able send all admin events (#3819) 2023-07-28 20:18:27 +02:00
Patryk Osmaczko bb942f6c8f fix: increase community clock with channel members changes 2023-07-28 18:13:15 +02:00
Patryk Osmaczko c1a98005e9 chore: signal client with published community
Some of the changes done to the community are done async, client must
be notified about them to relfect current state.
2023-07-28 18:13:15 +02:00
Sale Djenic 4088edfa14 fix: changes needed to support recovering from waku in case recovering is done using keycard, but stored data refers to a regular profile and vice versa 2023-07-28 12:16:23 +02:00
Dario Gabriel Lipicar b1cf54974e chore: make opensea client return common types 2023-07-27 12:12:03 -03:00
Dario Gabriel Lipicar 849be69299 chore: use single opensea client instance 2023-07-27 12:12:03 -03:00
Patryk Osmaczko cec81796dc fix: add all members to channel when it is no longer token-gated 2023-07-27 11:35:59 +02:00
Patryk Osmaczko 971fc0c816 fix: populate channels with all members for existing communities 2023-07-27 11:35:59 +02: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
Patryk Osmaczko 30da8390bd feat: introduce CommunitiesKeyDistributor
This component decouples key distribution from the Messenger, enhancing
code maintainability, extensibility and testability.
It also alleviates the need to impact all methods potentially affecting
encryption keys.
Moreover, it allows key distribution inspection for integration tests.

part of: status-im/status-desktop#10998
2023-07-27 11:35:59 +02:00
Patryk Osmaczko fa5b316324 chore: deprecate InviteUsersToCommunity 2023-07-27 08:45:01 +02:00
Mykhailo Prakhov f89eee9f40
feat: register new community member role ROLE_TOKEN_MASTER and grant him admin permissions (#3810)
feat: register new member type TokenMaster and grant him admin permissions
2023-07-26 18:01:19 +02:00
Pascal Precht 3d1b1bab57 feat: introduce messenger API to remove community tokens
This is to allow users to remove a community token if the deployment
transaction has been rejected.
2023-07-26 15:57:08 +02:00
Pascal Precht e8bac916ec !refactor: introduce `SaveCommunityToken()` and change `AddCommunityToken()`
**This is a breaking change!**

Prior to this commit we had `AddCommunityToken(token *communities,
croppedImage CroppedImage)` that we used to

1. add a `CommunityToken` to the user's database and
2. to create a `CommunityTokenMetadata` from it which is then added to
   the community's `CommunityDescription` and published to its members

However, I've then discovered that we need to separate these two things,
such that we can deploy a community token, then add it to the database
only for tracking purposes, **then** add it to the community description
(and propagate to members) once we know that the deploy tx indeed went
through.

To implement this, this commit introduces a new API
`SaveCommunityToken(token *communities.CommunityToken, croppedImage
CroppedImage)` which adds the token to the database only and doesn't
touch the community description.

The `AddCommunityToken` API is then changed that it's exclusively used
for adding an already saved `CommunityToken` to the community
description so it can be published to members. Hence, the signature is
now `AddCommunityToken(communityID string, chainID int, address
string)`, which makes this a breaking change.

Clients that used `AddCommunityToken()` before now need to ensure that
they first call `SaveCommunityToken()` as `AddCommunityToken()` will
fail otherwise.
2023-07-26 14:45:02 +02:00
Mykhailo Prakhov c77878bbfb
chore: make the owner without the community private key behave like a… (#3788)
* chore: make the owner without the community private key behave like an admin
* Add test for the owner without community key
* chore: refactor Community fn names related to the roles
2023-07-26 14:16:50 +02:00
Boris Melnik fa46f23f7e
feat(new-urls-format): Usage the chat key instead of signature (#3779) 2023-07-26 15:14:06 +03:00
Sale Djenic 20bc27619b fix: function name change
`GetWatchOnlyAccounts(includeRemoved bool)` removed
`GetActiveWatchOnlyAccounts()` added
`GetAllWatchOnlyAccounts()` added
2023-07-26 08:23:55 +02:00
Sale Djenic 6a5cdbaa8b fix: review comments applied
`GetKeypairs(includeRemoved bool)` removed
`GetActiveKeypairs()` added
`GetAllKeypairs()` added

`GetAccounts(includeRemoved bool)` removed
`GetActiveAccounts()` added
`GetAllAccounts()` added
2023-07-25 18:11:05 +02:00
Sale Djenic d5bba5d80f chore: wallet accounts improvements - soft delete 2023-07-25 18:11:05 +02:00
frank 14483dabda
[mention] fix relate issues to input segments (#3766) 2023-07-25 16:47:24 +08:00
Mikhail Rogachev c757f6c6b9
fix: Mutual state update messages are always seen (#3778) 2023-07-25 12:35:05 +04:00
frank 6085a05f77
fixed: failed to migrate up: no such column: TRUE (#3796) 2023-07-25 14:35:05 +08:00
Sale Djenic 7c72d5ec99 fix: discard backed up messages if `ProcessBackedupMessages` is not set to `true`
If user followed onboarding flow to recover his account using seed phrase or keycard,
then `ProcessBackedupMessages` property of node config json object should be set to
`true`, otherwise it should be set to `false` or be omitted.
2023-07-25 07:50:43 +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
Samuel Hawksby-Robinson 1e09a4bc37 Fix for community / messenger state changes 2023-07-24 17:18:42 +01:00
Samuel Hawksby-Robinson 5c36684a3c Fix rekey loop when new community is added 2023-07-24 17:18:42 +01:00
Samuel Hawksby-Robinson a06984aeec Ensured time was a value and implemented explicit RekeyCommunity() 2023-07-24 17:18:42 +01:00
Samuel Hawksby-Robinson 03e28eea0d Implement correct getter and setter functionality for Communities 2023-07-24 17:18:42 +01:00
Samuel Hawksby-Robinson 243135d744 Rekey loop basics 2023-07-24 17:18:42 +01:00
Jonathan Rainville 38ad5dd5d5
fix(communities): fix revealed addresses string comparisons (#3785) 2023-07-24 09:17:12 -04:00
Patryk Osmaczko f1db6d1615 fix: remove redundancy in permissions check when handling request to join
- Fixed redundant permissions check. If community is set to auto-accept,
  then permissions would be checked twice, in
`HandleCommunityRequestToJoin` and `AcceptRequestToJoinCommunity`.
Mitigated it by returning from `HandleCommunityRequestToJoin` immediately
in case of auto-accept.

- Extracted `accountsSatisfyPermissionsToJoin` to remove code
  duplication and simplify the logic.
2023-07-21 20:41:34 +02:00
Mikhail Rogachev 631962ce88
feat: add api to remove private key (#3772)
* feat: add api to remove private key and separete owner from private key ownership

For https://github.com/status-im/status-desktop/issues/11475

* feat: introduce IsControlNode for Community

* feat: remove community private key from syncing

* feat: add IsControlNode flag to Community json serialisation

* Update protocol/protobuf/pairing.proto

Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com>

---------

Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com>
2023-07-21 13:41:26 +04:00
Mykhailo Prakhov ac64e33362
chore: validate CommunityDescription signature before sending/during receiving CommunityEventsMessage (#3784)
* chore: validate CommunityDescription in CommunityEventMessage

* Update protocol/communities/community_event.go
2023-07-21 11:38:34 +02:00
Patryk Osmaczko d9df8b6150 feat: add CommunityEncryptionKeyActions and its evaluation logic
Added utility that evaluates necessary encryption key actions based on
community changes.

part of: status-im/status-desktop#10998
2023-07-20 17:17:46 +02:00
Sale Djenic 42d5d36cf5 fix: fixed accounts positions in case of account deletion 2023-07-20 14:32:41 +02:00
Sale Djenic 543b087896 fix: wallet accounts ordering improvements 2023-07-20 14:32:41 +02:00
Jonathan Rainville 12dc86fe1b
fix(persistence): fix get revealed accounts when isAirdropAddress is nil (#3780) 2023-07-19 15:23:00 -04:00
John Ngei cf2d72bfa8
Mute and Unmute community
* mute and unmute all community chats when community mute status changes

* unmute community when atleast one channel is unmuted

* fix: save community, extend the function to save muted state and mute duration
2023-07-19 15:14:42 +03:00
Dario Gabriel Lipicar 1f379aec1f feat: implemented multi chain collectible ownership provider 2023-07-19 07:58:05 -03:00
Mykhailo Prakhov 0919a87588
chore: community admin events (#3678)
chore: 
- add CommunityEventsMessage
- refactor community_admin_event to accept a list of events and patch a CommunityDescription
- save/read community events into/from database
- publish and handle community events message
- fixed admin category tests
- rename AdminEvent to Events or CommunityEvents
2023-07-18 17:06:12 +02:00
frank 71ca35bf34
Feat/sync customization color (#3702)
* sync customization color

* addressed feedback from @cammellos

* add param customizationColorClock to function generateOrImportAccount
2023-07-18 21:35:06 +08:00
Andrea Maria Piana df2a5d8e21 Update go waku & Shorten shutdown 2023-07-17 14:44:32 +01:00
Patryk Osmaczko caca511aed refactor: extract community_changes 2023-07-17 12:48:47 +02:00
Jonathan Rainville 9674bc463f
feat(communities): add airdropAddress param to SharedAccounts (#3756)
Adds airdropAddress to the request to join params and a is_airdrop_address flag in the communities_requests_to_join_revealed_addresses table. 

This airdropAddress is used by the owner to know which address to use when airdropping
2023-07-14 13:33:47 -04:00
Jonathan Rainville 11a3f495bd
fix: only save/send request to join when the permissions are satisfied (#3748) 2023-07-14 13:06:37 -04:00
Mikhail Rogachev 1f3a860867
fix: ignore contact requests from mutual and dismissed contacts (#3754)
https://github.com/status-im/status-desktop/issues/11483
2023-07-14 17:37:38 +04:00
Andrea Maria Piana 1a9742a3c7 Remove unsopported DROP statement 2023-07-14 08:23:38 +01:00
Andrea Maria Piana 3f5f87d1d1 Don't panic if config is nil in community
I have encountered a crash in the app after syncing, looks like a
community has been created without a Config.
This crashes the app after the user logs in.
This commit prevents the app from crashing, but does not fix the
underlaying issue (that's something I will have to investigate).
Added tests to validate the behavior.

Check community exists
2023-07-14 08:23:38 +01:00
Andrea Maria Piana 7da855c0bf Use base test messenger suite 2023-07-13 14:01:55 +01:00
Andrea Maria Piana 23ca4ba204 Use base test messenger suite 2023-07-13 14:01:55 +01:00
Mikhail Rogachev 8bcc493477
Fix: mutual state messages behaviour (#3640)
* feat: don't remove sent mutual state messages on accepting a CR

* fix: don't send mutual state message for a new contact

* chore: move mutual state messages to `addContact`

* fix: use one chat for mutual state messages and contact requests

* fix: change `added` mutual state updatede messages to `accepted`

* feat: Use different content type for each mutual state event system message

* chore: use constants for mutual event system messages test, review fixes

* chore: fix tests related to local contacts map
2023-07-12 11:12:58 -04:00
Igor Sirotin 244b4273de
fix: don't store ourselves as a contact (#3627) 2023-07-12 12:46:56 +03:00
Michal Iskierko ff0628c23b feat(Collectibles): Handle ERC20 burn and mint
Modify API to handle also ERC20 tokens.
Modify community_tokens table - keep supply as string since string is easly convertible to bigint.BigInt.
Use bigint.BigInt for supply functions and fields.

Issue #11129
2023-07-12 10:41:17 +02:00
Sale Djenic 7063ad11aa chore: synchronization improvements applied to keycards
This is the second step of improvements over keypairs/keycards/accounts.
- `SyncKeycardAction` protobuf removed
- `SyncKeypair` protobuf is used for syncing keycards state as well as for all
keycards related changes
- `last_update_clock` column removed from `keypairs` table cause as well as
for accounts, any keycard related change is actually a change made on a related
keypair, thus a keypair's clock keeps the clock of the last change
- `position` column added to `keypairs` table, needed to display keycards in
the same order accross devices
2023-07-11 15:14:49 +02:00
Ibrahem Khalil 0c57890a84
[status-mobile-16467] Fix delete for me on receiver side using wrong chatID (#3732) 2023-07-10 22:26:32 +03:00
Jonathan Rainville 2c275058ad
feat(community): add api to edit shared address (#3723) 2023-07-10 10:11:37 -04:00
Jonathan Rainville e9d8f4cab2
feat(communities): enable RequestCommunityInfo to use a privateKey (#3681) 2023-07-07 14:26:38 -04:00
Patryk Osmaczko 2613064356 chore: remove unused `applicationLayer` parameter of `HandleMessages` 2023-07-07 16:33:44 +02:00
Andrea Maria Piana 5a2757e785 Remove long running randomised test 2023-07-07 14:49:40 +01:00
Andrea Maria Piana c3ae0e98fe Enable lightclient 2023-07-07 14:49:40 +01:00
Patryk Osmaczko cd1ba1abaa refactor: remove unused parameter from `handleArchiveMessages` 2023-07-07 11:17:14 +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
Sale Djenic 61527f8c78 chore: synchronization improvements applied to keypairs/accounts
This is the first step of improvements over keypairs/keycards/accounts.
- `SyncKeypairFull` protobuf removed
- `SyncKeypair` protobuf is used for syncing all but the watch only accounts
- `SyncAccount` is used only for syncing watch only accounts
- related keycards are synced together with a keypair
- on any keypair change (either it's just a keypair name or any change made over an
account which belongs to that keypair) entire keypair is synced including related keycards
- on any watch only account related change, that account is synced with all its details
2023-07-05 14:41:26 +02:00
Pascal Precht 4305147f7a feat: add cropping support for community token assets
This commit extends the `AddCommunityToken` API to also expect an
optional `CroppedImage`, which will be used instead of the `ImageBase64`
path provided by `CommunityToken`, to calculate the actual base64
encoded image.
2023-07-05 11:46:23 +02:00
Mikhail Rogachev 511d6bfc54
feat: add parsing for new links format (#3665)
* feat(share-links): Add protobuf and encode/decode url data methods

* feat(new-links-format): Adds generators for new links format

* feat: add parsing for new links format

* feat: add messenger-level pubkey serialization and tests

* feat: fix and test CreateCommunityURLWithChatKey

* feat: impl and test parseCommunityURLWithChatKey

* feat: fix and test CreateCommunityURLWithData

* feat:  impl and test parseCommunityURLWithData (not working)

* feat: UrlDataResponse as response share urls api

* feat: impl& tested ShareCommunityChannelURLWithChatKey

* feat: impl & tested ParseCommunityChannelURLWithChatKey

* fix: bring urls to new format

* feat: add regexp for community channel urls

* feat: impl & test contact urls with chatKey, Ens and data

* fix: encodeDataURL/encodeDataURL patch from Samyoul

* fix: fix unmarshalling protobufs

* fix: fix minor issues, temporary comment TestParseUserURLWithENS

* fix: allow url to contain extra `#` in the signature

* fix: check signatures with SigToPub

* chore: lint fixes

* fix: encode the signature

* feat: Check provided channelID is Uuid

* fix(share-community-url): Remove if community encrypted scope

* fix: review fixes

* fix: use proto.Unmarshal instead of json.Marshal

* feat(share-urls): Adds TagsIndices to community data

* feat: support tag indices to community url data

---------

Co-authored-by: Boris Melnik <borismelnik@status.im>
2023-07-04 17:48:52 +04:00
Pascal Precht 8184ae62ed fix: mark community as no longer spectated when joined
Fixes https://github.com/status-im/status-desktop/issues/11334
2023-07-04 15:35:37 +02:00
Andrea Maria Piana 55f7ac420d Make sure image URL are preserved when deleting a message for me
When deleting a message for me, the image url wasn't preserved,
resulting in the image disappearing on the client side.
This commit adds the processing of returned messages so that the image
is preserved.
2023-06-30 11:12:26 +01:00
Michal Iskierko 6ec50d52aa feat(AssetsDeployment): Assets deployment
- Add ERC20 contract
- Add decimals field to community_tokens db table
- Adjusting API to handle assets deployment
- Add decimals field to CommunityTokenMetadata

Issue #10987
2023-06-29 16:10:05 +02:00
Andrea Maria Piana 40a59b3aca Allow passing nameserver on login
Nameserver is passed by the OS on creation/restore, this commit adds the
ability to pass it at login time.
We don't want to store it on disk since that's bound to change, and
currently there's a bug on golang that prevents getting the DNS from the
system on android.
2023-06-29 13:05:46 +01:00
Andrea Maria Piana 190094e40d Correctly shutdown messengers 2023-06-29 13:04:49 +01:00
Andrea Maria Piana d91d11a01c Call before dispatch for group chat messages 2023-06-29 13:04:49 +01:00
Andrea Maria Piana db56132d01 Avoid publishing on a channel if manager stopped 2023-06-29 13:04:49 +01:00
frank bbb17c6ce8 fix: unable to perform backup 2023-06-29 13:04:49 +01:00
frank 09c5223d77
fix: ROW_NUMBER() not work on ios for some reason (#3687) 2023-06-29 18:45:57 +08:00
Roman Volosovskyi 18a0bc3130
Set installation name on account creation and pairing 2023-06-29 10:14:12 +02:00
Patryk Osmaczko c53723705c chore: add TestBecomeMemberPermissions integration test 2023-06-29 10:02:09 +02:00
Patryk Osmaczko 0bf114bc3c chore: cleanup communities_messenger_token_permissions_test 2023-06-29 10:02:09 +02:00
Pascal Precht db65d42912 fix: default to attaching all support chainIDs in membership requests
There's only one scenario in which a `RevealedAccount` will have an
empty `ChainIDs` list attached to it:

When the community in question requires users to satisfy certain
criteria to join, and the user's wallet does not own the necessary funds
on any of the supported chains.

If there are **no** permissions to join on the community, then we want
to reveal all (selected) accounts with all supported chainIDs.

This is necessary so that, once the community *does* become
permissioned, it'll have address + chain information from all joined
members.

Closes: https://github.com/status-im/status-desktop/issues/11255
2023-06-29 08:46:02 +02:00
Sale Djenic 5738cf7e21 keypairs pairing details added to local pairing 2023-06-28 14:04:47 +02:00
Sale Djenic 413120e299 feat: local pairing - adding support for syncing from a profile which is migrated to a Keycard 2023-06-28 14:04:47 +02:00
Khushboo-dev-cpp e1004b4aec
feat: Add new settings for include watch-only accounts (#3676) 2023-06-28 12:05:06 +02:00
Patryk Osmaczko a2a2e61163 refactor: extract communities_messenger_token_permissions_test
`communities_messenger_test` was unnecessarily polluted with passwords
and addresses.
2023-06-28 07:56:51 +02:00
Ibrahem Khalil fc353d5dff
Only send PNs to chats that are unmuted (#3673) 2023-06-27 19:19:21 +04:00
Pascal Precht b8b402da8d feat: store check channel permission responses
This commit adds new tables to the database and APIs in `Messenger` and
communities `Manager` to store `CheckChannelPermissionsResponse`s.

The responses are stored whenever channel permissions have been checked.

The reason we're doing this is so that clients can retrieve the last
known channel permission state before waiting for onchain checks to
finish.
2023-06-27 12:13:59 +02:00
Pascal Precht a8678575a7 fix: admins are not allowed to kick or ban other admins 2023-06-27 09:14:26 +02: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
Alexander 83238283b4
Updates ring width and palette to match the designs (#3671) 2023-06-26 13:17:59 +01:00
Patryk Osmaczko 783a6b9153 fix: remove rekeying unencrypted communities 2023-06-23 16:33:58 +02:00
MishkaRogachev ecf493e6cd chore: less flaky AccountManagerMock for community tests 2023-06-23 14:54:44 +01:00
Andrea Maria Piana 6e19098dee Run tests separately, make sure messenger is shutdown, fix torrent test 2023-06-23 11:30:04 +01:00
Jonathan Rainville 9c596343be
feat(communities): enable selecting addresses to pass when joining (#3656)
Improve `RequestToJoinCommunity`  to accept `Addresses` in the request. If `Addresses` is not empty, we then only pass to the owner the selected addresses. The others are ignored.
Does not validate that the addresses in the slice are part of the user's wallet. Those not part of the wallet are just ignored.
2023-06-22 14:59:07 -04:00
Boris Melnik 3e7d1a5f34
fix(migration): Fixes mute_till migration (#3653) 2023-06-22 18:49:58 +03:00
Ibrahem Khalil d3e650d5e5
Make chat muting only works on one chat and not to completely block PNs from a user (#3647) 2023-06-22 08:06:32 +03:00
Mikhail Rogachev 2fb87b5f0d
Chore: improve mocking for community tests (#3637)
* chore: different wallet addresses for different users in community tests

* chore: fix naming for account.Manager interface
2023-06-21 16:13:31 +04:00
frank fee033fadb
support mention Non-Latin nickname (#3641)
* support mention non-Latin nickname

* use IndexRune instead of Index

* fix mobile issue #15524

* add another test case
2023-06-21 14:42:14 +08:00
Pascal Precht bf64f97d5a feat: introduce `CheckAllCommunityChannelsPermissions()` API
This API is used to get a permission status of all channels of a given
community.

Clients can use this API to get the provided information for all
community channels with a single RPC call instead of doing one call
for each channel separately.
2023-06-20 10:06:44 +02:00
Pascal Precht 7938297606 feat: introduce `CheckChannelPermissions` API
Similar to `CheckPermissionToJoin()` we now get
a `CheckChannelPermissions()` API.

It will rely on the same `PermissionResponse` types, but gives
information about both `ViewOnlyPermissions` and
`ViewAndPostPermissions`.
2023-06-20 09:42:10 +02:00
Pascal Precht f702b54d08 fix: don't check permissions if revealed accounts aren't legit
This seems to be a bug that was introduced when two features, admin
permissions and "always reveal wallet accounts" where merged.

We need to make sure we **first** check the revealed accounts and only
**then** do we perform permission checks on them. Otherwise we can run
into scenarios where fake addresses are used and users will be accepted
to the community.
2023-06-19 15:27:10 +02:00
Pascal Precht a36202ff30 fix: don't return with error in permissions check when no chain IDs are
found

Turns out that, when we return with an error, instead of
a non-statisfied check permissions response, we can run into cases where
members that should be kicked are not kicked.
2023-06-19 15:26:42 +02:00
Pascal Precht 05e67b1838 fix: add missing private field when converting permission request 2023-06-19 15:26:42 +02:00
frank 0fcf3abd83
Improve/mention input segments (#3631)
* improve calculate input segments relate to mention feature

* bump version

* rename variable
2023-06-19 19:08:45 +08:00
Boris Melnik 1eb92a19a2
feat(communities): Adds muting interval to community (#3549) 2023-06-17 11:19:05 +03:00
frank 9e7f1338f0
refactor function diffText (#3615) 2023-06-16 23:09:37 +08:00
Mikhail Rogachev 51e3d800bb
fix: save revealed accounts regardless of permissions granted (#3609) 2023-06-16 11:10:32 +04:00
Michal Iskierko ccde92377d feat(BurnCollectibles): Add burn collectibles functionality
Change smart contract with new API.
Update gas amount for deployment.
Add Burn() and EstimateBurn() functions.
Add RemainingSupply() functions.

Issue #10816
2023-06-15 15:38:19 +02:00
Andrea Maria Piana 8015cc3e3b Handle race condition when sending envelopes
It happens that an envelope is sent before it's tracked, resulting in
long delays before the envelope is marked as sent.
This commit changes the behavior of the code so that order is now
irrelevant.
2023-06-15 11:28:19 +01:00
Mykhailo Prakhov e058b50a2e
feat: community admin permission functionality (#3569)
* feat: community admin implementation

* fix: code review fixes

* chore: request admin permissions in CheckPermissionToJoin, unit test fix
2023-06-14 10:15:46 -04:00
Pascal Precht 3f231f53e3 Ensure `ChatIds` are handled by token permission requests 2023-06-13 13:42:48 +02:00
mprakhov 83ed3e5ede fix: allow to set token permission as a private 2023-06-13 13:42:48 +02:00
mprakhov 6bc8765d39 chore: new CommunityTokenPermission types 2023-06-13 13:42:48 +02:00
Patryk Osmaczko a402b28b9f chore: resume archives import with delay
closes: status-im/status-desktop#10937
2023-06-13 08:38:15 +02:00
Andrea Maria Piana 37653638bc Make sure the image URL is returned when a replied message is deleted
When we reply to our own message with an image, we didn't set the URL of
the image of the message, which resulted in the image not being
displayed correctly.
2023-06-12 19:22:26 +01:00
Pascal Precht 1a2ca21070 Add chainIds to revealed accounts in memberhsip requests
This commit does a few things:

- Adds a migration that adds chainids to communities_request_to_join_revealed_addresses
- Removes RevealedAddress in favor of RevealedAccount which is now a struct that contains the revealed address, as well as the signature and a list of chain IDs on which to check for user funds
- Changes the logic of sending requests to join a community, such that after creating address signatures, the user node will also check which of the addresses has funds on which networks for the community's token permissions, and add the chainds to the RevealedAccount
- Updates checkPermissionToJoin() such that only relevant chainids are used when checking user's funds. Chain IDs are retrieved from RevealedAccounts and matched against token permission criteria chain IDs
2023-06-12 10:49:29 +02:00
Pascal Precht 511faad0ec fix: don't unsubscribe from community when kicked
There's two scenarios in which we're leaving a community:
We either get kicked or we leave ourselves.

In case of leaving ourselves it's fine to unsubscribe from further
community updates be cause we deliberately chose to leave.

In case of being kicked however, this is different.
Say I'm kicked from a community because its token permissions have
changed, in this case we don't want clients to manually re-subscribe to
the community to get informed when there were further changes.
status-go should rather not unsubscribe if we know for sure we've been
kicked by someone else.
2023-06-12 09:37:12 +02:00
Ibrahem Khalil 47711c4f15
Show mention notification/AC once for a message with multiple images (#3485) 2023-06-10 12:57:40 +04:00
frank b6d4e75cf1
Feat/sync activity center notification (#3535)
fix flaky test: TestRetrieveBlockedContact

resolve conflict when rebase origin/develop

Feat/sync activity center notification (#3581)

* feat: sync activity center notification

* add test

* fix lint issue

* fix failed test

* addressed feedback from sale

* fix failed test

* addressed feedback from ilmotta

go generate ./protocol/migrations/sqlite/...

feat: add updated_at for syncing activity center notification
2023-06-10 10:00:17 +08:00
Sale Djenic 56cad423f0 chore: `forceFetchingBackup` param added to `RequestAllHistoricMessages` and `RequestAllHistoricMessagesWithRetries` functions 2023-06-09 17:42:11 +02:00
Mikhail Rogachev 8589a525a5
Add system message for mutual contact state updates (#3519)
* feat: add mutual state update system message

* feat: send mutual state update on accepting CR

* feat: send mutual state update when removing a contact

* fix: don't send MutualStateUpdateMessage over wire

* fix: mutual state update message text fixed

* fix: new clock to ensure system message after CR and add chat to the response

* feat: add AC notification for contact removal

* feat: replace "sent" mutual state system message with "added"
2023-06-08 16:00:19 +04:00
Stefan 5b6f7226bb feat(wallet) extract json blobs and add custom migration support
Extended the migration process with a generic way of applying custom
migration code on top of the SQL files. The implementation provides
a safer way to run GO code along with the SQL migrations and possibility
of rolling back the changes in case of failure to keep the database
consistent.
This custom GO migration is needed to extract the status from
the JSON blob receipt and store it in transfers table.

Other changes:
- Add NULL DB value tracking to JSONBlob helper
- Index status column on transfers table
- Remove unnecessary panic calls
- Move log_parser to wallet's common package and use to extract token
  identity from the logs

Notes:
- there is already an index on transfers table, sqlite creates one for
  each unique constraint therefore add only status to a new index
- the planned refactoring and improvements to the database have been
  postponed due to time constraints. Got the time to migrate the data
  though, extracting it can be done later for a more efficient
  implementation

Update status-desktop #10746
2023-06-08 13:54:40 +02:00
frank 9e0a12cb32
fix: Mention is not resolved if username or nickname of one is a substring of another (#3571)
* fix mobile issue #16099

* bump version
2023-06-08 14:47:38 +08:00
Patryk Osmaczko 46768e624a feat: add and populate IdentityImage::LocalURL
part of: status-im/status-desktop#10886
2023-06-07 22:32:50 +02:00
Alex Jbanca e8c4b7647f
chore(upgradeSQLCipher): Upgrading SQLCipher to version 5.4.5 (#3559)
* chore(upgradeSQLCipher): Upgrading SQLCipher to version 5.4.5

Changes:
### github.com/mutecomm/go-sqlcipher
1. The improved crypto argorighms from go-sqlcipher v3 are merged in v4
	Tags:
	v4.4.2-status.1 - merge `burn_stack` improvement
	v4.4.2-status.2 - merge `SHA1` improvement
	v4.4.2-status.4- merge 'AES' improvement
2. Fixed `go-sqlcipher` to support v3 database in compatibility mode (`sqlcipher` already supports this) (Tag: v4.4.2-status.3)
3. Upgrade `sqlcipher` to v5.4.5 (Tag: v4.5.4-status.1)

### github.com/status-im/migrate/v4
1. Upgrade `go-sqlcipher` version in `github.com/status-im/migrate/v4`

### status-go
1. Upgrade `go-sqlcipher` and `migrate` modules in status-go
2. Configure the DB connections to open the DB in v3 compatibility mode

* chore(upgradeSQLCipher): Use sqlcipher v3 configuration to encrypt a plain text database

* chore(upgradeSQLCipher): Scanning NULL BLOB value should return nil

Fixing failing tests: TestSyncDeviceSuite/TestPairingSyncDeviceClientAsReceiver;  TestSyncDeviceSuite/TestPairingSyncDeviceClientAsSender

Considering the following configuration:
1. Table with BLOB column has 1 NULL value
2. Query the value
3. Rows.Scan(&dest sql.NullString)

Expected: dest.Valid == false; dest.String == nil
Actual: dest.Valid == true; dest.String == ""

* chore: Bump go-sqlcipher version to include NULL BLOB fix
2023-06-07 08:58:01 +03:00
Sale Djenic 874a0656db fix: profile social links, fix older clock error 2023-06-06 17:05:55 +02:00
Omar Basem 1d4fa29f8e
feat: add images count to reply (#3574)
* feat: add images count to reply
2023-06-06 15:52:07 +04:00
Sale Djenic cff7d2f693 fix: profile social links updated 2023-06-06 09:59:12 +02:00