Commit Graph

899 Commits

Author SHA1 Message Date
Pascal Precht 5ec9e1ac46 feat: check member permission funds periodically
This adds a periodic member permission check for every admin community
such that member funds are checked every hour.
2023-03-23 12:04:59 +01:00
Pascal Precht 128f82df09 Perform token criteria checks on existing members
When a community permission is edited, we need to revalidate
the token criteria with the existing member list, as members might
no longer fulfill the requirements.

This commit runs the checks in a go routine after the permission has
been updated.
2023-03-23 08:53:43 +01:00
Pascal Precht 2cbced95c5 Check token funds when handling community requests to join
This adds checks to `HandleCommunityRequestToJoin` and
`AcceptRequestToJoinCommunity` that ensure a given user's revealed
wallet addresses own the token funds required by a community.

When community has token permissions of type `BECOME_MEMBER`, the
following happens when the owner receives a request:

1. Upon verifying provided wallet addresses by the requester, the owner
   node accumulates all token funds related to the given wallets that
   match the token criteria in the configured permissions
2. If the requester does not meet the necessary requirements, the
   request to join will be declined. If the requester does have the
   funds, he'll either be automatically accepted to the community, or
   enters the next stage where an owner needs to manually accept the
   request.
3. The the community does not automatically accept users, then the funds
   check will happen again, when the owner tries to manually accept the
   request. If the necessary funds do not exist at this stage, the
   request will be declined
4. Upon accepting, whether automatically or manually, the owner adds the
   requester's wallet addresses to the `CommunityDescription`, such that
   they can be retrieved later when doing periodic checks or when
   permissions have changed.
2023-03-23 08:40:31 +01:00
Pascal Precht 48eb705284 fix: add `decimals` to `TokenCriteria`
We need to store the `decimals` of a given token when creating community
permissions so that we can use it later on to do calculations when
checking funds for given wallet addresses.
2023-03-22 14:31:36 +01:00
Andrea Maria Piana 31ae4c958b Add RestoreAccountAndLogin endpoint 2023-03-22 13:31:16 +00:00
Pascal Precht 051314aad0 feat: add verified wallet accounts to community requests
This commit extends the `CommunityRequestToJoin` with `RevealedAddresses` which represent wallet addresses and signatures provided by the sender, to proof a community owner ownership of those wallet addresses.

**Note: This only works with keystore files maanged by status-go**

At high level, the follwing happens:

1. User instructs Status to send a request to join to a community. By adding a password hash to the instruction, Status will try to unlock the users keystore and verify each wallet account.
2. For every verified wallet account, a signature is created for the following payload, using each wallet's private key

   ``` keccak256(chatkey + communityID + requestToJoinID) ``` A map of walletAddress->signature is then attached to the community request to join, which will be sent to the community owner
3. The owner node receives the request, and if the community requires users to hold tokens to become a member, it will check and verify whether the given wallet addresses are indeed owned by the sender. If any signature provided by the request cannot be recovered, the request is immediately declined by the owner.
4. The verified addresses are then added to the owner node's database such that, once the request should be accepted, the addresses can be used to check on chain whether they own the necessary funds to fulfill the community's permissions

The checking of required funds is **not** part of this commit. It will be added in a follow-up commit.
2023-03-22 13:50:25 +01:00
Michal Iskierko 736766ec37 fix(AddCommunityToken): Change AddCommunityToken API call
The function returns object with image converted to base64 format.

