HomePhabricator
Diffusion Comm c9a55c72dd19

Implement method in NotificationsCryptoModule to serialize CryptoModule…

Description

Implement method in NotificationsCryptoModule to serialize CryptoModule instance and atomically store it in a file.

Summary: This differential implements CryptoModule serialization and atomic write to a file under given path. Its implementation ensures that write is made atomically and in fault-tolerant manner.

Test Plan:
Temporarily make this and deserialization method public. In CommCoreModule in initializeCryptoAccount method pass created CryptoModule instance, path returned from PlatformSpecificTools::getNotifications... and some random string (as pickling key) to this method. Then
pass the same pickling key and path returned from PlatformSpecificTools::getNotifications... to NotificationsCryptoModule::deserializeCryptoModule. Using XCode debugger or logging ensure initial CryptoModule matches the one returned from this method.
Note that it is an e2e test that also tests previous differential in more reliable manner.

Reviewers: tomek, bartek, kamil

Reviewed By: bartek

Subscribers: ashoat, atul

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