// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_UNEXPORTABLE_KEYS_UNEXPORTABLE_KEY_TASK_MANAGER_H_ #define COMPONENTS_UNEXPORTABLE_KEYS_UNEXPORTABLE_KEY_TASK_MANAGER_H_ #include <map> #include "base/component_export.h" #include "base/containers/span.h" #include "base/functional/callback.h" #include "base/memory/scoped_refptr.h" #include "components/unexportable_keys/background_long_task_scheduler.h" #include "components/unexportable_keys/background_task_priority.h" #include "components/unexportable_keys/ref_counted_unexportable_signing_key.h" #include "components/unexportable_keys/service_error.h" #include "components/unexportable_keys/unexportable_key_id.h" #include "crypto/signature_verifier.h" #include "crypto/unexportable_key.h" namespace unexportable_keys { // `UnexportableKeyTaskManager` helps efficiently schedule tasks to generate // and use signing keys backed by specialized hardware. // // Basically, it provides an asynchronous interface for all slow tasks exposed // by `crypto::UnexportableSigningKey` and `crypto::UnexportableKeyProvider`. // These tasks may take up to several seconds to execute so they never should be // run on the main thread. // // `UnexportableKeyTaskManager` reserves the right to deduplicate calls to // `SignSlowlyAsync()` and cache recent results of this operation in order to // reduce the number of operations scheduled on hardware. // // WARNING: This might break the assumption about the signature being // non-deterministic for some algorithms (like ECDSA). Let the OWNERS know if // you want to disable this feature for your use case. // // Read documentation to `BackgroundLongTaskScheduler` for details on how the // tasks are getting scheduled. class COMPONENT_EXPORT(UNEXPORTABLE_KEYS) UnexportableKeyTaskManager { … }; } // namespace unexportable_keys #endif // COMPONENTS_UNEXPORTABLE_KEYS_UNEXPORTABLE_KEY_TASK_MANAGER_H_