Issue #9866
2023-03-22 13:45:53 +01:00
Mikhail Rogachev 81dd214e9b
feat: Remove cancelOutgoingContactRequest feature (#3293) 2023-03-21 20:49:14 +07:00
Andrea Maria Piana 6775e79920 Make image path optional 2023-03-20 19:36:41 +00:00
Igor Sirotin 7e8804788e
feat: Added `setInstallationName` method (#3294) 2023-03-20 23:51:17 +11:00
Boris Melnik 1453f5a0e3
fix(activity_center): Add remove activity center notifications array to message response (#3277) 2023-03-16 21:41:53 +03:00
Andrea Maria Piana 3d2fd26d80 Add CreateAccount endpoint 2023-03-16 17:02:11 +00:00
Andrea Maria Piana 5d0e08ec7b Add spiff workflow cmd 2023-03-16 14:31:34 +00:00
Andrea Maria Piana d1ec6d876c Fix collapsed tests 2023-03-16 13:40:20 +00:00
Andrea Maria Piana b20dc0a87c Add index to raw messages 2023-03-16 13:40:20 +00:00
Pascal Precht 6859a1d3b7 Add methods to sign and recover messages/signatures to AccountManager
Also, make AccountManager a dependency of Messenger.
This is needed for community token permissions as we'll need a way to access wallet accounts
and sign messages when sending requests to join a community.

The APIs have been mostly taken from GethStatusBackend and personal service.
2023-03-16 12:25:06 +01:00
Lukáš Tinkl 0eef19f80e feat: dynamic social links
- completely replace social links on save
- respect the order of items and also the URL when comparing

Rationale: for MVP, we'll want the user to be able to add several links
of the same type, and adjust/preserve their order by drag'n'drop

Needed for https://github.com/status-im/status-desktop/issues/9777
2023-03-15 12:41:57 +01:00
Andrea Maria Piana 44a0f5b74d
Add collapsed community categories 2023-03-14 17:13:21 +00:00
Roman Volosovskyi 290579f74f
Update wakuext_buildContact 2023-03-14 16:57:33 +01:00
Andrea Maria Piana 5d81866957 Add request to response when canceling request 2023-03-14 13:50:18 +00:00
Alexander 7123b22c52
Fetch details of user when adding a contact (#3271) 2023-03-14 10:00:05 +01:00
Richard Ramos 8fe077380b fix: set device type on init 2023-03-09 18:02:49 -04:00
Pascal Precht f5475ed45c fix: add missing `Name` property to `CommunityTokensMetadata` 2023-03-07 16:37:36 +01:00
Pascal Precht a6194ffad4 fix: don't expect `CommunityTokensMetadata` in `EditCommunity()`
The `Edit()` method on `Community` merely updates "primitive" values
that live inside a community description. For any data that is more complex,
we typically have dedicated methods.

Because `Edit()` was expecting `CommunityTokensMetadata`, it would
override it with empty data every time we would edit a community.
This is because we typically don't update that kind of data as part
of `Edit()`.

In addition, `CommunityTokensMetadata` is append-only anyways,
so there wouldn't be any other way to update that field, other than
adding new items to it, which is done in a dedicated method.
2023-03-07 16:07:48 +01:00
yqrashawn 475b5f855f
feat: allow group admin to delete others message (#3259) 2023-03-07 22:38:09 +08:00
Sale Djenic b660672a60 chore(accounts): `type` column from `accounts` table updated
`type` column is set for all rows to appropriate value. Before this change
accounts which were generated from the keypair created importing seed phrase
had `generated` value for the `type`.

According to above, a function for generating an account sets the `type`
based on the passed derive from address.
2023-03-07 11:28:06 +01:00
Michal Iskierko 1b24342a75 feat(CommunityTokenMetadata): Keep token metadata in CommunityDescription
Community tokens has some metadata (image, description) which must be kept in waku(CommunityDescription).
Add CommunityTokenMetadata message to communities.proto.
Add []CommunityTokenMetadata to CommunityDescription.

Issue #9545
2023-03-07 08:40:47 +01:00
IvanBelyakoff 48078393f9
feat: Update saved addresses DB to store ENS, isTest flag and chains (#3183)
prefixes. Changed primary keys and API methods.
Fixed tests and added new ones.
Fixed saved addresses and transaction tests to use ':memory:' sqlite
DB instead of a tmp file to speed up testing by hundred of times.

Fixes #8599
2023-03-06 16:26:46 +03:00
Vitaliy Vlasov 27a76f43ba Compute emojiHash on-the-fly 2023-03-06 13:22:40 +02:00
Michal Iskierko 8a296407f3 fix(GetCommunityTokens): Change API call - use only communityId param
Fix #9725
2023-03-06 10:46:41 +01:00
Mohamed Javid 9fbc4d51ee
[Fix] Community ID for Mention or Replies Notification in Activity Center (#3250)
* [Fix] Community ID for Mention or Replies Notification in Activity Center

* [Update] Version Number
2023-03-03 22:42:12 +05:30
Mikhail Rogachev 224f7461e9
feat: refactor activity center endpoints (#3237)
* feat: refactor activity center endpoints

* fix: restore activity center tests using new endpoints

* feat: Remove from activity center endpoints accepted flag

* feat: Activity Center review fixes
2023-03-03 18:31:48 +04:00
Pascal Precht 596660c110 feat: add CommunityTokenPermission to community description
This adds token permission capabilities to CommunityDescription such that token permissions can be created, updated and deleted.
2023-03-03 09:46:49 +01:00
Pascal Precht 2ef10f23e5 feat(protobuf): introduce `CommunityTokenType` enum
This is a shared enum type that will be used by `CommunityDescription`
and community token permission protobuf (introduced in a future commit).
2023-03-03 08:20:51 +01:00
Richard Ramos e1ea1ccab5 chore: find free port for torrent if set as 0 2023-03-02 08:50:41 -04:00
Roman Volosovskyi 6cdc0ed5a1
Fix syncing of contact request local state 2023-03-02 11:26:50 +01:00
Sale Djenic 93de01e32e feat: backup keycards to and fetch them from waku
Changes applied here introduce backing up keycards data to and fetch them from waku.
Information about received keycards data is sent via `sync.from.waku.keycards` signal.
2023-02-28 19:23:36 +01:00
frank 837bf2ca42
support local pairing after logged in as receiver; pair installation;(#3202) 2023-02-28 20:32:45 +08:00
Andrea Maria Piana f77bff6d25 Add primary & secondary names 2023-02-27 15:13:43 +00:00
Sale Djenic 2d16e7b891 feat(keycard): keycard details are being synced among devices
- sync all keycards state
- sync every keycard change
2023-02-27 16:03:02 +01:00
Michal Iskierko d0cc036d48 feat(CommunityTokens): Keep community token details in database
New table for community tokens.
API for get,add, update community token.

Issue #9233
2023-02-27 10:37:54 +01:00
Icaro Motta 999d8c0ee0
Support soft deletion for activity center notifications (#3201)
Adds a new column named `deleted` to the table `activity_center_notifications`. 

Related PR in Mobile https://github.com/status-im/status-mobile/pull/15106 for a lot more details of the feature.

Why? Relying on the `dismissed` column for soft deletion is no longer viable because the mobile & desktop clients should display dismissed notifications (sometimes), hence the need for a new column to truly represent soft deletion.
2023-02-24 20:47:04 -03:00
Mikhail Rogachev 766f27d8f3
feat: Add `ActivityCenterNotificationsCountBy` endpoint (#3206)
* feat: add fetching notifications by activity center group

* feat: add api for counting notifications by activity center group

* chore: activity center query code refactor

* feat: add endpoint returning ActivityCenterType(s) by ActivityCenterGroup

* chore: Remove activityGroup from status-go level

* feat: add endpoint for counting notifications with different conditions
2023-02-24 20:35:48 +04:00
Andrea Maria Piana 11db9f2119
Add test for everyone tag & fix migration order
A migration was added out-of-order, which meant that in clients who
had already run the migration after, it would be skip.
This commit re-adds the migration so it's run, tested against an empty
account and one that had already migrated.
2023-02-24 10:18:26 +00:00
Pascal Precht c6f6ca99ae fix: subscribe to spectated community updates after bootstrap 2023-02-23 09:15:28 +01:00
RichΛrd 0babdad17b
chore: upgrade go-waku to v0.5 (#3213)
* chore: upgrade go-waku to v0.5
* chore: add println and logs to check what's being stored in the enr, and preemptively delete the multiaddr field (#3219)
* feat: add wakuv2 test (#3218)
2023-02-22 17:58:17 -04:00
Alexander 27730057d0
Support outgoing contact requests (#3120)
* Outgoing contact requests

* Test fix

* Test fix

* Fixes

* Bugfixes

* Bugfixes

* Almost there

* Removed the activity center notification

* Test update

* Almost ready

* Fixes

* Fixes
2023-02-21 19:08:11 +01:00
frank e64091c779
support passing kdf and node config from receiver when local pairing (#3179) 2023-02-17 21:02:42 +08:00
Vitaliy Vlasov 2f41034b47 Fix sync_device_test 2023-02-17 12:10:44 +02:00
Vitaliy Vlasov 83a6dbfa3e Update account name during displayName setting syncing 2023-02-17 12:10:44 +02:00