Page MenuHomePhabricator

Introduce methods in CommCoreModule to get one time keys and prekey for notifications. Refactor method to get one time keys for primary olm account
AbandonedPublic

Authored by marcin on Apr 12 2023, 4:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 8:07 PM
Unknown Object (File)
Mon, Apr 15, 6:54 PM
Unknown Object (File)
Mon, Apr 15, 3:45 PM
Unknown Object (File)
Mon, Apr 15, 3:42 PM
Unknown Object (File)
Mon, Apr 15, 12:09 AM
Unknown Object (File)
Sat, Apr 13, 8:01 AM
Unknown Object (File)
Sat, Apr 13, 3:39 AM
Unknown Object (File)
Fri, Apr 12, 6:26 PM
Subscribers

Details

Reviewers
atul
tomek
bartek
Summary

This differential introduces methods in CommCoreModule to get one time keys batch and prekey for notifications olm account. Additionally corresponding method for primary olm account is
refactored. The refactor gives us control on how many one time keys are generated (previously we were restricted to the default value in CryptoModule.h). Implemented and refactored methods return JS
objects of types OLMOneTimeKeys or OLMPrekey respectively. Note that getUserOneTimeKeys returned raw string previously.

Test Plan

In account-selectors place the following code under commCoreModule.initializeCryptoAccount():

const [notificationsOneTimeKeys, notificationsPrekey, userOneTimeKeys] =
        await Promise.all([
          commCoreModule.getNotificationsOneTimeKeys(2),
          commCoreModule.getNotificationsPrekey(),
          commCoreModule.getUserOneTimeKeys(10),
        ]);
console.log(notificationsOneTimeKeys);
console.log(notificationsPrekey);
console.log(userOneTimeKeys);

Build the app, log-in and examine content of keys logged to the console.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Update prekey field to be of type OLMPrekey

It's hard to know how to review this diff when we don't know how the types will be used. Is it possible to combine this diff with another one that uses the types?

It's hard to know how to review this diff when we don't know how the types will be used. Is it possible to combine this diff with another one that uses the types?

Types OLMPrekey and OLMOneTimeKeys are used in very next differential to type data returned from CommCoreModule, so we add declaration of those two there. Type OLMSessionInitializationKeys will be used when I upload prekey and one time keys to the keyserver via login request, so it can be declared further in the stack. I will make those changes.

Bring new JS crypto types to the diff where thay are used.

marcin retitled this revision from Introduce type for keys needed to initialize OLM session to Introduce methods in CommCoreModule to get one time keys and prekey for notifications. Refactor method to get one time keys for primary olm account.Apr 13 2023, 2:04 AM
marcin edited the summary of this revision. (Show Details)
marcin edited the test plan for this revision. (Show Details)

Initially this diff contained only type definitions which made it impossible to review without seeing the types usages. Then I merged changes from the very next differentials that use those types, but new I think it is better to abandon this revision and put type definitions in the next differential. I decided to do so since the next differential already contains some discussion.