Page MenuHomePhabricator

[native] Make SecureStore methods static
ClosedPublic

Authored by michal on Nov 17 2023, 8:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jul 4, 2:08 PM
Unknown Object (File)
Mon, Jul 1, 10:11 PM
Unknown Object (File)
Wed, Jun 26, 4:16 PM
Unknown Object (File)
Wed, Jun 26, 2:13 PM
Unknown Object (File)
Tue, Jun 25, 11:05 PM
Unknown Object (File)
Tue, Jun 25, 8:24 AM
Unknown Object (File)
Sun, Jun 23, 11:32 PM
Unknown Object (File)
Sun, Jun 23, 2:46 PM
Subscribers

Details

Summary

ENG-1567

This will make it easier to expose SecureStore to Rust as our native Rust codebase as inherently stateless.

Test Plan

Tested on Android and iOS physical devices:

  • Add log to SQLiteQueryExecutor::initilize that prints maybeEncryptionKey read from Secure Store
  • Open the app -> encryption key is logged
  • Log out and log in to trigger creation of a new encryption key
  • Restart the app -> a different encryption key is logged

Tested notifications on physical devices:

  • Send notification - ensure it is displayed correctly.
  • Send notification to backgrounded app, kill keyserver in the terminal and open the app. Ensure that data delivered with notification are present even though the keyserver is not running.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/cpp/CommonCpp/Tools/CommSecureStore.h
13–15 ↗(On Diff #33387)

This needs to be inline because each variable can only be defined once. In case of instance variables this can be done in a header file (as each instance has a "separate" variable). In case of static variables their values normally would be specified in the .cpp files which is problematic for us as we have a separate implementations for iOS and Android. Fortunately we can use C++17 feature and mark them as inline which allows us the specify value in the header file.

C++ reference, section "Static data members"

Test plan should include an additional steps that ensure notifications functionality is not broken by those changes:

  1. Send notification - ensure it is displayed correctly.
  2. Send notification to backgrounded app, kill keyserver in the terminal and open the app. Ensure that data delivered with notification are present even though the keyserver is not running.
This revision is now accepted and ready to land.Nov 20 2023, 2:17 AM