Update mojo sdk to rev c02a28868825edfa57ab77947b8cb15e741c5598
[chromium-blink-merge.git] / components / proximity_auth / cryptauth / cryptauth_enroller.h
blob88bfd29acaf4ad27d2bd92cd0288f46b81d8bd29
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_CRYPTAUTH_ENROLLER_H
6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_H
8 #include <string>
10 #include "base/callback_forward.h"
11 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
13 namespace proximity_auth {
15 // Interface for enrolling a device with CryptAuth.
16 class CryptAuthEnroller {
17 public:
18 virtual ~CryptAuthEnroller() {}
20 // Enrolls the device:
21 // |user_public_key|: The user's persistent public key identifying the device.
22 // |user_private_key|: The corresponding private key to |user_public_key|.
23 // |device_info|: Contains information about the local device. Note that the
24 // enroller may change fields in this proto before it is finally uploaded.
25 // |invocation_reason|: The reason why the enrollment occurred.
26 // |callback|: Called will be called with true if the enrollment
27 // succeeds and false otherwise.
28 typedef base::Callback<void(bool)> EnrollmentFinishedCallback;
29 virtual void Enroll(const std::string& user_public_key,
30 const std::string& user_private_key,
31 const cryptauth::GcmDeviceInfo& device_info,
32 cryptauth::InvocationReason invocation_reason,
33 const EnrollmentFinishedCallback& callback) = 0;
36 // Interface for creating CryptAuthEnroller instances.
37 class CryptAuthEnrollerFactory {
38 public:
39 virtual ~CryptAuthEnrollerFactory() {}
41 virtual scoped_ptr<CryptAuthEnroller> CreateInstance() = 0;
44 } // namespace proximity_auth
46 #endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_H