Diffusion Comm 157e772a80ac

[keyserver] Send `SIGNED_IDENTITY_KEYS_BLOB` request to client if data missing…


[keyserver] Send SIGNED_IDENTITY_KEYS_BLOB request to client if data missing in DB

In handleInitialClientSocketMessage we send SIGNED_IDENTITY_KEYS_BLOB request to native or web client if the signed_identity_keys column of the cookies table is missing for an entry with id=cookieID.

These requests will be handled on the client by nativeGetClientResponsesSelector and webGetClientResponsesSelector which will generate functions that return a Promise for an array of ClientClientResponses.

The responses will then be handled by the keyserver with the session-utils:processClientResponses(...) function... which after the next diff will include SignedIdentityKeysBlob from client response in the serverDB cookies table.

Depends on D7050

Test Plan:

  1. Shut down keyserver.
  2. Delete contents of signed_identity_keys column for all rows of cookies table. (Deleting contents for all rows wasn't necessary, but just did it anyways)
  3. Set breakpoint in handleInitialClientSocketMessage and restart keyserver.
  4. Observe that isCookieMissingSignedIdentityKeysBlob returns true and SIGNED_IDENTITY_KEYS_BLOB request is added to serverRequests.
  5. Set breakpoint in native/web nativeGetClientResponsesSelector/webGetClientResponsesSelector and ensure that signedIdentityKeysBlob is being generated and added to clientResponses as expected
  6. Set breakpoint in processClientResponses and ensure that we're getting expected response.

After next diff:

  1. Ensure that signedIdentityKeysBlob is valid using same checks in loginResponder and siweAuthResponder.
  2. Ensure that setCookieSignedIdentityKeysBlob query executes correctly and signed_identity_keys column for row with id=cookieID is correctly populated.
  3. Force socket to disconnect/reconnect and ensure that SIGNED_IDENTITY_KEYS_BLOB request is NOT sent from the keyserver.

Reviewers: ashoat

Reviewed By: ashoat

Differential Revision: https://phab.comm.dev/D7051