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