Page MenuHomePhabricator

[crypto] implement prekey rotation in `OlmAPI`
ClosedPublic

Authored by kamil on Feb 23 2024, 2:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 11, 1:50 AM
Unknown Object (File)
Fri, Nov 8, 5:12 PM
Unknown Object (File)
Wed, Oct 23, 7:24 PM
Unknown Object (File)
Wed, Oct 23, 7:24 PM
Unknown Object (File)
Wed, Oct 23, 7:24 PM
Unknown Object (File)
Wed, Oct 23, 7:21 PM
Unknown Object (File)
Oct 18 2024, 7:39 AM
Unknown Object (File)
Oct 15 2024, 1:47 AM
Subscribers

Details

Summary

Shared code with prekeys rotation.

Web part should match native C++ version implemented here.

This code could be vulnerable to multiple promises modyfing olm account but fixing this is tracked in ENG-6768.

For now matching code implemented in native - but we should mark prekeys as published before uploading as described and tracked here. (cc. @varun)

Depends on D11120

Test Plan

Modify shouldRotatePrekey method to return true and check if it works.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil added inline comments.
native/components/prekeys-handler.react.js
1 ↗(On Diff #37488)

Now with OlmAPI we can move it to the lib

web/crypto/olm-api.js
118 ↗(On Diff #37488)

on native notif rotation is also not implemented

kamil published this revision for review.Feb 23 2024, 4:22 AM
native/root.react.js
339 ↗(On Diff #37488)

Did the order need to be changed?

tomek added inline comments.
lib/components/prekeys-handler.react.js
35 ↗(On Diff #37488)

Are we sure we want to rotate the keys after each context change? Looking at the context code, it seems that yes.

web/crypto/olm-api.js
105–116 ↗(On Diff #37488)

We should move this logic to a deeper level, just like we have it on native - it will be handled by https://linear.app/comm/issue/ENG-6768/migrate-validateanduploadprekeys-to-shared-worker

This revision is now accepted and ready to land.Feb 26 2024, 4:59 AM
This revision was landed with ongoing or failed builds.Feb 26 2024, 5:46 AM
This revision was automatically updated to reflect the committed changes.