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

Unified Diff: device/u2f/u2f_device.h

Issue 2721223002: Add support for U2fHidDevice interaction (Closed)
Patch Set: Use MockHidConnection to fail writes in unittest Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/u2f/DEPS ('k') | device/u2f/u2f_device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/u2f/u2f_device.h
diff --git a/device/u2f/u2f_device.h b/device/u2f/u2f_device.h
index f10c5929fe6fa53cae8ac6adfe90b4110893bcd5..20994b757426d0dfa46c1e53c128182c4582ba1d 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 GetId() = 0;
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_;
« no previous file with comments | « device/u2f/DEPS ('k') | device/u2f/u2f_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698