From 8c1162ee59b42c2f599b7b9d3b1eb38d7fdb7015 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Sun, 28 Jun 2026 15:53:22 +0000 Subject: [PATCH] rename columns --- src/Simplex/Chat/Names.hs | 2 +- src/Simplex/Chat/Store/Connections.hs | 10 ++--- src/Simplex/Chat/Store/ContactRequest.hs | 4 +- src/Simplex/Chat/Store/Direct.hs | 24 ++++++------ src/Simplex/Chat/Store/Groups.hs | 22 +++++------ src/Simplex/Chat/Store/Messages.hs | 10 ++--- .../Migrations/M20260603_simplex_name.hs | 39 +++++++++++-------- .../Store/Postgres/Migrations/chat_schema.sql | 12 +++--- src/Simplex/Chat/Store/Profiles.hs | 4 +- .../Migrations/M20260603_simplex_name.hs | 39 +++++++++++-------- .../Store/SQLite/Migrations/chat_schema.sql | 12 +++--- src/Simplex/Chat/Store/Shared.hs | 14 +++---- tests/Bots/BroadcastTests.hs | 2 +- tests/Bots/DirectoryTests.hs | 2 +- tests/ChatTests/Profiles.hs | 2 +- tests/ChatTests/Utils.hs | 2 +- tests/ProtocolTests.hs | 4 +- 17 files changed, 109 insertions(+), 95 deletions(-) diff --git a/src/Simplex/Chat/Names.hs b/src/Simplex/Chat/Names.hs index 79ae14dc11..dd35a9d5ca 100644 --- a/src/Simplex/Chat/Names.hs +++ b/src/Simplex/Chat/Names.hs @@ -68,7 +68,7 @@ verifyNameProofSig ownerKey name NameClaimProof {presHeader, signature} = $(JQ.deriveJSON defaultJSON ''NameClaimProof) --- stored as JSON in contact_profiles.contact_domain_proof +-- stored as JSON in contact_profiles.simplex_name_proof instance ToField NameClaimProof where toField = toField . encodeJSON instance FromField NameClaimProof where fromField = fromTextField_ decodeJSON diff --git a/src/Simplex/Chat/Store/Connections.hs b/src/Simplex/Chat/Store/Connections.hs index fef10a4d93..9cf1db1749 100644 --- a/src/Simplex/Chat/Store/Connections.hs +++ b/src/Simplex/Chat/Store/Connections.hs @@ -118,7 +118,7 @@ getConnectionEntity db cxt user@User {userId, userContactId} agentConnId = do c.contact_group_member_id, c.contact_grp_inv_sent, c.grp_direct_inv_link, c.grp_direct_inv_from_group_id, c.grp_direct_inv_from_group_member_id, c.grp_direct_inv_from_member_conn_id, c.grp_direct_inv_started_connection, c.ui_themes, c.chat_deleted, c.custom_data, c.chat_item_ttl, p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, - p.contact_domain, p.contact_domain_verification, p.contact_domain_proof + p.simplex_name, p.simplex_name_verification, p.simplex_name_proof FROM contacts c JOIN contact_profiles p ON c.contact_profile_id = p.contact_profile_id WHERE c.user_id = ? AND c.contact_id = ? AND c.contact_status = ? AND c.deleted = 0 @@ -145,7 +145,7 @@ getConnectionEntity db cxt user@User {userId, userContactId} agentConnId = do SELECT -- GroupInfo g.group_id, g.local_display_name, gp.display_name, gp.full_name, gp.short_descr, g.local_alias, gp.description, gp.image, gp.group_type, gp.group_link, gp.public_group_id, - gp.group_web_page, gp.group_domain, gp.domain_web_page, gp.allow_embedding, gp.group_domain_proof, + gp.group_web_page, gp.simplex_name, gp.domain_web_page, gp.allow_embedding, gp.simplex_name_proof, g.enable_ntfs, g.send_rcpts, g.favorite, gp.preferences, gp.member_admission, g.created_at, g.updated_at, g.chat_ts, g.user_member_profile_sent_at, g.conn_full_link_to_connect, g.conn_short_link_to_connect, g.conn_link_prepared_connection, g.conn_link_started_connection, g.welcome_shared_msg_id, g.request_shared_msg_id, @@ -153,19 +153,19 @@ getConnectionEntity db cxt user@User {userId, userContactId} agentConnId = do g.use_relays, g.relay_own_status, g.ui_themes, g.summary_current_members_count, g.public_member_count, g.roster_version, g.custom_data, g.chat_item_ttl, g.members_require_attention, g.via_group_link_uri, g.root_priv_key, g.root_pub_key, g.member_priv_key, - g.group_domain_verification, + g.simplex_name_verification, -- GroupInfo {membership} mu.group_member_id, mu.group_id, mu.index_in_group, mu.member_id, mu.peer_chat_min_version, mu.peer_chat_max_version, mu.member_role, mu.member_category, mu.member_status, mu.show_messages, mu.member_restriction, mu.invited_by, mu.invited_by_group_member_id, mu.local_display_name, mu.contact_id, mu.contact_profile_id, pu.contact_profile_id, -- GroupInfo {membership = GroupMember {memberProfile}} pu.display_name, pu.full_name, pu.short_descr, pu.image, pu.contact_link, pu.chat_peer_type, pu.local_alias, pu.preferences, - pu.badge_proof, pu.badge_pres_header, pu.badge_expiry, pu.badge_type, pu.badge_verified, pu.badge_extra, pu.badge_master_key, pu.badge_signature, pu.badge_key_idx, pu.contact_domain, pu.contact_domain_verification, pu.contact_domain_proof, + pu.badge_proof, pu.badge_pres_header, pu.badge_expiry, pu.badge_type, pu.badge_verified, pu.badge_extra, pu.badge_master_key, pu.badge_signature, pu.badge_key_idx, pu.simplex_name, pu.simplex_name_verification, pu.simplex_name_proof, mu.created_at, mu.updated_at, mu.support_chat_ts, mu.support_chat_items_unread, mu.support_chat_items_member_attention, mu.support_chat_items_mentions, mu.support_chat_last_msg_from_member_ts, mu.member_pub_key, mu.relay_link, -- from GroupMember m.group_member_id, m.group_id, m.index_in_group, m.member_id, m.peer_chat_min_version, m.peer_chat_max_version, m.member_role, m.member_category, m.member_status, m.show_messages, m.member_restriction, m.invited_by, m.invited_by_group_member_id, m.local_display_name, m.contact_id, m.contact_profile_id, p.contact_profile_id, p.display_name, p.full_name, p.short_descr, p.image, p.contact_link, p.chat_peer_type, p.local_alias, p.preferences, - p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.contact_domain, p.contact_domain_verification, p.contact_domain_proof, + p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.simplex_name, p.simplex_name_verification, p.simplex_name_proof, m.created_at, m.updated_at, m.support_chat_ts, m.support_chat_items_unread, m.support_chat_items_member_attention, m.support_chat_items_mentions, m.support_chat_last_msg_from_member_ts, m.member_pub_key, m.relay_link FROM group_members m diff --git a/src/Simplex/Chat/Store/ContactRequest.hs b/src/Simplex/Chat/Store/ContactRequest.hs index fbaa075e87..b5b663c4ee 100644 --- a/src/Simplex/Chat/Store/ContactRequest.hs +++ b/src/Simplex/Chat/Store/ContactRequest.hs @@ -116,7 +116,7 @@ createOrUpdateContactRequest cp.preferences, ct.user_preferences, ct.created_at, ct.updated_at, ct.chat_ts, ct.conn_full_link_to_connect, ct.conn_short_link_to_connect, ct.welcome_shared_msg_id, ct.request_shared_msg_id, ct.contact_request_id, ct.contact_group_member_id, ct.contact_grp_inv_sent, ct.grp_direct_inv_link, ct.grp_direct_inv_from_group_id, ct.grp_direct_inv_from_group_member_id, ct.grp_direct_inv_from_member_conn_id, ct.grp_direct_inv_started_connection, ct.ui_themes, ct.chat_deleted, ct.custom_data, ct.chat_item_ttl, - cp.badge_proof, cp.badge_pres_header, cp.badge_expiry, cp.badge_type, cp.badge_verified, cp.badge_extra, cp.badge_master_key, cp.badge_signature, cp.badge_key_idx, cp.contact_domain, cp.contact_domain_verification, cp.contact_domain_proof, + cp.badge_proof, cp.badge_pres_header, cp.badge_expiry, cp.badge_type, cp.badge_verified, cp.badge_extra, cp.badge_master_key, cp.badge_signature, cp.badge_key_idx, cp.simplex_name, cp.simplex_name_verification, cp.simplex_name_proof, -- Connection c.connection_id, c.agent_conn_id, c.conn_level, c.via_contact, c.via_user_contact_link, c.via_group_link, c.group_link_id, c.xcontact_id, c.custom_user_profile_id, c.conn_status, c.conn_type, c.contact_conn_initiated, c.local_alias, c.contact_id, c.group_member_id, c.user_contact_link_id, c.created_at, c.security_code, c.security_code_verified_at, c.pq_support, c.pq_encryption, c.pq_snd_enabled, c.pq_rcv_enabled, c.auth_err_counter, c.quota_err_counter, @@ -152,7 +152,7 @@ createOrUpdateContactRequest cr.pq_support, cr.welcome_shared_msg_id, cr.request_shared_msg_id, p.preferences, cr.created_at, cr.updated_at, cr.peer_chat_min_version, cr.peer_chat_max_version, - p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.contact_domain, p.contact_domain_verification, p.contact_domain_proof + p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.simplex_name, p.simplex_name_verification, p.simplex_name_proof FROM contact_requests cr JOIN contact_profiles p USING (contact_profile_id) WHERE cr.user_id = ? diff --git a/src/Simplex/Chat/Store/Direct.hs b/src/Simplex/Chat/Store/Direct.hs index 7b93599641..2f98fb2ee3 100644 --- a/src/Simplex/Chat/Store/Direct.hs +++ b/src/Simplex/Chat/Store/Direct.hs @@ -325,7 +325,7 @@ getContactByConnReqHash db cxt user@User {userId} cReqHash1 cReqHash2 = do ct.contact_group_member_id, ct.contact_grp_inv_sent, ct.grp_direct_inv_link, ct.grp_direct_inv_from_group_id, ct.grp_direct_inv_from_group_member_id, ct.grp_direct_inv_from_member_conn_id, ct.grp_direct_inv_started_connection, ct.ui_themes, ct.chat_deleted, ct.custom_data, ct.chat_item_ttl, cp.badge_proof, cp.badge_pres_header, cp.badge_expiry, cp.badge_type, cp.badge_verified, cp.badge_extra, cp.badge_master_key, cp.badge_signature, cp.badge_key_idx, - cp.contact_domain, cp.contact_domain_verification, cp.contact_domain_proof, + cp.simplex_name, cp.simplex_name_verification, cp.simplex_name_proof, -- Connection c.connection_id, c.agent_conn_id, c.conn_level, c.via_contact, c.via_user_contact_link, c.via_group_link, c.group_link_id, c.xcontact_id, c.custom_user_profile_id, c.conn_status, c.conn_type, c.contact_conn_initiated, c.local_alias, c.contact_id, c.group_member_id, c.user_contact_link_id, c.created_at, c.security_code, c.security_code_verified_at, c.pq_support, c.pq_encryption, c.pq_snd_enabled, c.pq_rcv_enabled, c.auth_err_counter, c.quota_err_counter, @@ -576,7 +576,7 @@ updateContactProfile db cxt user@User {userId} c p' = do p'' = (p' :: Profile) {simplexName = setClaimProof (if claimChanged then Nothing else claimProof =<< prevClaim) <$> simplexName} clearVerificationIfClaimChanged = when claimChanged $ - DB.execute db "UPDATE contact_profiles SET contact_domain_verification = NULL WHERE user_id = ? AND contact_profile_id = ?" (userId, profileId) + DB.execute db "UPDATE contact_profiles SET simplex_name_verification = NULL WHERE user_id = ? AND contact_profile_id = ?" (userId, profileId) updateContactProfile' currentTs badgeVerified profile | displayName == newName = do liftIO $ updateContactProfile_' db userId profileId p'' badgeVerified currentTs @@ -594,7 +594,7 @@ setContactDomainVerified db User {userId} contactId verified = DB.execute db [sql| - UPDATE contact_profiles SET contact_domain_verification = ? + UPDATE contact_profiles SET simplex_name_verification = ? WHERE contact_profile_id IN (SELECT contact_profile_id FROM contacts WHERE user_id = ? AND contact_id = ?) |] (BI verified, userId, contactId) @@ -737,8 +737,8 @@ updateContactProfile_' db userId profileId Profile {displayName, fullName, short UPDATE contact_profiles SET display_name = ?, full_name = ?, short_descr = ?, image = ?, contact_link = ?, preferences = ?, chat_peer_type = ?, updated_at = ?, badge_proof = ?, badge_pres_header = ?, badge_expiry = ?, badge_type = ?, badge_verified = ?, badge_extra = ?, badge_master_key = ?, badge_signature = ?, badge_key_idx = ?, - contact_domain = ?, - contact_domain_proof = ? + simplex_name = ?, + simplex_name_proof = ? WHERE user_id = ? AND contact_profile_id = ? |] ((displayName, fullName, shortDescr, image, contactLink, preferences, peerType, updatedAt) :. badgeToRow badge badgeVerified :. (claimName <$> simplexName, claimProof =<< simplexName) :. (userId, profileId)) @@ -757,8 +757,8 @@ updateMemberContactProfileReset_' db userId profileId Profile {displayName, full UPDATE contact_profiles SET display_name = ?, full_name = ?, short_descr = ?, image = ?, contact_link = NULL, preferences = NULL, updated_at = ?, badge_proof = ?, badge_pres_header = ?, badge_expiry = ?, badge_type = ?, badge_verified = ?, badge_extra = ?, badge_master_key = ?, badge_signature = ?, badge_key_idx = ?, - contact_domain = ?, - contact_domain_proof = ? + simplex_name = ?, + simplex_name_proof = ? WHERE user_id = ? AND contact_profile_id = ? |] ((displayName, fullName, shortDescr, image, updatedAt) :. badgeToRow badge badgeVerified :. (claimName <$> simplexName, claimProof =<< simplexName) :. (userId, profileId)) @@ -777,8 +777,8 @@ updateMemberContactProfile_' db userId profileId Profile {displayName, fullName, UPDATE contact_profiles SET display_name = ?, full_name = ?, short_descr = ?, image = ?, updated_at = ?, badge_proof = ?, badge_pres_header = ?, badge_expiry = ?, badge_type = ?, badge_verified = ?, badge_extra = ?, badge_master_key = ?, badge_signature = ?, badge_key_idx = ?, - contact_domain = ?, - contact_domain_proof = ? + simplex_name = ?, + simplex_name_proof = ? WHERE user_id = ? AND contact_profile_id = ? |] ((displayName, fullName, shortDescr, image, updatedAt) :. badgeToRow badge badgeVerified :. (claimName <$> simplexName, claimProof =<< simplexName) :. (userId, profileId)) @@ -813,7 +813,7 @@ getContactToConnect db cxt user@User {userId} = \case [sql| SELECT ct.contact_id, ct.conn_full_link_to_connect, ct.conn_short_link_to_connect FROM contacts ct JOIN contact_profiles cp ON cp.contact_profile_id = ct.contact_profile_id - WHERE ct.user_id = ? AND cp.contact_domain = ? AND cp.contact_domain_verification = 1 AND ct.deleted = 0 + WHERE ct.user_id = ? AND cp.simplex_name = ? AND cp.simplex_name_verification = 1 AND ct.deleted = 0 |] getUserContacts :: DB.Connection -> StoreCxt -> User -> IO [Contact] @@ -856,7 +856,7 @@ contactRequestQuery = cr.created_at, cr.updated_at, cr.peer_chat_min_version, cr.peer_chat_max_version, p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, - p.contact_domain, p.contact_domain_verification, p.contact_domain_proof + p.simplex_name, p.simplex_name_verification, p.simplex_name_proof FROM contact_requests cr JOIN contact_profiles p USING (contact_profile_id) |] @@ -977,7 +977,7 @@ getContact_ db cxt user@User {userId} contactId deleted = do ct.contact_group_member_id, ct.contact_grp_inv_sent, ct.grp_direct_inv_link, ct.grp_direct_inv_from_group_id, ct.grp_direct_inv_from_group_member_id, ct.grp_direct_inv_from_member_conn_id, ct.grp_direct_inv_started_connection, ct.ui_themes, ct.chat_deleted, ct.custom_data, ct.chat_item_ttl, cp.badge_proof, cp.badge_pres_header, cp.badge_expiry, cp.badge_type, cp.badge_verified, cp.badge_extra, cp.badge_master_key, cp.badge_signature, cp.badge_key_idx, - cp.contact_domain, cp.contact_domain_verification, cp.contact_domain_proof, + cp.simplex_name, cp.simplex_name_verification, cp.simplex_name_proof, -- Connection c.connection_id, c.agent_conn_id, c.conn_level, c.via_contact, c.via_user_contact_link, c.via_group_link, c.group_link_id, c.xcontact_id, c.custom_user_profile_id, c.conn_status, c.conn_type, c.contact_conn_initiated, c.local_alias, c.contact_id, c.group_member_id, c.user_contact_link_id, c.created_at, c.security_code, c.security_code_verified_at, c.pq_support, c.pq_encryption, c.pq_snd_enabled, c.pq_rcv_enabled, c.auth_err_counter, c.quota_err_counter, diff --git a/src/Simplex/Chat/Store/Groups.hs b/src/Simplex/Chat/Store/Groups.hs index 893e7749f6..54416e9637 100644 --- a/src/Simplex/Chat/Store/Groups.hs +++ b/src/Simplex/Chat/Store/Groups.hs @@ -399,7 +399,7 @@ createNewGroup db cxt user@User {userId} groupProfile incognitoProfile useRelays INSERT INTO group_profiles (display_name, full_name, short_descr, description, image, group_type, group_link, public_group_id, - group_web_page, group_domain, domain_web_page, allow_embedding, group_domain_proof, + group_web_page, simplex_name, domain_web_page, allow_embedding, simplex_name_proof, user_id, preferences, member_admission, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |] @@ -906,7 +906,7 @@ createGroup_ db userId groupProfile prepared business useRelays relayOwnStatus p INSERT INTO group_profiles (display_name, full_name, short_descr, description, image, group_type, group_link, public_group_id, - group_web_page, group_domain, domain_web_page, allow_embedding, group_domain_proof, + group_web_page, simplex_name, domain_web_page, allow_embedding, simplex_name_proof, user_id, preferences, member_admission, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |] @@ -1087,7 +1087,7 @@ getGroupToConnect db cxt user@User {userId} = \case [sql| SELECT g.group_id, g.conn_full_link_to_connect, g.conn_short_link_to_connect FROM groups g JOIN group_profiles gp ON gp.group_profile_id = g.group_profile_id - WHERE g.user_id = ? AND gp.group_domain = ? AND g.group_domain_verification = 1 + WHERE g.user_id = ? AND gp.simplex_name = ? AND g.simplex_name_verification = 1 |] getGroupMember :: DB.Connection -> StoreCxt -> User -> GroupId -> GroupMemberId -> ExceptT StoreError IO GroupMember @@ -1951,7 +1951,7 @@ getRelayPublishableGroups db User {userId, userContactId} = db [sql| SELECT g.group_id, gp.public_group_id, - gp.group_web_page, gp.group_domain, gp.domain_web_page, gp.allow_embedding, gp.group_domain_proof + gp.group_web_page, gp.simplex_name, gp.domain_web_page, gp.allow_embedding, gp.simplex_name_proof FROM groups g JOIN group_profiles gp ON gp.group_profile_id = g.group_profile_id JOIN group_members mu ON mu.group_id = g.group_id AND mu.contact_id = ? @@ -2661,7 +2661,7 @@ updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName, g' = if claimChanged then (g :: GroupInfo) {groupDomainVerification = Nothing} else g clearVerificationIfClaimChanged = when claimChanged $ - DB.execute db "UPDATE groups SET group_domain_verification = NULL WHERE user_id = ? AND group_id = ?" (userId, groupId) + DB.execute db "UPDATE groups SET simplex_name_verification = NULL WHERE user_id = ? AND group_id = ?" (userId, groupId) (groupType_, groupLink_) = case publicGroup of Just PublicGroupProfile {groupType, groupLink} -> (Just groupType, Just groupLink) Nothing -> (Nothing, Nothing) @@ -2672,7 +2672,7 @@ updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName, UPDATE group_profiles SET display_name = ?, full_name = ?, short_descr = ?, description = ?, image = ?, group_type = ?, group_link = ?, - group_web_page = ?, group_domain = ?, domain_web_page = ?, allow_embedding = ?, group_domain_proof = ?, + group_web_page = ?, simplex_name = ?, domain_web_page = ?, allow_embedding = ?, simplex_name_proof = ?, preferences = ?, member_admission = ?, updated_at = ? WHERE group_profile_id IN ( SELECT group_profile_id @@ -2692,7 +2692,7 @@ setGroupDomainVerified :: DB.Connection -> User -> GroupId -> Bool -> IO () setGroupDomainVerified db User {userId} groupId verified = DB.execute db - "UPDATE groups SET group_domain_verification = ? WHERE user_id = ? AND group_id = ?" + "UPDATE groups SET simplex_name_verification = ? WHERE user_id = ? AND group_id = ?" (BI verified, userId, groupId) updateGroupPreferences :: DB.Connection -> User -> GroupInfo -> GroupPreferences -> IO GroupInfo @@ -2727,7 +2727,7 @@ updateGroupProfileFromMember db user g@GroupInfo {groupId} Profile {displayName [sql| SELECT gp.display_name, gp.full_name, gp.short_descr, gp.description, gp.image, gp.group_type, gp.group_link, gp.public_group_id, - gp.group_web_page, gp.group_domain, gp.domain_web_page, gp.allow_embedding, gp.group_domain_proof, + gp.group_web_page, gp.simplex_name, gp.domain_web_page, gp.allow_embedding, gp.simplex_name_proof, gp.preferences, gp.member_admission FROM group_profiles gp JOIN groups g ON gp.group_profile_id = g.group_profile_id @@ -2777,7 +2777,7 @@ getGroupInfoViaUserTarget db cxt user@User {userId} target = fmap eitherToMaybe FROM user_contact_links ucl JOIN groups g ON g.group_id = ucl.group_id JOIN group_profiles gp ON gp.group_profile_id = g.group_profile_id - WHERE ucl.user_id = ? AND gp.group_domain = ? + WHERE ucl.user_id = ? AND gp.simplex_name = ? |] (userId, ni) toConnReqGroupId = \case @@ -3331,7 +3331,7 @@ setMemberContactStartedConnection db Contact {contactId} = do "UPDATE contacts SET grp_direct_inv_started_connection = ?, updated_at = ? WHERE contact_id = ?" (BI True, currentTs, contactId) --- | Updates the member profile (the profile writer persists contact_domain). +-- | Updates the member profile (the profile writer persists simplex_name). updateMemberProfile :: DB.Connection -> StoreCxt -> User -> GroupMember -> Profile -> ExceptT StoreError IO GroupMember updateMemberProfile db cxt user@User {userId} m p' = do currentTs <- liftIO getCurrentTime @@ -3355,7 +3355,7 @@ updateMemberProfile db cxt user@User {userId} m p' = do safeDeleteLDN db user localDisplayName pure $ Right m {localDisplayName = ldn, memberProfile} --- | Updates the member's contact profile (the profile writer persists contact_domain). +-- | Updates the member's contact profile (the profile writer persists simplex_name). updateContactMemberProfile :: DB.Connection -> StoreCxt -> User -> GroupMember -> Contact -> Profile -> ExceptT StoreError IO (GroupMember, Contact) updateContactMemberProfile db cxt user@User {userId} m ct@Contact {contactId} p' = do currentTs <- liftIO getCurrentTime diff --git a/src/Simplex/Chat/Store/Messages.hs b/src/Simplex/Chat/Store/Messages.hs index b857b46d60..d750737add 100644 --- a/src/Simplex/Chat/Store/Messages.hs +++ b/src/Simplex/Chat/Store/Messages.hs @@ -715,7 +715,7 @@ getChatItemQuote_ db User {userId, userContactId} chatDirection QuotedMsg {msgRe m.group_member_id, m.group_id, m.index_in_group, m.member_id, m.peer_chat_min_version, m.peer_chat_max_version, m.member_role, m.member_category, m.member_status, m.show_messages, m.member_restriction, m.invited_by, m.invited_by_group_member_id, m.local_display_name, m.contact_id, m.contact_profile_id, p.contact_profile_id, p.display_name, p.full_name, p.short_descr, p.image, p.contact_link, p.chat_peer_type, p.local_alias, p.preferences, - p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.contact_domain, p.contact_domain_verification, p.contact_domain_proof, + p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.simplex_name, p.simplex_name_verification, p.simplex_name_proof, m.created_at, m.updated_at, m.support_chat_ts, m.support_chat_items_unread, m.support_chat_items_member_attention, m.support_chat_items_mentions, m.support_chat_last_msg_from_member_ts, m.member_pub_key, m.relay_link FROM group_members m @@ -1139,7 +1139,7 @@ getContactRequestChatPreviews_ db User {userId} pagination clq = do cr.pq_support, cr.welcome_shared_msg_id, cr.request_shared_msg_id, p.preferences, cr.created_at, cr.updated_at, cr.peer_chat_min_version, cr.peer_chat_max_version, - p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.contact_domain, p.contact_domain_verification, p.contact_domain_proof + p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.simplex_name, p.simplex_name_verification, p.simplex_name_proof FROM contact_requests cr JOIN contact_profiles p ON p.contact_profile_id = cr.contact_profile_id JOIN user_contact_links uc ON uc.user_contact_link_id = cr.user_contact_link_id @@ -3070,7 +3070,7 @@ getGroupChatItem db User {userId, userContactId} groupId itemId = ExceptT $ do m.group_member_id, m.group_id, m.index_in_group, m.member_id, m.peer_chat_min_version, m.peer_chat_max_version, m.member_role, m.member_category, m.member_status, m.show_messages, m.member_restriction, m.invited_by, m.invited_by_group_member_id, m.local_display_name, m.contact_id, m.contact_profile_id, p.contact_profile_id, p.display_name, p.full_name, p.short_descr, p.image, p.contact_link, p.chat_peer_type, p.local_alias, p.preferences, - p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.contact_domain, p.contact_domain_verification, p.contact_domain_proof, + p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.simplex_name, p.simplex_name_verification, p.simplex_name_proof, m.created_at, m.updated_at, m.support_chat_ts, m.support_chat_items_unread, m.support_chat_items_member_attention, m.support_chat_items_mentions, m.support_chat_last_msg_from_member_ts, m.member_pub_key, m.relay_link, -- quoted ChatItem @@ -3079,14 +3079,14 @@ getGroupChatItem db User {userId, userContactId} groupId itemId = ExceptT $ do rm.group_member_id, rm.group_id, rm.index_in_group, rm.member_id, rm.peer_chat_min_version, rm.peer_chat_max_version, rm.member_role, rm.member_category, rm.member_status, rm.show_messages, rm.member_restriction, rm.invited_by, rm.invited_by_group_member_id, rm.local_display_name, rm.contact_id, rm.contact_profile_id, rp.contact_profile_id, rp.display_name, rp.full_name, rp.short_descr, rp.image, rp.contact_link, rp.chat_peer_type, rp.local_alias, rp.preferences, - rp.badge_proof, rp.badge_pres_header, rp.badge_expiry, rp.badge_type, rp.badge_verified, rp.badge_extra, rp.badge_master_key, rp.badge_signature, rp.badge_key_idx, rp.contact_domain, rp.contact_domain_verification, rp.contact_domain_proof, + rp.badge_proof, rp.badge_pres_header, rp.badge_expiry, rp.badge_type, rp.badge_verified, rp.badge_extra, rp.badge_master_key, rp.badge_signature, rp.badge_key_idx, rp.simplex_name, rp.simplex_name_verification, rp.simplex_name_proof, rm.created_at, rm.updated_at, rm.support_chat_ts, rm.support_chat_items_unread, rm.support_chat_items_member_attention, rm.support_chat_items_mentions, rm.support_chat_last_msg_from_member_ts, rm.member_pub_key, rm.relay_link, -- deleted by GroupMember dbm.group_member_id, dbm.group_id, dbm.index_in_group, dbm.member_id, dbm.peer_chat_min_version, dbm.peer_chat_max_version, dbm.member_role, dbm.member_category, dbm.member_status, dbm.show_messages, dbm.member_restriction, dbm.invited_by, dbm.invited_by_group_member_id, dbm.local_display_name, dbm.contact_id, dbm.contact_profile_id, dbp.contact_profile_id, dbp.display_name, dbp.full_name, dbp.short_descr, dbp.image, dbp.contact_link, dbp.chat_peer_type, dbp.local_alias, dbp.preferences, - dbp.badge_proof, dbp.badge_pres_header, dbp.badge_expiry, dbp.badge_type, dbp.badge_verified, dbp.badge_extra, dbp.badge_master_key, dbp.badge_signature, dbp.badge_key_idx, dbp.contact_domain, dbp.contact_domain_verification, dbp.contact_domain_proof, + dbp.badge_proof, dbp.badge_pres_header, dbp.badge_expiry, dbp.badge_type, dbp.badge_verified, dbp.badge_extra, dbp.badge_master_key, dbp.badge_signature, dbp.badge_key_idx, dbp.simplex_name, dbp.simplex_name_verification, dbp.simplex_name_proof, dbm.created_at, dbm.updated_at, dbm.support_chat_ts, dbm.support_chat_items_unread, dbm.support_chat_items_member_attention, dbm.support_chat_items_mentions, dbm.support_chat_last_msg_from_member_ts, dbm.member_pub_key, dbm.relay_link FROM chat_items i diff --git a/src/Simplex/Chat/Store/Postgres/Migrations/M20260603_simplex_name.hs b/src/Simplex/Chat/Store/Postgres/Migrations/M20260603_simplex_name.hs index 9c1c788990..98f4cb274d 100644 --- a/src/Simplex/Chat/Store/Postgres/Migrations/M20260603_simplex_name.hs +++ b/src/Simplex/Chat/Store/Postgres/Migrations/M20260603_simplex_name.hs @@ -6,16 +6,17 @@ module Simplex.Chat.Store.Postgres.Migrations.M20260603_simplex_name where import Data.Text (Text) import Text.RawString.QQ (r) --- The entity name lives only on the profile: contact_profiles.contact_domain holds --- the peer's broadcast contact name, and the existing group_profiles.group_domain --- (from M20260515) holds the channel name. Both store the canonical strEncode form --- as TEXT. +-- The entity name is stored on the profile as the canonical strEncode form (TEXT): +-- contact_profiles.simplex_name for contacts and group_profiles.simplex_name for +-- channels (copied from group_profiles.group_domain, added in M20260515, which is +-- then dropped). -- --- contact_profiles.contact_domain_verification and groups.group_domain_verification +-- contact_profiles.simplex_name_verification and groups.simplex_name_verification -- are the local 3-state verification status (NULL = not attempted, 0 = failed, -- 1 = verified), reset to NULL when the claimed name changes. -- --- contact_profiles.contact_domain_proof holds the peer's name NameClaimProof (JSON). +-- contact_profiles.simplex_name_proof / group_profiles.simplex_name_proof hold the +-- peer's name NameClaimProof (JSON). -- user_contact_links.link_priv_sig_key is the contact-address owner signing key -- (captured at short-link creation) used to sign the user's own name proofs. -- @@ -24,11 +25,14 @@ import Text.RawString.QQ (r) m20260603_simplex_name :: Text m20260603_simplex_name = [r| -ALTER TABLE contact_profiles ADD COLUMN contact_domain TEXT; -ALTER TABLE contact_profiles ADD COLUMN contact_domain_verification SMALLINT; -ALTER TABLE contact_profiles ADD COLUMN contact_domain_proof TEXT; -ALTER TABLE groups ADD COLUMN group_domain_verification SMALLINT; -ALTER TABLE group_profiles ADD COLUMN group_domain_proof TEXT; +ALTER TABLE contact_profiles ADD COLUMN simplex_name TEXT; +ALTER TABLE contact_profiles ADD COLUMN simplex_name_verification SMALLINT; +ALTER TABLE contact_profiles ADD COLUMN simplex_name_proof TEXT; +ALTER TABLE groups ADD COLUMN simplex_name_verification SMALLINT; +ALTER TABLE group_profiles ADD COLUMN simplex_name TEXT; +UPDATE group_profiles SET simplex_name = group_domain; +ALTER TABLE group_profiles DROP COLUMN group_domain; +ALTER TABLE group_profiles ADD COLUMN simplex_name_proof TEXT; ALTER TABLE user_contact_links ADD COLUMN link_priv_sig_key BYTEA; ALTER TABLE server_operators ADD COLUMN smp_role_names SMALLINT NOT NULL DEFAULT 0; @@ -41,9 +45,12 @@ down_m20260603_simplex_name = ALTER TABLE server_operators DROP COLUMN smp_role_names; ALTER TABLE user_contact_links DROP COLUMN link_priv_sig_key; -ALTER TABLE group_profiles DROP COLUMN group_domain_proof; -ALTER TABLE groups DROP COLUMN group_domain_verification; -ALTER TABLE contact_profiles DROP COLUMN contact_domain_proof; -ALTER TABLE contact_profiles DROP COLUMN contact_domain_verification; -ALTER TABLE contact_profiles DROP COLUMN contact_domain; +ALTER TABLE group_profiles DROP COLUMN simplex_name_proof; +ALTER TABLE group_profiles ADD COLUMN group_domain TEXT; +UPDATE group_profiles SET group_domain = simplex_name; +ALTER TABLE group_profiles DROP COLUMN simplex_name; +ALTER TABLE groups DROP COLUMN simplex_name_verification; +ALTER TABLE contact_profiles DROP COLUMN simplex_name_proof; +ALTER TABLE contact_profiles DROP COLUMN simplex_name_verification; +ALTER TABLE contact_profiles DROP COLUMN simplex_name; |] diff --git a/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql b/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql index 7f82feca36..a1a695a7c6 100644 --- a/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql +++ b/src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql @@ -541,9 +541,9 @@ CREATE TABLE test_chat_schema.contact_profiles ( badge_master_key bytea, badge_signature bytea, badge_key_idx bigint, - contact_domain text, - contact_domain_verification smallint, - contact_domain_proof text + simplex_name text, + simplex_name_verification smallint, + simplex_name_proof text ); @@ -867,10 +867,10 @@ CREATE TABLE test_chat_schema.group_profiles ( group_link bytea, public_group_id bytea, group_web_page text, - group_domain text, domain_web_page bigint, allow_embedding bigint, - group_domain_proof text + simplex_name text, + simplex_name_proof text ); @@ -994,7 +994,7 @@ CREATE TABLE test_chat_schema.groups ( roster_sending_owner_gm_id bigint, roster_broker_ts timestamp with time zone, roster_blob bytea, - group_domain_verification smallint + simplex_name_verification smallint ); diff --git a/src/Simplex/Chat/Store/Profiles.hs b/src/Simplex/Chat/Store/Profiles.hs index 17cc1e902c..2e56fd7cc4 100644 --- a/src/Simplex/Chat/Store/Profiles.hs +++ b/src/Simplex/Chat/Store/Profiles.hs @@ -392,7 +392,7 @@ setUserSimplexName db user@User {userId, profile = p@LocalProfile {profileId}} n ts <- getCurrentTime DB.execute db - "UPDATE contact_profiles SET contact_domain = ?, updated_at = ? WHERE user_id = ? AND contact_profile_id = ?" + "UPDATE contact_profiles SET simplex_name = ?, updated_at = ? WHERE user_id = ? AND contact_profile_id = ?" (name_, ts, userId, profileId) pure (user :: User) {profile = p {simplexName = mkSimplexNameClaim name_ Nothing}} @@ -418,7 +418,7 @@ getUserContactProfiles db User {userId} = <$> DB.query db [sql| - SELECT display_name, full_name, short_descr, image, contact_link, chat_peer_type, contact_domain, preferences + SELECT display_name, full_name, short_descr, image, contact_link, chat_peer_type, simplex_name, preferences FROM contact_profiles WHERE user_id = ? |] diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/M20260603_simplex_name.hs b/src/Simplex/Chat/Store/SQLite/Migrations/M20260603_simplex_name.hs index e8d90982ca..2f24c7f1c6 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/M20260603_simplex_name.hs +++ b/src/Simplex/Chat/Store/SQLite/Migrations/M20260603_simplex_name.hs @@ -5,16 +5,17 @@ module Simplex.Chat.Store.SQLite.Migrations.M20260603_simplex_name where import Database.SQLite.Simple (Query) import Database.SQLite.Simple.QQ (sql) --- The entity name lives only on the profile: contact_profiles.contact_domain holds --- the peer's broadcast contact name, and the existing group_profiles.group_domain --- (from M20260515) holds the channel name. Both store the canonical strEncode form --- as TEXT. +-- The entity name is stored on the profile as the canonical strEncode form (TEXT): +-- contact_profiles.simplex_name for contacts and group_profiles.simplex_name for +-- channels (copied from group_profiles.group_domain, added in M20260515, which is +-- then dropped). -- --- contact_profiles.contact_domain_verification and groups.group_domain_verification +-- contact_profiles.simplex_name_verification and groups.simplex_name_verification -- are the local 3-state verification status (NULL = not attempted, 0 = failed, -- 1 = verified), reset to NULL when the claimed name changes. -- --- contact_profiles.contact_domain_proof holds the peer's name NameClaimProof (JSON). +-- contact_profiles.simplex_name_proof / group_profiles.simplex_name_proof hold the +-- peer's name NameClaimProof (JSON). -- user_contact_links.link_priv_sig_key is the contact-address owner signing key -- (captured at short-link creation) used to sign the user's own name proofs. -- @@ -23,11 +24,14 @@ import Database.SQLite.Simple.QQ (sql) m20260603_simplex_name :: Query m20260603_simplex_name = [sql| -ALTER TABLE contact_profiles ADD COLUMN contact_domain TEXT; -ALTER TABLE contact_profiles ADD COLUMN contact_domain_verification INTEGER; -ALTER TABLE contact_profiles ADD COLUMN contact_domain_proof TEXT; -ALTER TABLE groups ADD COLUMN group_domain_verification INTEGER; -ALTER TABLE group_profiles ADD COLUMN group_domain_proof TEXT; +ALTER TABLE contact_profiles ADD COLUMN simplex_name TEXT; +ALTER TABLE contact_profiles ADD COLUMN simplex_name_verification INTEGER; +ALTER TABLE contact_profiles ADD COLUMN simplex_name_proof TEXT; +ALTER TABLE groups ADD COLUMN simplex_name_verification INTEGER; +ALTER TABLE group_profiles ADD COLUMN simplex_name TEXT; +UPDATE group_profiles SET simplex_name = group_domain; +ALTER TABLE group_profiles DROP COLUMN group_domain; +ALTER TABLE group_profiles ADD COLUMN simplex_name_proof TEXT; ALTER TABLE user_contact_links ADD COLUMN link_priv_sig_key BLOB; ALTER TABLE server_operators ADD COLUMN smp_role_names INTEGER NOT NULL DEFAULT 0; @@ -40,9 +44,12 @@ down_m20260603_simplex_name = ALTER TABLE server_operators DROP COLUMN smp_role_names; ALTER TABLE user_contact_links DROP COLUMN link_priv_sig_key; -ALTER TABLE group_profiles DROP COLUMN group_domain_proof; -ALTER TABLE groups DROP COLUMN group_domain_verification; -ALTER TABLE contact_profiles DROP COLUMN contact_domain_proof; -ALTER TABLE contact_profiles DROP COLUMN contact_domain_verification; -ALTER TABLE contact_profiles DROP COLUMN contact_domain; +ALTER TABLE group_profiles DROP COLUMN simplex_name_proof; +ALTER TABLE group_profiles ADD COLUMN group_domain TEXT; +UPDATE group_profiles SET group_domain = simplex_name; +ALTER TABLE group_profiles DROP COLUMN simplex_name; +ALTER TABLE groups DROP COLUMN simplex_name_verification; +ALTER TABLE contact_profiles DROP COLUMN simplex_name_proof; +ALTER TABLE contact_profiles DROP COLUMN simplex_name_verification; +ALTER TABLE contact_profiles DROP COLUMN simplex_name; |] diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql b/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql index e87fd1df36..0c039a30c2 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql +++ b/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql @@ -29,9 +29,9 @@ CREATE TABLE contact_profiles( badge_master_key BLOB, badge_signature BLOB, badge_key_idx INTEGER, - contact_domain TEXT, - contact_domain_verification INTEGER, - contact_domain_proof TEXT + simplex_name TEXT, + simplex_name_verification INTEGER, + simplex_name_proof TEXT ) STRICT; CREATE TABLE users( user_id INTEGER PRIMARY KEY, @@ -140,10 +140,10 @@ CREATE TABLE group_profiles( group_link BLOB, public_group_id BLOB, group_web_page TEXT, - group_domain TEXT, domain_web_page INTEGER, allow_embedding INTEGER, - group_domain_proof TEXT + simplex_name TEXT, + simplex_name_proof TEXT ) STRICT; CREATE TABLE groups( group_id INTEGER PRIMARY KEY, -- local group ID @@ -204,7 +204,7 @@ CREATE TABLE groups( roster_sending_owner_gm_id INTEGER, roster_broker_ts TEXT, roster_blob BLOB, - group_domain_verification INTEGER, -- received + simplex_name_verification INTEGER, -- received FOREIGN KEY(user_id, local_display_name) REFERENCES display_names(user_id, local_display_name) ON DELETE CASCADE diff --git a/src/Simplex/Chat/Store/Shared.hs b/src/Simplex/Chat/Store/Shared.hs index 84083275d5..d95237f239 100644 --- a/src/Simplex/Chat/Store/Shared.hs +++ b/src/Simplex/Chat/Store/Shared.hs @@ -422,7 +422,7 @@ createContact_ db cxt User {userId} Profile {displayName, fullName, shortDescr, badgeVerified <- verifyBadge_ (badgeKeys cxt) badge DB.execute db - "INSERT INTO contact_profiles (display_name, full_name, short_descr, image, contact_link, chat_peer_type, user_id, local_alias, preferences, created_at, updated_at, badge_proof, badge_pres_header, badge_expiry, badge_type, badge_verified, badge_extra, badge_master_key, badge_signature, badge_key_idx, contact_domain, contact_domain_proof) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" + "INSERT INTO contact_profiles (display_name, full_name, short_descr, image, contact_link, chat_peer_type, user_id, local_alias, preferences, created_at, updated_at, badge_proof, badge_pres_header, badge_expiry, badge_type, badge_verified, badge_extra, badge_master_key, badge_signature, badge_key_idx, simplex_name, simplex_name_proof) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ((displayName, fullName, shortDescr, image, contactLink, peerType) :. (userId, localAlias, preferences, currentTs, currentTs) :. badgeToRow badge badgeVerified :. (claimName <$> simplexName, claimProof =<< simplexName)) profileId <- insertedRowId db DB.execute @@ -529,7 +529,7 @@ getProfileById db userId profileId = do db [sql| SELECT cp.contact_profile_id, cp.display_name, cp.full_name, cp.short_descr, cp.image, cp.contact_link, cp.chat_peer_type, cp.local_alias, cp.preferences, -- , ct.user_preferences - cp.badge_proof, cp.badge_pres_header, cp.badge_expiry, cp.badge_type, cp.badge_verified, cp.badge_extra, cp.badge_master_key, cp.badge_signature, cp.badge_key_idx, cp.contact_domain, cp.contact_domain_verification, cp.contact_domain_proof + cp.badge_proof, cp.badge_pres_header, cp.badge_expiry, cp.badge_type, cp.badge_verified, cp.badge_extra, cp.badge_master_key, cp.badge_signature, cp.badge_key_idx, cp.simplex_name, cp.simplex_name_verification, cp.simplex_name_proof FROM contact_profiles cp WHERE cp.user_id = ? AND cp.contact_profile_id = ? |] @@ -548,7 +548,7 @@ userQuery = [sql| SELECT u.user_id, u.agent_user_id, u.contact_id, ucp.contact_profile_id, u.active_user, u.active_order, u.local_display_name, ucp.full_name, ucp.short_descr, ucp.image, ucp.contact_link, ucp.chat_peer_type, ucp.preferences, u.show_ntfs, u.send_rcpts_contacts, u.send_rcpts_small_groups, u.auto_accept_member_contacts, u.view_pwd_hash, u.view_pwd_salt, u.user_member_profile_updated_at, u.is_user_chat_relay, u.client_service, u.ui_themes, - ucp.badge_proof, ucp.badge_pres_header, ucp.badge_expiry, ucp.badge_type, ucp.badge_verified, ucp.badge_extra, ucp.badge_master_key, ucp.badge_signature, ucp.badge_key_idx, ucp.contact_domain, ucp.contact_domain_verification, ucp.contact_domain_proof + ucp.badge_proof, ucp.badge_pres_header, ucp.badge_expiry, ucp.badge_type, ucp.badge_verified, ucp.badge_extra, ucp.badge_master_key, ucp.badge_signature, ucp.badge_key_idx, ucp.simplex_name, ucp.simplex_name_verification, ucp.simplex_name_proof FROM users u JOIN contacts uct ON uct.contact_id = u.contact_id JOIN contact_profiles ucp ON ucp.contact_profile_id = uct.contact_profile_id @@ -754,7 +754,7 @@ groupMemberQuery = SELECT m.group_member_id, m.group_id, m.index_in_group, m.member_id, m.peer_chat_min_version, m.peer_chat_max_version, m.member_role, m.member_category, m.member_status, m.show_messages, m.member_restriction, m.invited_by, m.invited_by_group_member_id, m.local_display_name, m.contact_id, m.contact_profile_id, p.contact_profile_id, p.display_name, p.full_name, p.short_descr, p.image, p.contact_link, p.chat_peer_type, p.local_alias, p.preferences, - p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.contact_domain, p.contact_domain_verification, p.contact_domain_proof, + p.badge_proof, p.badge_pres_header, p.badge_expiry, p.badge_type, p.badge_verified, p.badge_extra, p.badge_master_key, p.badge_signature, p.badge_key_idx, p.simplex_name, p.simplex_name_verification, p.simplex_name_proof, m.created_at, m.updated_at, m.support_chat_ts, m.support_chat_items_unread, m.support_chat_items_member_attention, m.support_chat_items_mentions, m.support_chat_last_msg_from_member_ts, m.member_pub_key, m.relay_link, c.connection_id, c.agent_conn_id, c.conn_level, c.via_contact, c.via_user_contact_link, c.via_group_link, c.group_link_id, c.xcontact_id, c.custom_user_profile_id, @@ -787,7 +787,7 @@ groupInfoQueryFields = SELECT -- GroupInfo g.group_id, g.local_display_name, gp.display_name, gp.full_name, gp.short_descr, g.local_alias, gp.description, gp.image, gp.group_type, gp.group_link, gp.public_group_id, - gp.group_web_page, gp.group_domain, gp.domain_web_page, gp.allow_embedding, gp.group_domain_proof, + gp.group_web_page, gp.simplex_name, gp.domain_web_page, gp.allow_embedding, gp.simplex_name_proof, g.enable_ntfs, g.send_rcpts, g.favorite, gp.preferences, gp.member_admission, g.created_at, g.updated_at, g.chat_ts, g.user_member_profile_sent_at, g.conn_full_link_to_connect, g.conn_short_link_to_connect, g.conn_link_prepared_connection, g.conn_link_started_connection, g.welcome_shared_msg_id, g.request_shared_msg_id, @@ -795,12 +795,12 @@ groupInfoQueryFields = g.use_relays, g.relay_own_status, g.ui_themes, g.summary_current_members_count, g.public_member_count, g.roster_version, g.custom_data, g.chat_item_ttl, g.members_require_attention, g.via_group_link_uri, g.root_priv_key, g.root_pub_key, g.member_priv_key, - g.group_domain_verification, + g.simplex_name_verification, -- GroupMember - membership mu.group_member_id, mu.group_id, mu.index_in_group, mu.member_id, mu.peer_chat_min_version, mu.peer_chat_max_version, mu.member_role, mu.member_category, mu.member_status, mu.show_messages, mu.member_restriction, mu.invited_by, mu.invited_by_group_member_id, mu.local_display_name, mu.contact_id, mu.contact_profile_id, pu.contact_profile_id, pu.display_name, pu.full_name, pu.short_descr, pu.image, pu.contact_link, pu.chat_peer_type, pu.local_alias, pu.preferences, - pu.badge_proof, pu.badge_pres_header, pu.badge_expiry, pu.badge_type, pu.badge_verified, pu.badge_extra, pu.badge_master_key, pu.badge_signature, pu.badge_key_idx, pu.contact_domain, pu.contact_domain_verification, pu.contact_domain_proof, + pu.badge_proof, pu.badge_pres_header, pu.badge_expiry, pu.badge_type, pu.badge_verified, pu.badge_extra, pu.badge_master_key, pu.badge_signature, pu.badge_key_idx, pu.simplex_name, pu.simplex_name_verification, pu.simplex_name_proof, mu.created_at, mu.updated_at, mu.support_chat_ts, mu.support_chat_items_unread, mu.support_chat_items_member_attention, mu.support_chat_items_mentions, mu.support_chat_last_msg_from_member_ts, mu.member_pub_key, mu.relay_link |] diff --git a/tests/Bots/BroadcastTests.hs b/tests/Bots/BroadcastTests.hs index 85525e6ffd..be58e1ad6c 100644 --- a/tests/Bots/BroadcastTests.hs +++ b/tests/Bots/BroadcastTests.hs @@ -33,7 +33,7 @@ withBroadcastBot opts test = bot = simplexChatCore testCfg (mkChatOpts opts) $ broadcastBot opts broadcastBotProfile :: Profile -broadcastBotProfile = Profile {displayName = "broadcast_bot", fullName = "Broadcast Bot", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Just CPTBot, preferences = Nothing, badge = Nothing, contactDomain = Nothing, contactDomainProof = Nothing} +broadcastBotProfile = Profile {displayName = "broadcast_bot", fullName = "Broadcast Bot", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Just CPTBot, preferences = Nothing, badge = Nothing, simplexName = Nothing} mkBotOpts :: TestParams -> [KnownContact] -> BroadcastBotOpts mkBotOpts ps publishers = diff --git a/tests/Bots/DirectoryTests.hs b/tests/Bots/DirectoryTests.hs index 1eea2cf75c..a277d077ea 100644 --- a/tests/Bots/DirectoryTests.hs +++ b/tests/Bots/DirectoryTests.hs @@ -98,7 +98,7 @@ directoryServiceTests = do it "should update subscriber count periodically" testLinkCheckUpdatesCount directoryProfile :: Profile -directoryProfile = Profile {displayName = "SimpleX Directory", fullName = "", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Just CPTBot, preferences = Nothing, badge = Nothing, contactDomain = Nothing, contactDomainProof = Nothing} +directoryProfile = Profile {displayName = "SimpleX Directory", fullName = "", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Just CPTBot, preferences = Nothing, badge = Nothing, simplexName = Nothing} mkDirectoryOpts :: TestParams -> [KnownContact] -> Maybe KnownGroup -> Maybe FilePath -> DirectoryOpts mkDirectoryOpts TestParams {tmpPath = ps} superUsers ownersGroup webFolder = diff --git a/tests/ChatTests/Profiles.hs b/tests/ChatTests/Profiles.hs index 1f6f589bc9..abf15da83a 100644 --- a/tests/ChatTests/Profiles.hs +++ b/tests/ChatTests/Profiles.hs @@ -497,7 +497,7 @@ testMultiWordProfileNames = aliceProfile' = baseProfile {displayName = "Alice Jones"} bobProfile' = baseProfile {displayName = "Bob James"} cathProfile' = baseProfile {displayName = "Cath Johnson"} - baseProfile = Profile {displayName = "", fullName = "", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Nothing, preferences = defaultPrefs, badge = Nothing, contactDomain = Nothing, contactDomainProof = Nothing} + baseProfile = Profile {displayName = "", fullName = "", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Nothing, preferences = defaultPrefs, badge = Nothing, simplexName = Nothing} testUserContactLink :: HasCallStack => TestParams -> IO () testUserContactLink = diff --git a/tests/ChatTests/Utils.hs b/tests/ChatTests/Utils.hs index 633ab502ed..cd24995db6 100644 --- a/tests/ChatTests/Utils.hs +++ b/tests/ChatTests/Utils.hs @@ -88,7 +88,7 @@ serviceProfile :: Profile serviceProfile = mkProfile "service_user" "Service user" Nothing mkProfile :: T.Text -> T.Text -> Maybe ImageData -> Profile -mkProfile displayName descr image = Profile {displayName, fullName = "", shortDescr = Just descr, image, contactLink = Nothing, peerType = Nothing, preferences = defaultPrefs, badge = Nothing, contactDomain = Nothing, contactDomainProof = Nothing} +mkProfile displayName descr image = Profile {displayName, fullName = "", shortDescr = Just descr, image, contactLink = Nothing, peerType = Nothing, preferences = defaultPrefs, badge = Nothing, simplexName = Nothing} it :: HasCallStack => String -> (ps -> Expectation) -> SpecWith (Arg (ps -> Expectation)) it name test = diff --git a/tests/ProtocolTests.hs b/tests/ProtocolTests.hs index 6537d1757a..2b1e1eb64e 100644 --- a/tests/ProtocolTests.hs +++ b/tests/ProtocolTests.hs @@ -108,7 +108,7 @@ testGroupPreferences :: Maybe GroupPreferences testGroupPreferences = Just GroupPreferences {timedMessages = Nothing, directMessages = Nothing, reactions = Just ReactionsGroupPreference {enable = FEOn}, voice = Just VoiceGroupPreference {enable = FEOn, role = Nothing}, files = Nothing, fullDelete = Nothing, simplexLinks = Nothing, history = Nothing, reports = Nothing, support = Nothing, sessions = Nothing, comments = Nothing, commands = Nothing} testProfile :: Profile -testProfile = Profile {displayName = "alice", fullName = "Alice", shortDescr = Nothing, image = Just (ImageData "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII="), peerType = Nothing, contactLink = Nothing, preferences = testChatPreferences, badge = Nothing, contactDomain = Nothing, contactDomainProof = Nothing} +testProfile = Profile {displayName = "alice", fullName = "Alice", shortDescr = Nothing, image = Just (ImageData "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII="), peerType = Nothing, contactLink = Nothing, preferences = testChatPreferences, badge = Nothing, simplexName = Nothing} testGroupProfile :: GroupProfile testGroupProfile = GroupProfile {displayName = "team", fullName = "Team", description = Nothing, shortDescr = Nothing, image = Nothing, publicGroup = Nothing, groupPreferences = testGroupPreferences, memberAdmission = Nothing} @@ -241,7 +241,7 @@ decodeChatMessageTest = describe "Chat message encoding/decoding" $ do #==# XInfo testProfile it "x.info with empty full name" $ "{\"v\":\"1\",\"event\":\"x.info\",\"params\":{\"profile\":{\"fullName\":\"\",\"displayName\":\"alice\",\"preferences\":{\"reactions\":{\"allow\":\"yes\"},\"voice\":{\"allow\":\"yes\"}}}}}" - #==# XInfo Profile {displayName = "alice", fullName = "", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Nothing, preferences = testChatPreferences, badge = Nothing, contactDomain = Nothing, contactDomainProof = Nothing} + #==# XInfo Profile {displayName = "alice", fullName = "", shortDescr = Nothing, image = Nothing, contactLink = Nothing, peerType = Nothing, preferences = testChatPreferences, badge = Nothing, simplexName = Nothing} it "x.contact with xContactId" $ "{\"v\":\"1\",\"event\":\"x.contact\",\"params\":{\"contactReqId\":\"AQIDBA==\",\"profile\":{\"fullName\":\"Alice\",\"displayName\":\"alice\",\"image\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=\",\"preferences\":{\"reactions\":{\"allow\":\"yes\"},\"voice\":{\"allow\":\"yes\"}}}}}" #==# XContact testProfile (Just $ XContactId "\1\2\3\4") Nothing Nothing