Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: device/u2f/u2f_device.h

Issue 2821263005: Add U2F request state machines (Closed)
Patch Set: Call Start before adding devices Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/u2f/u2f_apdu_response.h ('k') | device/u2f/u2f_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_U2F_U2F_DEVICE_H_ 5 #ifndef DEVICE_U2F_U2F_DEVICE_H_
6 #define DEVICE_U2F_U2F_DEVICE_H_ 6 #define DEVICE_U2F_U2F_DEVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "u2f_apdu_response.h" 12 #include "u2f_apdu_response.h"
13 #include "u2f_return_code.h"
13 14
14 namespace device { 15 namespace device {
15 16
16 class U2fApduCommand; 17 class U2fApduCommand;
17 18
18 // Device abstraction for an individual U2F device. A U2F device defines the 19 // Device abstraction for an individual U2F device. A U2F device defines the
19 // standardized Register, Sign, and GetVersion methods. 20 // standardized Register, Sign, and GetVersion methods.
20 class U2fDevice { 21 class U2fDevice {
21 public: 22 public:
22 enum class ProtocolVersion { 23 enum class ProtocolVersion {
23 U2F_V2, 24 U2F_V2,
24 UNKNOWN, 25 UNKNOWN,
25 }; 26 };
26 enum class ReturnCode : uint8_t {
27 SUCCESS,
28 FAILURE,
29 INVALID_PARAMS,
30 CONDITIONS_NOT_SATISFIED,
31 };
32 27
33 using MessageCallback = 28 using MessageCallback =
34 base::Callback<void(ReturnCode, std::vector<uint8_t>)>; 29 base::Callback<void(U2fReturnCode, std::vector<uint8_t>)>;
35 using VersionCallback = 30 using VersionCallback =
36 base::Callback<void(bool success, ProtocolVersion version)>; 31 base::Callback<void(bool success, ProtocolVersion version)>;
37 using DeviceCallback = 32 using DeviceCallback =
38 base::Callback<void(bool success, 33 base::Callback<void(bool success,
39 std::unique_ptr<U2fApduResponse> response)>; 34 std::unique_ptr<U2fApduResponse> response)>;
40 using WinkCallback = base::Callback<void()>; 35 using WinkCallback = base::Callback<void()>;
41 36
42 virtual ~U2fDevice(); 37 virtual ~U2fDevice();
43 38
44 // Raw messages parameters are defined by the specification at 39 // Raw messages parameters are defined by the specification at
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 std::unique_ptr<U2fApduResponse> response); 83 std::unique_ptr<U2fApduResponse> response);
89 84
90 base::WeakPtrFactory<U2fDevice> weak_factory_; 85 base::WeakPtrFactory<U2fDevice> weak_factory_;
91 86
92 DISALLOW_COPY_AND_ASSIGN(U2fDevice); 87 DISALLOW_COPY_AND_ASSIGN(U2fDevice);
93 }; 88 };
94 89
95 } // namespace device 90 } // namespace device
96 91
97 #endif // DEVICE_U2F_U2F_DEVICE_H_ 92 #endif // DEVICE_U2F_U2F_DEVICE_H_
OLDNEW
« no previous file with comments | « device/u2f/u2f_apdu_response.h ('k') | device/u2f/u2f_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698