Chromium Code Reviews| Index: device/u2f/u2f_sign.h |
| diff --git a/device/u2f/u2f_sign.h b/device/u2f/u2f_sign.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..30991281aaf6a2f7edbcefe6a9d931c9f5d6cecf |
| --- /dev/null |
| +++ b/device/u2f/u2f_sign.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DEVICE_U2F_U2F_SIGN_H_ |
| +#define DEVICE_U2F_U2F_SIGN_H_ |
| + |
| +#include <vector> |
| + |
| +#include "u2f_request.h" |
| + |
| +namespace device { |
| + |
| +class U2fSign : public U2fRequest { |
| + public: |
| + U2fSign(std::vector<std::vector<uint8_t>> registered_keys, |
| + std::vector<uint8_t> challenge_hash, |
| + std::vector<uint8_t> app_param, |
|
Reilly Grant (use Gerrit)
2017/04/21 17:19:17
Same comments here about passing vectors by value.
Casey Piper
2017/04/21 18:42:26
Done.
|
| + const ResponseCallback& cb); |
| + ~U2fSign() override; |
| + |
| + static std::unique_ptr<U2fRequest> TrySign( |
| + std::vector<std::vector<uint8_t>> registered_keys, |
| + std::vector<uint8_t> challenge_hash, |
| + std::vector<uint8_t> app_param, |
| + const ResponseCallback& cb); |
| + |
| + private: |
| + void TryDevice() override; |
| + void OnTryDevice(std::vector<std::vector<uint8_t>>::const_iterator, |
| + U2fDevice::ReturnCode, |
| + std::vector<uint8_t>); |
| + |
| + std::vector<std::vector<uint8_t>> registered_keys_; |
|
Reilly Grant (use Gerrit)
2017/04/21 17:19:17
Make this vector const so that it is clear that it
Casey Piper
2017/04/21 18:42:26
Done.
|
| + std::vector<uint8_t> challenge_hash_; |
| + std::vector<uint8_t> app_param_; |
| + const std::vector<uint8_t> kBogusAppParam = { |
| + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, |
| + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, |
| + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}; |
| + const std::vector<uint8_t> kBogusChallenge = { |
| + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, |
| + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, |
| + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42}; |
| + |
| + base::WeakPtrFactory<U2fSign> weak_factory_; |
| +}; |
| + |
| +} // namespace device |
| + |
| +#endif // DEVICE_U2F_U2F_SIGN_H_ |