summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_easy_unlock_client.h
blob: e94cc547f54aeb1d8200114c6e9615293e6f2107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_
#define CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_

#include <string>

#include "base/macros.h"
#include "chromeos/dbus/easy_unlock_client.h"

namespace chromeos {

// A fake implemetation of EasyUnlockClient.
class CHROMEOS_EXPORT FakeEasyUnlockClient : public EasyUnlockClient {
 public:
  // Tests if the provided keys belong to the same (fake) EC P256 key pair
  // generated by |this|.
  static bool IsEcP256KeyPair(const std::string& private_key,
                              const std::string& public_key);

  FakeEasyUnlockClient();
  ~FakeEasyUnlockClient() override;

  // EasyUnlockClient overrides
  void Init(dbus::Bus* bus) override;
  void GenerateEcP256KeyPair(const KeyPairCallback& callback) override;
  void WrapPublicKey(const std::string& key_algorithm,
                     const std::string& public_key,
                     const DataCallback& callback) override;
  void PerformECDHKeyAgreement(const std::string& private_key,
                               const std::string& public_key,
                               const DataCallback& callback) override;
  void CreateSecureMessage(const std::string& payload,
                           const CreateSecureMessageOptions& options,
                           const DataCallback& callback) override;
  void UnwrapSecureMessage(const std::string& message,
                           const UnwrapSecureMessageOptions& options,
                           const DataCallback& callback) override;

 private:
  int generated_keys_count_;

  DISALLOW_COPY_AND_ASSIGN(FakeEasyUnlockClient);
};

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_