1 // Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/common/extensions/api/easy_unlock_private.h"
14 namespace extensions {
17 // Wrapper around EasyUnlock dbus client on ChromeOS. On other platforms, the
18 // methods are stubbed out.
19 class EasyUnlockPrivateCryptoDelegate {
21 typedef base::Callback<void(const std::string& data)> DataCallback;
23 typedef base::Callback<void(const std::string& public_key,
24 const std::string& private_key)>
27 virtual ~EasyUnlockPrivateCryptoDelegate() {}
29 // Creates platform specific delegate instance. Non Chrome OS implementations
30 // currently do nothing but invoke callbacks with empty data.
31 static scoped_ptr<EasyUnlockPrivateCryptoDelegate> Create();
33 // See chromeos/dbus/easy_unlock_client.h for info on these methods.
34 virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) = 0;
35 virtual void PerformECDHKeyAgreement(const std::string& private_key,
36 const std::string& public_key,
37 const DataCallback& callback) = 0;
38 virtual void CreateSecureMessage(
39 const std::string& payload,
40 const std::string& secret_key,
41 const std::string& associated_data,
42 const std::string& public_metadata,
43 const std::string& verification_key_id,
44 easy_unlock_private::EncryptionType encryption_type,
45 easy_unlock_private::SignatureType signature_type,
46 const DataCallback& callback) = 0;
47 virtual void UnwrapSecureMessage(
48 const std::string& message,
49 const std::string& secret_key,
50 const std::string& associated_data,
51 easy_unlock_private::EncryptionType encryption_type,
52 easy_unlock_private::SignatureType signature_type,
53 const DataCallback& callback) = 0;
57 } // namespace extensions
59 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_