HomePhabricator
Diffusion Comm 0f6b3d510c41

[crypto] unify one-time keys usage

Description

[crypto] unify one-time keys usage

Summary:
ENG-6577.

  1. Remove getOneTimeKeyArray function.
  2. Updates getOneTimeKeyArray callsites to getOneTimeKeyValues.
  3. Remove parsing by offsets from createSessionAsInitializer.
  4. Remove the keyIndex argument - it's not used, Identity returns only one one-time key.
  5. Rename oneTimeKeys -> oneTimeKey.
  6. Remove calling getOneTimeKeyValuesFromBlob - we now expect short keys in session creators.
  7. Move parsing long-format to getOlmSessionInitializationData. The get_olm_session_initialization_data endpoint returns keys in long format, so parse it immediately after receiving and in the rest of the codebase we assume we operate on short format. I decided to not update get_olm_session_initialization_data to return short keys as it will be deprecated soon so we can avoid handling backward compatibility - old clients still expect long format.

Adding all three reviewers as blocking - all worked on code related to session creation and keys, to make sure we are all on the same page about one-time keys usage.

Test Plan:

  1. Creating notif sesssion on native works (not testing notifs itself, just session creation).
  2. Creating notif session on web.
  3. Creating content session on native.
  4. Keyserver during login uploads short keys.
  5. All devices as response to RefreshKeyRequest uploads keys in short format.

Reviewers: marcin, varun, tomek

Reviewed By: marcin, varun, tomek

Subscribers: ashoat

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

Details

Provenance
kamilAuthored on Feb 6 2024, 2:23 AM
Reviewer
marcin
Differential Revision
D10964: [crypto] unify one-time keys usage
Parents
rCOMM3cdfe501d658: [lib] Add `rolesWithoutSpecialRoleField` filter to…
Branches
Unknown
Tags
Unknown