1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef DEVICE_FIDO_CTAP_EMPTY_AUTHENTICATOR_REQUEST_H_ 6 #define DEVICE_FIDO_CTAP_EMPTY_AUTHENTICATOR_REQUEST_H_ 7 8 #include <stdint.h> 9 10 #include <string> 11 #include <vector> 12 13 #include "base/component_export.h" 14 #include "device/fido/fido_constants.h" 15 16 namespace device { 17 18 namespace internal { 19 20 // Represents CTAP requests with empty parameters, including 21 // AuthenticatorGetInfo, AuthenticatorCancel, AuthenticatorReset and 22 // AuthenticatorGetNextAssertion commands. COMPONENT_EXPORT(DEVICE_FIDO)23class COMPONENT_EXPORT(DEVICE_FIDO) CtapEmptyAuthenticatorRequest { 24 public: 25 CtapRequestCommand cmd() const { return cmd_; } 26 std::vector<uint8_t> Serialize() const; 27 28 protected: 29 explicit CtapEmptyAuthenticatorRequest(CtapRequestCommand cmd) : cmd_(cmd) {} 30 31 private: 32 CtapRequestCommand cmd_; 33 }; 34 35 } // namespace internal 36 COMPONENT_EXPORT(DEVICE_FIDO)37class COMPONENT_EXPORT(DEVICE_FIDO) AuthenticatorGetNextAssertionRequest 38 : public internal::CtapEmptyAuthenticatorRequest { 39 public: 40 AuthenticatorGetNextAssertionRequest() 41 : CtapEmptyAuthenticatorRequest( 42 CtapRequestCommand::kAuthenticatorGetNextAssertion) {} 43 }; 44 COMPONENT_EXPORT(DEVICE_FIDO)45class COMPONENT_EXPORT(DEVICE_FIDO) AuthenticatorGetInfoRequest 46 : public internal::CtapEmptyAuthenticatorRequest { 47 public: 48 AuthenticatorGetInfoRequest() 49 : CtapEmptyAuthenticatorRequest( 50 CtapRequestCommand::kAuthenticatorGetInfo) {} 51 }; 52 COMPONENT_EXPORT(DEVICE_FIDO)53class COMPONENT_EXPORT(DEVICE_FIDO) AuthenticatorResetRequest 54 : public internal::CtapEmptyAuthenticatorRequest { 55 public: 56 AuthenticatorResetRequest() 57 : CtapEmptyAuthenticatorRequest(CtapRequestCommand::kAuthenticatorReset) { 58 } 59 }; 60 61 } // namespace device 62 63 #endif // DEVICE_FIDO_CTAP_EMPTY_AUTHENTICATOR_REQUEST_H_ 64