chromium/components/sync/nigori/nigori_sync_bridge_impl.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/sync/nigori/nigori_sync_bridge_impl.h"

#include <utility>

#include "base/base64.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "components/sync/base/passphrase_enums.h"
#include "components/sync/base/time.h"
#include "components/sync/engine/nigori/cross_user_sharing_public_key.h"
#include "components/sync/engine/nigori/nigori.h"
#include "components/sync/nigori/keystore_keys_cryptographer.h"
#include "components/sync/nigori/nigori_storage.h"
#include "components/sync/nigori/pending_local_nigori_commit.h"
#include "components/sync/protocol/encryption.pb.h"
#include "components/sync/protocol/entity_data.h"
#include "components/sync/protocol/nigori_local_data.pb.h"
#include "components/sync/protocol/nigori_specifics.pb.h"

namespace syncer {

namespace {

NigoriSpecifics;

const char kNigoriNonUniqueName[] =;

// Enumeration of possible values for a key derivation method (including a
// special value of "not set"). Used in UMA metrics. Do not re-order or delete
// these entries; they are used in a UMA histogram.  Please edit
// SyncCustomPassphraseKeyDerivationMethodState in enums.xml if a value is
// added.
// LINT.IfChange(SyncCustomPassphraseKeyDerivationMethodState)
enum class KeyDerivationMethodStateForMetrics {};
// LINT.ThenChange(/tools/metrics/histograms/metadata/sync/enums.xml:SyncCustomPassphraseKeyDerivationMethodState)

// The state of the cross user sharing key pair after pending keys are
// successfully decrypted. These values are persisted to logs. Entries should
// not be renumbered and numeric values should never be reused.
// LINT.IfChange(CrossUserSharingKeyPairStateOnDecryptPendingKeys)
enum class CrossUserSharingKeyPairStateOnDecryptPendingKeys {};
// LINT.ThenChange(/tools/metrics/histograms/metadata/sync/enums.xml:CrossUserSharingKeyPairStateOnDecryptPendingKeys)

CrossUserSharingKeyPairStateOnDecryptPendingKeys
GetKeyPairStateOnDecryptPendingKeys(const CrossUserSharingKeys& new_key_pair,
                                    std::optional<uint32_t> key_pair_version) {}

KeyDerivationMethodStateForMetrics GetKeyDerivationMethodStateForMetrics(
    const std::optional<KeyDerivationParams>& key_derivation_params) {}

std::string GetScryptSaltFromSpecifics(
    const sync_pb::NigoriSpecifics& specifics) {}

KeyDerivationParams GetKeyDerivationParamsFromSpecifics(
    const sync_pb::NigoriSpecifics& specifics) {}

// We need to apply base64 encoding before deriving Nigori keys because the
// underlying crypto libraries (in particular the Java counterparts in JDK's
// implementation for PBKDF2) assume the keys are utf8.
std::vector<std::string> Base64EncodeKeys(
    const std::vector<std::vector<uint8_t>>& keys) {}

bool SpecificsHasValidKeyDerivationParams(const NigoriSpecifics& specifics) {}

// Validates given |specifics| assuming it's not specifics received from the
// server during first-time sync for current user (i.e. it's not a default
// specifics).
bool IsValidNigoriSpecifics(const NigoriSpecifics& specifics) {}

bool IsValidPassphraseTransition(
    NigoriSpecifics::PassphraseType old_passphrase_type,
    NigoriSpecifics::PassphraseType new_passphrase_type) {}

// Updates |*current_type| if needed. Returns true if its value was changed.
bool UpdatePassphraseType(NigoriSpecifics::PassphraseType new_type,
                          NigoriSpecifics::PassphraseType* current_type) {}

bool IsValidEncryptedTypesTransition(bool old_encrypt_everything,
                                     const NigoriSpecifics& specifics) {}

bool IsValidLocalData(const sync_pb::NigoriLocalData& local_data) {}

std::optional<CrossUserSharingPublicKey> PublicKeyFromProto(
    const sync_pb::CrossUserSharingPublicKey& public_key) {}

}  // namespace

class NigoriSyncBridgeImpl::BroadcastingObserver
    : public SyncEncryptionHandler::Observer {};

NigoriSyncBridgeImpl::NigoriSyncBridgeImpl(
    std::unique_ptr<NigoriLocalChangeProcessor> processor,
    std::unique_ptr<NigoriStorage> storage)
    :{}

NigoriSyncBridgeImpl::~NigoriSyncBridgeImpl() {}

void NigoriSyncBridgeImpl::AddObserver(Observer* observer) {}

void NigoriSyncBridgeImpl::RemoveObserver(Observer* observer) {}

void NigoriSyncBridgeImpl::NotifyInitialStateToObservers() {}

DataTypeSet NigoriSyncBridgeImpl::GetEncryptedTypes() {}

Cryptographer* NigoriSyncBridgeImpl::GetCryptographer() {}

PassphraseType NigoriSyncBridgeImpl::GetPassphraseType() {}

void NigoriSyncBridgeImpl::SetEncryptionPassphrase(
    const std::string& passphrase,
    const KeyDerivationParams& key_derivation_params) {}

void NigoriSyncBridgeImpl::SetExplicitPassphraseDecryptionKey(
    std::unique_ptr<Nigori> key) {}

void NigoriSyncBridgeImpl::AddTrustedVaultDecryptionKeys(
    const std::vector<std::vector<uint8_t>>& keys) {}

base::Time NigoriSyncBridgeImpl::GetKeystoreMigrationTime() {}

KeystoreKeysHandler* NigoriSyncBridgeImpl::GetKeystoreKeysHandler() {}

const sync_pb::NigoriSpecifics::TrustedVaultDebugInfo&
NigoriSyncBridgeImpl::GetTrustedVaultDebugInfo() {}

bool NigoriSyncBridgeImpl::NeedKeystoreKey() const {}

bool NigoriSyncBridgeImpl::SetKeystoreKeys(
    const std::vector<std::vector<uint8_t>>& keys) {}

std::optional<ModelError> NigoriSyncBridgeImpl::MergeFullSyncData(
    std::optional<EntityData> data) {}

std::optional<ModelError> NigoriSyncBridgeImpl::ApplyIncrementalSyncChanges(
    std::optional<EntityData> data) {}

std::optional<ModelError> NigoriSyncBridgeImpl::UpdateLocalState(
    const NigoriSpecifics& specifics) {}

NigoriKeyBag NigoriSyncBridgeImpl::BuildDecryptionKeyBagForRemoteKeybag()
    const {}

std::optional<ModelError> NigoriSyncBridgeImpl::TryDecryptPendingKeysWith(
    const NigoriKeyBag& key_bag) {}

std::unique_ptr<EntityData> NigoriSyncBridgeImpl::GetDataForCommit() {}

std::unique_ptr<EntityData> NigoriSyncBridgeImpl::GetDataForDebugging() {}

void NigoriSyncBridgeImpl::ApplyDisableSyncChanges() {}

const CryptographerImpl& NigoriSyncBridgeImpl::GetCryptographerImplForTesting()
    const {}

bool NigoriSyncBridgeImpl::HasPendingKeysForTesting() const {}

KeyDerivationParams
NigoriSyncBridgeImpl::GetCustomPassphraseKeyDerivationParamsForTesting() const {}

base::Time NigoriSyncBridgeImpl::GetExplicitPassphraseTime() const {}

KeyDerivationParams NigoriSyncBridgeImpl::GetKeyDerivationParamsForPendingKeys()
    const {}

void NigoriSyncBridgeImpl::MaybeNotifyOfPendingKeys() const {}

sync_pb::NigoriLocalData NigoriSyncBridgeImpl::SerializeAsNigoriLocalData()
    const {}

void NigoriSyncBridgeImpl::MaybeTriggerKeystoreReencryption() {}

void NigoriSyncBridgeImpl::QueuePendingLocalCommit(
    std::unique_ptr<PendingLocalNigoriCommit> local_commit) {}

void NigoriSyncBridgeImpl::PutNextApplicablePendingLocalCommit() {}

void NigoriSyncBridgeImpl::MaybePopulateKeystoreKeysIntoCryptographer() {}

std::unique_ptr<EntityData> NigoriSyncBridgeImpl::GetDataImpl() {}

}  // namespace syncer