051314aad0
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. |
||
---|---|---|
.. | ||
000001_init.down.db.sql | ||
000001_init.up.db.sql | ||
000002_add_last_ens_clock_value.up.sql | ||
1586358095_add_replace.up.sql | ||
1588665364_add_image_data.up.sql | ||
1589365189_add_pow_target.up.sql | ||
1591277220_add_index_messages.up.sql | ||
1593087212_add_mute_chat_and_raw_message_fields.up.sql | ||
1595862781_add_audio_data.up.sql | ||
1595865249_create_emoji_reactions_table.up.sql | ||
1596805115_create_group_chat_invitations_table.up.sql | ||
1597322655_add_invitation_admin_chat_field.up.sql | ||
1597757544_add_nickname.up.sql | ||
1598955122_add_mentions.up.sql | ||
1599641390_add_emoji_reactions_index.up.sql | ||
1599720851_add_seen_index_remove_long_messages.up.sql | ||
1603198582_add_profile_chat_field.up.sql | ||
1603816533_add_links.up.sql | ||
1603888149_create_chat_identity_last_published_table.up.sql | ||
1605075346_add_communities.up.sql | ||
1610117927_add_message_cache.up.sql | ||
1610959908_add_dont_wrap_to_raw_messages.up.sql | ||
1610960912_add_send_on_personal_topic.up.sql | ||
1612870480_add_datasync_id.up.sql | ||
1614152139_add_communities_request_to_join.up.sql | ||
1615374373_add_confirmations.up.sql | ||
1617694931_add_notification_center.up.sql | ||
1618923660_create_pin_messages.up.sql | ||
1619094007_add_joined_chat_field.up.sql | ||
1619099821_add_last_synced_field.up.sql | ||
1621933219_add_mentioned.up.sql | ||
1622010048_add_unviewed_mentions_count.up.sql | ||
1622061278_add_message_activity_center_notification_field.up.sql | ||
1622464518_set_synced_to_from.up.sql | ||
1622464519_add_chat_description.up.sql | ||
1622622253_add_pinned_by_to_pin_messages.up.sql | ||
1623938329_add_author_activity_center_notification_field.up.sql | ||
1623938330_add_edit_messages.up.sql | ||
1624978434_add_muted_community.up.sql | ||
1625018910_add_repply_message_activity_center_notification_field.up.sql | ||
1625762506_add_deleted_messages.up.sql | ||
1627388946_add_communities_synced_at.up.sql | ||
1628280060_create-usermessages-index.sql | ||
1632303896_modify_contacts_table.up.sql | ||
1633349838_add_emoji_column_in_chats.up.sql | ||
1634831235_add_highlight_column_in_chats.up.sql | ||
1634896007_add_last_updated_locally_and_removed.up.sql | ||
1635840039_add_clock_read_at_column_in_chats.up.sql | ||
1637852321_add_received_invitation_admin_column_in_chats.up.sql | ||
1645034601_display_name.up.sql | ||
1645034602_add_mutual_contact_request.up.sql | ||
1650373957_add_contact_request_state.up.sql | ||
1656958989_contact_verification.up.sql | ||
1658236268_add_discord_message_authors_table.up.sql | ||
1659619997_add_discord_messages_table.up.sql | ||
1660226788_create_chat_identity_social_links.up.sql | ||
1660226789_add_walletconnectsessions_table.up.sql | ||
1661242854_add_communities_requests_to_leave.up.sql | ||
1662044232_add_chat_image.up.sql | ||
1662106895_add_chat_first_message_timestamp.up.sql | ||
1662723928_add_discord_author_image_fields.up.sql | ||
1664195977_add_deleted_for_mes.up.sql | ||
1664367420_add_discord_attachments_table.up.sql | ||
1665079662_add_spectated_column_in_communities.up.sql | ||
1665479047_add_community_id_in_notifications.up.sql | ||
1665484435_add_encrypted_messages.up.sql | ||
1665560200_add_contact_verification_individual.up.sql | ||
1670921937_add_album_id.up.sql | ||
1673373000_add_replied.up.sql | ||
1673428910_add_image_width_height.up.sql | ||
1674210659_add_contact_request_local_clock.up.sql | ||
1675212323_add_deleted_by.up.sql | ||
1675247084_add_activity_center_states.up.sql | ||
1675272329_fix_protocol_migration.up.sql | ||
1676998418_fix_activity_center_migration.up.sql | ||
1677278861_add_deleted_column_to_activity_center_notifications_table.up.sql | ||
1677486338_add_community_tokens_table.up.sql | ||
1678292329_add_collapsed_categories.up.sql | ||
1678800760_add_index_to_raw_messages.up.sql | ||
1678877478_add_communities_requests_to_join_revealed_addresses_table.up.sql | ||
README.md | ||
doc.go |
README.md
How to write migrations?
We only write up
migrations, down
migrations are not always possible in sqlite or
too complex/too expensive. For example to remove a column you would have to duplicate
the table, copy over the data, delete and recreated.
This can be very expensive for some tables (user_messages for example), so should not be attempted.
Notes
One issue we faced multiple times is that updates to user_messages
can be very
expensive, leading to slow upgrade times and interrupted migrations. So avoid
writes if not necessary.