Chromium Code Reviews| Index: device/u2f/u2f_device.h |
| diff --git a/device/u2f/u2f_device.h b/device/u2f/u2f_device.h |
| index f10c5929fe6fa53cae8ac6adfe90b4110893bcd5..a7ff3154b8f88b7ed5045a49099d4286ede82836 100644 |
| --- a/device/u2f/u2f_device.h |
| +++ b/device/u2f/u2f_device.h |
| @@ -23,7 +23,12 @@ class U2fDevice { |
| U2F_V2, |
| UNKNOWN, |
| }; |
| - enum class ReturnCode { SUCCESS, HW_FAILURE, INVALID_PARAMS }; |
| + enum class ReturnCode : uint8_t { |
| + SUCCESS, |
| + FAILURE, |
| + INVALID_PARAMS, |
| + CONDITIONS_NOT_SATISFIED, |
| + }; |
| using MessageCallback = |
| base::Callback<void(ReturnCode, std::vector<uint8_t>)>; |
| @@ -32,13 +37,13 @@ class U2fDevice { |
| using DeviceCallback = |
| base::Callback<void(bool success, |
| scoped_refptr<U2fApduResponse> response)>; |
| + using WinkCallback = base::Callback<void()>; |
| ~U2fDevice(); |
| // Raw messages parameters are defined by the specification at |
| // https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-raw-message-formats.html |
| void Register(const std::vector<uint8_t>& appid_digest, |
| - const ProtocolVersion version, |
| const std::vector<uint8_t>& challenge_digest, |
| const MessageCallback& callback); |
| void Version(const VersionCallback& callback); |
| @@ -46,8 +51,14 @@ class U2fDevice { |
| const std::vector<uint8_t>& challenge_digest, |
| const std::vector<uint8_t>& key_handle, |
| const MessageCallback& callback); |
| + virtual void TryWink(const WinkCallback& callback) = 0; |
| + virtual std::string Id() = 0; |
|
Reilly Grant (use Gerrit)
2017/03/06 20:49:23
GetId
Casey Piper
2017/03/07 00:53:27
Done.
|
| protected: |
| + static constexpr uint8_t kWinkCapability = 0x01; |
| + static constexpr uint8_t kLockCapability = 0x02; |
| + static constexpr uint32_t kBroadcastChannel = 0xffffffff; |
| + |
| U2fDevice(); |
| // Pure virtual function defined by each device type, implementing |
| @@ -55,8 +66,10 @@ class U2fDevice { |
| virtual void DeviceTransact(scoped_refptr<U2fApduCommand> command, |
| const DeviceCallback& callback) = 0; |
| + uint32_t channel_id_; |
| + uint8_t capabilities_; |
| + |
| private: |
| - // TODO Callback functions for device calls |
| void OnRegisterComplete(const MessageCallback& callback, |
| bool success, |
| scoped_refptr<U2fApduResponse> register_response); |
| @@ -70,6 +83,9 @@ class U2fDevice { |
| const VersionCallback& callback, |
| bool success, |
| scoped_refptr<U2fApduResponse> legacy_version_response); |
| + void OnWink(const WinkCallback& callback, |
| + bool success, |
| + scoped_refptr<U2fApduResponse> response); |
| base::WeakPtrFactory<U2fDevice> weak_factory_; |