• Mikel Astiz's avatar
    Add reencryption support to pseudo-USS PASSWORDS · 26111c26
    Mikel Astiz authored
    Regular USS datatypes (bridges) don't need to care about encryption,
    because the processor and worker take care and the original model
    doesn't need to be encrypted.
    
    PASSWORDS on pseudo-USS are special because we need that the "directory"
    copy (the one in SyncableServiceBasedBridge) is stored encrypted on
    disk too, similarly to how the legacy Directory does it.
    
    In certain cases like when setting up a custom passphrase, the
    encryption key changes and the processor&worker react to that by
    recommitting all entities with the new encryption requirements. For
    pseudo-USS PASSWORDS, it should also reencrypt the local "directory".
    
    In order to do this:
    1. A new method is introduced in ModelTypeSyncBridge, for the bridge
       to realize there's an ongoing reencryption.
    
    2. SyncableServiceBasedBridge takes care of using the cryptographer
       (available for PASSWORDS only) to reencrypt all data.
    
    Implementation-wise, the simplest way to achieve that is to modify
    the bridge such that in_memory_store_ keeps more information, namely
    the whole sync_pb::PersistedEntityData proto.
    
    Bug: 870624
    Change-Id: I1e0d7c972580377618c05b9d1f79c6d72f58022f
    Reviewed-on: https://chromium-review.googlesource.com/c/1288629
    Commit-Queue: Mikel Astiz <mastiz@chromium.org>
    Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
    Reviewed-by: default avatarMarc Treib <treib@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#601863}
    26111c26
syncable_service_based_bridge.h 5.45 KB