Files
simplex-chat/rfcs/2022-02-10-deduplicate-contact-requests.md
Efim Poberezkin c1c55ca700 deduplicate contact requests (#287)
* deprecate XContact

* XInfoId

* xInfoId tests

* merging

* saving on connection

* connectByAddress

* remove old connect

* deduplicate contact requests

* check on contact acceptance

* test

* rename response

* reuse CRContactRequestAlreadyAccepted

* Update src/Simplex/Chat.hs

* createConnReqConnection

* simplify controller logic

* store methods + profile change

* index

* more indices

* unXInfoId

* simplify

* XInfo with ID -> XContact

* sync reply to Connect when contact already exists

* update view for sync CRContactAlreadyExists command response

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2022-02-13 09:19:24 +00:00

1.3 KiB

Deduplicate contact requests

  1. add nullable fields via_contact_uri_hash and xcontact_id to connections
  2. when joining (Connect -> SCMContact)
    • generate and save random xcontact_id
    • save hash of AConnectionRequestUri when joining via contact uri (AConnectionRequestUri -> ConnectionRequestUri -> CRContactUri)
    • send random identifier in XContact as Maybe XContactId
    • check for repeat join - if connection with such via_contact_uri_hash has contact notify user
    • check for repeat join - check in connections if such contact uri exists, if yes use same identifier; the rest of request can (should) be regenerated, e.g. new server, profile can be required
  3. add nullable field xcontact_id to contact_requests and to contacts (* for auto-acceptance)
  4. on contact request (processUserContactRequest)
    • save identifier
    • * check if xcontact_id is in contacts - then notify this contact already exists
    • when saving check if contact request with such identifier exists, if yes update contact_request (invId, new profile)
    • ? remove old invitation - probably not necessarily, to be done in scope of connection expiration
    • return from Store whether request is new or updated (Bool?), new chat response for update or same response