HomePhabricator
Diffusion Comm 67f80a887a6f

Implement prekey lifecycle in `CryptoModule`.

Description

Implement prekey lifecycle in CryptoModule.

Summary: This differential wraps olm methods for prekey rotation in CryptoModule.

Test Plan:
In CommCoreModule::getUserPublicKeys place the following lines and attach XCode debugger to each line (for Android log output of each line and examine logs in logcat):

std::uint8_t numPrekeys = this->cryptoModule->getNumPrekeys(); // should be zero
std::string firstPrekey = this->cryptoModule->generateAndGetPrekey();
std::string secondPrekey = this->cryptoModule->generateAndGetPrekey();
std::uint8_t numPrekeys_1 = this->cryptoModule->getNumPrekeys();//should be 2
std::string prekey_1 = this->cryptoModule->getPrekey();// should be as prekey 2
std::string prekey_2 = this->cryptoModule->getUnpublishedPrekey();// should be as prekey 2
this->cryptoModule->forgetOldPrekey();
std::uint8_t numPrekeys_2 = this->cryptoModule->getNumPrekeys();// should be 1
this->cryptoModule->markPrekeyAsPublished();
std::string secondPrekey_3 = this->cryptoModule->getUnpublishedPrekey();// should crash

Ensure the output of each line matches what is written in the comments.

Reviewers: tomek, bartek, ashoat

Reviewed By: bartek, ashoat

Subscribers: anunay, ashoat

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

Details

Provenance
marcinAuthored on Apr 11 2023, 5:45 AM
Reviewer
bartek
Differential Revision
D7381: Implement prekey lifecycle in `CryptoModule`.
Parents
rCOMMa2985c2cb201: [native] show setting threadStore error in Alert message
Branches
Unknown
Tags
Unknown