Page MenuHomePhabricator

[lib][native][web] Use urlPrefix from keysererStore
ClosedPublic

Authored by inka on Aug 15 2023, 7:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 2:01 PM
Unknown Object (File)
Mon, Oct 28, 1:42 PM
Unknown Object (File)
Oct 13 2024, 7:12 PM
Unknown Object (File)
Oct 4 2024, 3:44 PM
Unknown Object (File)
Oct 4 2024, 3:17 PM
Unknown Object (File)
Oct 2 2024, 10:17 PM
Unknown Object (File)
Oct 2 2024, 10:17 PM
Unknown Object (File)
Oct 2 2024, 10:17 PM
Subscribers

Details

Summary

issue: https://linear.app/comm/issue/ENG-4459/refactor-urlprefix-field

  1. urlPrefixSelector returns state.urlPrefix if urlPrefix is not present in the keyserverStore as a hack, because the migration will be written in the next diff. This hack should also be undone in the next diff.
  1. useServerCall will need to take the id of the keyserver as an argument. serverCallState will also take this id as an argument. But the urlPrefix for the keyserver with this id might not be found int the keyserverStore (most likely because the keyserver with this id is not present in the keyserverStore at all). I'm currently using an invariant to check this, but me might want to reconsider how this should be handled in the multikeyserver world
  1. In ConnectedLoggedOutModal I'm checking with an invariant if urlPrefix was found. It makes sense as long as we are connected only to one keyserver, because we know the value is set. In multikeyserver world ConnectedLoggedOutModal they will be getting a cookie for each of the keyservers in the keyserverStore, by iterating over them
  1. In SQLiteDataHandler I'm checking with an invariant if urlPrefix was found. urlPrefix is used there to get a new cookie from the keyserver - log the user back and populate the db with data in case of a migartion failure (see https://linear.app/comm/issue/ENG-2071/clear-database-on migration-failure). A new cookie will need to be fetched for all keyservers in the future. (@kamil does this sound right?)
  1. In ConnectedCustomServerModal I'm checking with an invariant if urlPrefix was found. urlPrefix is used there to check whether the typed in url is different from the one we are connected to. In the future we will need to check if it matches any of the keyservers we are connected to, so we will not need this invariant.
  1. ConnectedDevTools: same as ConnectedCustomServerModal. Additionally, the ServerIcon won't be present in the multikeyserver world, because we will be connected to all keyservers on the list.
  1. openSocketSelector and Socket (both web and native): Currently we have a single Socket component that is rendered in the Root component. I'm guessing that once we have multiple keyservers we will have a list of Sockets rendered, and we will be adding and removing items from this list when we connect and disconnect from servers. I'm guessing that the client wanting to connect to a keyserver will ask the identity service for the url of the keyserver it wants to connect to, and then try to open a socket. The Socket will then probably take the id of the keyserver as an argument and will somehow have to deal with the possibility that there is no such keyserver in the keyserverStore. For now we check it with an invariant, but that's probably not ideal in the multikeyserver world

To make sure all of these are adressed at some point, I will create issues / write comments on linear. I will track this in https://linear.app/comm/issue/ENG-4651/document-changes-that-need-to-be-done-mentioned-in-d8814

Test Plan

Checked that web and native work - they connect to the keyserver and it's possible to send messages. Ran yarn flow-all.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

inka edited the summary of this revision. (Show Details)
inka requested review of this revision.Aug 15 2023, 7:56 AM
This revision is now accepted and ready to land.Aug 16 2023, 1:50 AM