# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
static_library("trusted_vault") {
sources = [
"trusted_vault_client.h",
"trusted_vault_service.cc",
"trusted_vault_service.h",
]
public_deps = [
"//base",
"//components/keyed_service/core",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
if (!is_android) {
sources += [
"command_line_switches.cc",
"command_line_switches.h",
"download_keys_response_handler.cc",
"download_keys_response_handler.h",
"features.cc",
"features.h",
"frontend_trusted_vault_connection.cc",
"frontend_trusted_vault_connection.h",
"proto_string_bytes_conversion.cc",
"proto_string_bytes_conversion.h",
"proto_time_conversion.cc",
"proto_time_conversion.h",
"recovery_key_store_connection.h",
"recovery_key_store_connection_impl.cc",
"recovery_key_store_connection_impl.h",
"recovery_key_store_controller.cc",
"recovery_key_store_controller.h",
"securebox.cc",
"securebox.h",
"standalone_trusted_vault_backend.cc",
"standalone_trusted_vault_backend.h",
"standalone_trusted_vault_client.cc",
"standalone_trusted_vault_client.h",
"trusted_vault_access_token_fetcher.h",
"trusted_vault_access_token_fetcher_frontend.cc",
"trusted_vault_access_token_fetcher_frontend.h",
"trusted_vault_access_token_fetcher_impl.cc",
"trusted_vault_access_token_fetcher_impl.h",
"trusted_vault_connection.cc",
"trusted_vault_connection.h",
"trusted_vault_connection_impl.cc",
"trusted_vault_connection_impl.h",
"trusted_vault_crypto.cc",
"trusted_vault_crypto.h",
"trusted_vault_degraded_recoverability_handler.cc",
"trusted_vault_degraded_recoverability_handler.h",
"trusted_vault_histograms.cc",
"trusted_vault_histograms.h",
"trusted_vault_request.cc",
"trusted_vault_request.h",
"trusted_vault_server_constants.cc",
"trusted_vault_server_constants.h",
]
deps = [
"//components/account_id",
"//components/os_crypt/sync",
"//components/signin/public/identity_manager",
"//components/trusted_vault/proto",
"//crypto",
"//google_apis",
"//net",
"//services/network/public/cpp:cpp",
"//third_party/boringssl",
]
}
if (is_chromeos_ash) {
sources += [
"recovery_key_provider_ash.cc",
"recovery_key_provider_ash.h",
]
deps += [
"//chromeos/ash/components/cryptohome",
"//chromeos/ash/components/dbus/cryptohome",
"//chromeos/ash/components/dbus/userdataauth",
"//chromeos/ash/components/dbus/userdataauth:userdataauth_proto",
"//components/account_id",
]
}
}
if (!is_android) {
source_set("unit_tests") {
testonly = true
sources = [
"download_keys_response_handler_unittest.cc",
"proto_string_bytes_conversion_unittest.cc",
"proto_time_conversion_unittest.cc",
"recovery_key_store_connection_unittest.cc",
"securebox_unittest.cc",
"standalone_trusted_vault_backend_unittest.cc",
"trusted_vault_access_token_fetcher_frontend_unittest.cc",
"trusted_vault_connection_impl_unittest.cc",
"trusted_vault_crypto_unittest.cc",
"trusted_vault_degraded_recoverability_handler_unittest.cc",
"trusted_vault_request_unittest.cc",
"trusted_vault_server_constants_unittest.cc",
]
configs += [ "//build/config:precompiled_headers" ]
deps = [
":test_support",
":trusted_vault",
"//components/os_crypt/sync",
"//components/os_crypt/sync:test_support",
"//components/signin/public/identity_manager:test_support",
"//components/trusted_vault/proto",
"//google_apis",
"//google_apis:test_support",
"//testing/gmock",
"//testing/gtest",
]
if (is_chromeos_ash) {
sources += [ "recovery_key_store_controller_ash_unittest.cc" ]
deps += [
"//chromeos/ash/components/dbus/userdataauth",
"//chromeos/ash/components/dbus/userdataauth:test_support",
"//chromeos/ash/components/dbus/userdataauth:userdataauth_proto",
]
}
}
}
static_library("test_support") {
testonly = true
sources = [
"test/fake_trusted_vault_access_token_fetcher.cc",
"test/fake_trusted_vault_access_token_fetcher.h",
"test/fake_trusted_vault_client.cc",
"test/fake_trusted_vault_client.h",
"test/mock_recovery_key_store_connection.cc",
"test/mock_recovery_key_store_connection.h",
]
deps = [
"//components/signin/public/identity_manager",
"//components/trusted_vault/proto",
"//testing/gmock",
]
public_deps = [
":trusted_vault",
"//base",
]
if (!is_android) {
sources += [
"test/fake_security_domains_server.cc",
"test/fake_security_domains_server.h",
"test/mock_trusted_vault_connection.cc",
"test/mock_trusted_vault_connection.h",
]
public_deps += [
"//components/trusted_vault/proto",
"//net:test_support",
"//url",
]
}
if (is_chromeos_lacros) {
sources += [
"test/fake_crosapi_trusted_vault_backend.cc",
"test/fake_crosapi_trusted_vault_backend.h",
"test/fake_crosapi_trusted_vault_backend_service.cc",
"test/fake_crosapi_trusted_vault_backend_service.h",
]
public_deps += [
"//chromeos/crosapi/mojom",
"//mojo/public/cpp/bindings",
]
deps += [ "//components/account_manager_core" ]
}
}