blob: 5118b8ea7c08748e41a363f26690632c6288d555 [file] [log] [blame]
Maksim Ivanov43477a92018-12-03 04:59:27 +01001// 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 Zhoud42c2422019-11-15 14:29:30 -08008#include <memory>
Maksim Ivanov43477a92018-12-03 04:59:27 +01009#include <string>
10
11#include <base/macros.h>
12#include <base/memory/ref_counted.h>
13
14#include "cryptohome/key_challenge_service.h"
Greg Kerrf9b0fc12020-08-13 22:29:10 +000015#include "cryptohome/rpc.pb.h"
Maksim Ivanov43477a92018-12-03 04:59:27 +010016
17#include "cryptohome_key_delegate/dbus-proxies.h"
Maksim Ivanov43477a92018-12-03 04:59:27 +010018
19namespace dbus {
20class Bus;
21} // namespace dbus
22
23namespace cryptohome {
24
25// Real implementation of the KeyChallengeService interface that uses D-Bus for
26// making key challenge requests to the specified service.
27class 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 Fan6bc59e12020-11-11 02:51:06 +090033 KeyChallengeServiceImpl(const KeyChallengeServiceImpl&) = delete;
34 KeyChallengeServiceImpl& operator=(const KeyChallengeServiceImpl&) = delete;
Maksim Ivanov43477a92018-12-03 04:59:27 +010035
36 ~KeyChallengeServiceImpl() override;
37
38 // KeyChallengeService overrides:
39 void ChallengeKey(const AccountIdentifier& account_id,
40 const KeyChallengeRequest& key_challenge_request,
John L Chen5fcf4062019-05-13 02:27:51 +080041 ResponseCallback response_callback) override;
Maksim Ivanov43477a92018-12-03 04:59:27 +010042
Xiaoyong Zhoud42c2422019-11-15 14:29:30 -080043 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 Ivanov43477a92018-12-03 04:59:27 +010053 private:
Maksim Ivanove6232ad2019-03-13 21:13:22 +010054 const std::string key_delegate_dbus_service_name_;
Maksim Ivanov43477a92018-12-03 04:59:27 +010055 org::chromium::CryptohomeKeyDelegateInterfaceProxy dbus_proxy_;
Maksim Ivanov43477a92018-12-03 04:59:27 +010056};
57
58} // namespace cryptohome
59
60#endif // CRYPTOHOME_KEY_CHALLENGE_SERVICE_IMPL_H_