HomePhabricator
Diffusion Comm 7d3f16e0496e

[web][native] implement creating outbound session in `OlmSessionCreatorContext`

Description

[web][native] implement creating outbound session in OlmSessionCreatorContext

Summary:
Implemented method on both platforms.

On web implementing only creating session, I am going to work on persistence (ENG-5856) and safety (ENG-6209) soon.

Depends on D10751

Test Plan:
Run this code in keyserver-connection-handler (both web and native)

const devices = await identityClient?.getOutboundKeysForUser(
          '3CF3B2B6-FE28-4475-8CB3-68609A246D06', //3CF3B2B6-FE28-4475-8CB3-68609A246D06
        );

        console.log('Keys: ', devices);

        for (const deviceKeys of devices) {
          if (!deviceKeys.keys) {
            console.log(`No keys for device: ${deviceKeys.deviceID}`);
            continue;
          }
          try {
            const initMessage =
              await olmSessionCreatorContext.contentSessionCreator(
                deviceKeys.keys.identityKeysBlob.primaryIdentityPublicKeys,
                deviceKeys.keys.contentInitializationInfo,
              );
            console.log(
              `Session with device ${deviceKeys.deviceID} created: ${initMessage}`,
            );
          } catch (e) {
            console.log(
              `Session with device ${deviceKeys.deviceID} creation error: ${e.message}`,
            );
          }
        }

(if someone want to also test it please use different deviceID)

Reviewers: tomek, marcin, varun

Reviewed By: tomek

Subscribers: ashoat

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