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_AUTHENTICATOR_GET_INFO_RESPONSE_H_
6 #define DEVICE_FIDO_AUTHENTICATOR_GET_INFO_RESPONSE_H_
7 
8 #include <stdint.h>
9 
10 #include <string>
11 #include <vector>
12 
13 #include "base/component_export.h"
14 #include "base/containers/flat_set.h"
15 #include "base/macros.h"
16 #include "base/optional.h"
17 #include "device/fido/authenticator_supported_options.h"
18 #include "device/fido/fido_constants.h"
19 
20 namespace device {
21 
22 // Authenticator response for AuthenticatorGetInfo request that encapsulates
23 // versions, options, AAGUID(Authenticator Attestation GUID), other
24 // authenticator device information.
25 // https://fidoalliance.org/specs/fido-v2.0-rd-20170927/fido-client-to-authenticator-protocol-v2.0-rd-20170927.html#authenticatorGetInfo
COMPONENT_EXPORT(DEVICE_FIDO)26 struct COMPONENT_EXPORT(DEVICE_FIDO) AuthenticatorGetInfoResponse {
27  public:
28   AuthenticatorGetInfoResponse(base::flat_set<ProtocolVersion> versions,
29                                base::span<const uint8_t, kAaguidLength> aaguid);
30   AuthenticatorGetInfoResponse(AuthenticatorGetInfoResponse&& that);
31   AuthenticatorGetInfoResponse& operator=(AuthenticatorGetInfoResponse&& other);
32   ~AuthenticatorGetInfoResponse();
33 
34   static std::vector<uint8_t> EncodeToCBOR(
35       const AuthenticatorGetInfoResponse& response);
36 
37   base::flat_set<ProtocolVersion> versions;
38   std::array<uint8_t, kAaguidLength> aaguid;
39   base::Optional<uint32_t> max_msg_size;
40   base::Optional<uint32_t> max_credential_count_in_list;
41   base::Optional<uint32_t> max_credential_id_length;
42   base::Optional<std::vector<uint8_t>> pin_protocols;
43   base::Optional<std::vector<std::string>> extensions;
44   AuthenticatorSupportedOptions options;
45 
46  private:
47   DISALLOW_COPY_AND_ASSIGN(AuthenticatorGetInfoResponse);
48 };
49 
50 }  // namespace device
51 
52 #endif  // DEVICE_FIDO_AUTHENTICATOR_GET_INFO_RESPONSE_H_
53