Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / proximity_auth / cryptauth / fake_secure_message_delegate.h
blob1fe9c0a5e901f5a45bfe1c9c67b3eeec59bf5641
1 // Copyright 2015 The Chromium 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.
5 #ifndef COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H
6 #define COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H
8 #include "base/macros.h"
9 #include "components/proximity_auth/cryptauth/secure_message_delegate.h"
11 namespace proximity_auth {
13 // Fake implementation of SecureMessageDelegate used in tests.
14 // For clarity in tests, all functions in this delegate will invoke their
15 // callback with the result before returning.
16 class FakeSecureMessageDelegate : public SecureMessageDelegate {
17 public:
18 FakeSecureMessageDelegate();
19 ~FakeSecureMessageDelegate() override;
21 // SecureMessageDelegate:
22 void GenerateKeyPair(const GenerateKeyPairCallback& callback) override;
23 void DeriveKey(const std::string& private_key,
24 const std::string& public_key,
25 const DeriveKeyCallback& callback) override;
26 void CreateSecureMessage(
27 const std::string& payload,
28 const std::string& key,
29 const CreateOptions& create_options,
30 const CreateSecureMessageCallback& callback) override;
31 void UnwrapSecureMessage(
32 const std::string& serialized_message,
33 const std::string& key,
34 const UnwrapOptions& unwrap_options,
35 const UnwrapSecureMessageCallback& callback) override;
37 // Returns the corresponding private key for the given |public_key|.
38 std::string GetPrivateKeyForPublicKey(const std::string& public_key);
40 // Sets the next public key to be returned by GenerateKeyPair(). The
41 // corresponding private key will be derived from this public key.
42 void set_next_public_key(const std::string& public_key) {
43 next_public_key_ = public_key;
46 private:
47 std::string next_public_key_;
49 DISALLOW_COPY_AND_ASSIGN(FakeSecureMessageDelegate);
52 } // namespace proximity_auth
54 #endif // COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H