Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 1 | // Copyright 2018 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CRYPTOHOME_KEY_CHALLENGE_SERVICE_IMPL_H_ |
| 6 | #define CRYPTOHOME_KEY_CHALLENGE_SERVICE_IMPL_H_ |
| 7 | |
Xiaoyong Zhou | d42c242 | 2019-11-15 14:29:30 -0800 | [diff] [blame] | 8 | #include <memory> |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 9 | #include <string> |
| 10 | |
| 11 | #include <base/macros.h> |
| 12 | #include <base/memory/ref_counted.h> |
| 13 | |
| 14 | #include "cryptohome/key_challenge_service.h" |
Greg Kerr | f9b0fc1 | 2020-08-13 22:29:10 +0000 | [diff] [blame] | 15 | #include "cryptohome/rpc.pb.h" |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 16 | |
| 17 | #include "cryptohome_key_delegate/dbus-proxies.h" |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 18 | |
| 19 | namespace dbus { |
| 20 | class Bus; |
| 21 | } // namespace dbus |
| 22 | |
| 23 | namespace cryptohome { |
| 24 | |
| 25 | // Real implementation of the KeyChallengeService interface that uses D-Bus for |
| 26 | // making key challenge requests to the specified service. |
| 27 | class KeyChallengeServiceImpl final : public KeyChallengeService { |
| 28 | public: |
| 29 | // |key_delegate_dbus_service_name| is the D-Bus service name that implements |
| 30 | // the org.chromium.CryptohomeKeyDelegateInterface interface. |
| 31 | KeyChallengeServiceImpl(scoped_refptr<dbus::Bus> dbus_bus, |
| 32 | const std::string& key_delegate_dbus_service_name); |
Qijiang Fan | 6bc59e1 | 2020-11-11 02:51:06 +0900 | [diff] [blame] | 33 | KeyChallengeServiceImpl(const KeyChallengeServiceImpl&) = delete; |
| 34 | KeyChallengeServiceImpl& operator=(const KeyChallengeServiceImpl&) = delete; |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 35 | |
| 36 | ~KeyChallengeServiceImpl() override; |
| 37 | |
| 38 | // KeyChallengeService overrides: |
| 39 | void ChallengeKey(const AccountIdentifier& account_id, |
| 40 | const KeyChallengeRequest& key_challenge_request, |
John L Chen | 5fcf406 | 2019-05-13 02:27:51 +0800 | [diff] [blame] | 41 | ResponseCallback response_callback) override; |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 42 | |
Xiaoyong Zhou | d42c242 | 2019-11-15 14:29:30 -0800 | [diff] [blame] | 43 | void FidoMakeCredential( |
| 44 | const std::string& client_data_json, |
| 45 | const cryptohome::fido::PublicKeyCredentialCreationOptions& options, |
| 46 | MakeCredentialCallback response_callback) override; |
| 47 | |
| 48 | void FidoGetAssertion( |
| 49 | const std::string& client_data_json, |
| 50 | const cryptohome::fido::PublicKeyCredentialRequestOptions& request, |
| 51 | GetAssertionCallback response_callback) override; |
| 52 | |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 53 | private: |
Maksim Ivanov | e6232ad | 2019-03-13 21:13:22 +0100 | [diff] [blame] | 54 | const std::string key_delegate_dbus_service_name_; |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 55 | org::chromium::CryptohomeKeyDelegateInterfaceProxy dbus_proxy_; |
Maksim Ivanov | 43477a9 | 2018-12-03 04:59:27 +0100 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace cryptohome |
| 59 | |
| 60 | #endif // CRYPTOHOME_KEY_CHALLENGE_SERVICE_IMPL_H_ |