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

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

Issue 2839043002: Pass u2f message callback vector as a const reference (Closed)
Patch Set: Change response callback to const ref 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_request_unittest.cc ('k') | device/u2f/u2f_sign.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_SIGN_H_ 5 #ifndef DEVICE_U2F_U2F_SIGN_H_
6 #define DEVICE_U2F_U2F_SIGN_H_ 6 #define DEVICE_U2F_U2F_SIGN_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "u2f_request.h" 10 #include "u2f_request.h"
11 11
12 namespace device { 12 namespace device {
13 13
14 class U2fSign : public U2fRequest { 14 class U2fSign : public U2fRequest {
15 public: 15 public:
16 U2fSign(const std::vector<std::vector<uint8_t>>& registered_keys, 16 U2fSign(const std::vector<std::vector<uint8_t>>& registered_keys,
17 const std::vector<uint8_t>& challenge_hash, 17 const std::vector<uint8_t>& challenge_hash,
18 const std::vector<uint8_t>& app_param, 18 const std::vector<uint8_t>& app_param,
19 const ResponseCallback& cb); 19 const ResponseCallback& cb);
20 ~U2fSign() override; 20 ~U2fSign() override;
21 21
22 static std::unique_ptr<U2fRequest> TrySign( 22 static std::unique_ptr<U2fRequest> TrySign(
23 const std::vector<std::vector<uint8_t>>& registered_keys, 23 const std::vector<std::vector<uint8_t>>& registered_keys,
24 const std::vector<uint8_t>& challenge_hash, 24 const std::vector<uint8_t>& challenge_hash,
25 const std::vector<uint8_t>& app_param, 25 const std::vector<uint8_t>& app_param,
26 const ResponseCallback& cb); 26 const ResponseCallback& cb);
27 27
28 private: 28 private:
29 void TryDevice() override; 29 void TryDevice() override;
30 void OnTryDevice(std::vector<std::vector<uint8_t>>::const_iterator, 30 void OnTryDevice(std::vector<std::vector<uint8_t>>::const_iterator it,
31 U2fReturnCode, 31 U2fReturnCode return_code,
32 std::vector<uint8_t>); 32 const std::vector<uint8_t>& response_data);
33 33
34 const std::vector<std::vector<uint8_t>> registered_keys_; 34 const std::vector<std::vector<uint8_t>> registered_keys_;
35 std::vector<uint8_t> challenge_hash_; 35 std::vector<uint8_t> challenge_hash_;
36 std::vector<uint8_t> app_param_; 36 std::vector<uint8_t> app_param_;
37 const std::vector<uint8_t> kBogusAppParam = { 37 const std::vector<uint8_t> kBogusAppParam = {
38 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 38 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
39 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 39 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
40 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}; 40 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41};
41 const std::vector<uint8_t> kBogusChallenge = { 41 const std::vector<uint8_t> kBogusChallenge = {
42 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 42 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
43 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 43 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
44 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; 44 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42};
45 45
46 base::WeakPtrFactory<U2fSign> weak_factory_; 46 base::WeakPtrFactory<U2fSign> weak_factory_;
47 }; 47 };
48 48
49 } // namespace device 49 } // namespace device
50 50
51 #endif // DEVICE_U2F_U2F_SIGN_H_ 51 #endif // DEVICE_U2F_U2F_SIGN_H_
OLDNEW
« no previous file with comments | « device/u2f/u2f_request_unittest.cc ('k') | device/u2f/u2f_sign.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698