| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_CAST_PRIVATE_DELEGA
TE_H_ |
| 6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_CAST_PRIVATE_DELEGA
TE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "extensions/common/api/networking_private.h" |
| 12 |
| 13 namespace extensions { |
| 14 |
| 15 // Delegate interface that provides crypto methods needed to verify cast |
| 16 // certificates and encrypt data using public key derived from the verified |
| 17 // certificate. |
| 18 // TODO(tbarzic): This is to be used during migration of |
| 19 // networkingPrivate.verify* methods to networking.castPrivate API to share |
| 20 // verification logic shared between networkingPrivate and |
| 21 // networking.castPrivate API. When the deprecated networkingPrivate methods |
| 22 // are removed, this interface should be removed, too. |
| 23 class NetworkingCastPrivateDelegate { |
| 24 public: |
| 25 virtual ~NetworkingCastPrivateDelegate() {} |
| 26 |
| 27 using FailureCallback = base::Callback<void(const std::string& error)>; |
| 28 using VerifiedCallback = base::Callback<void(bool is_valid)>; |
| 29 using DataCallback = base::Callback<void(const std::string& encrypted_data)>; |
| 30 |
| 31 // Verifies that data provided in |properties| authenticates a cast device. |
| 32 virtual void VerifyDestination( |
| 33 const api::networking_private::VerificationProperties& properties, |
| 34 const VerifiedCallback& success_callback, |
| 35 const FailureCallback& failure_callback) = 0; |
| 36 |
| 37 // Verifies that data provided in |properties| authenticates a cast device. |
| 38 // If the device is verified as a cast device, it fetches credentials of the |
| 39 // network identified with |network_guid| and returns the network credentials |
| 40 // encrypted with a public key derived from |properties|. |
| 41 virtual void VerifyAndEncryptCredentials( |
| 42 const std::string& network_guid, |
| 43 const api::networking_private::VerificationProperties& properties, |
| 44 const DataCallback& encrypted_credetials_callback, |
| 45 const FailureCallback& failure_callback) = 0; |
| 46 |
| 47 // Verifies that data provided in |properties| authenticates a cast device. |
| 48 // If the device is verified as a cast device, it returns |data| encrypted |
| 49 // with a public key derived from |properties|. |
| 50 virtual void VerifyAndEncryptData( |
| 51 const std::string& data, |
| 52 const api::networking_private::VerificationProperties& properties, |
| 53 const DataCallback& enrypted_data_callback, |
| 54 const FailureCallback& failure_callback) = 0; |
| 55 }; |
| 56 |
| 57 } // namespace extensions |
| 58 |
| 59 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_CAST_PRIVATE_DEL
EGATE_H_ |
| OLD | NEW |