authenticator_get_info_response.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #ifndef DEVICE_FIDO_AUTHENTICATOR_GET_INFO_RESPONSE_H_
  5. #define DEVICE_FIDO_AUTHENTICATOR_GET_INFO_RESPONSE_H_
  6. #include <stdint.h>
  7. #include <string>
  8. #include <vector>
  9. #include "base/component_export.h"
  10. #include "base/containers/flat_set.h"
  11. #include "device/fido/authenticator_supported_options.h"
  12. #include "device/fido/fido_constants.h"
  13. #include "device/fido/fido_transport_protocol.h"
  14. #include "device/fido/fido_types.h"
  15. #include "third_party/abseil-cpp/absl/types/optional.h"
  16. namespace device {
  17. // Authenticator response for AuthenticatorGetInfo request that encapsulates
  18. // versions, options, AAGUID(Authenticator Attestation GUID), other
  19. // authenticator device information.
  20. // https://fidoalliance.org/specs/fido-v2.0-rd-20170927/fido-client-to-authenticator-protocol-v2.0-rd-20170927.html#authenticatorGetInfo
  21. struct COMPONENT_EXPORT(DEVICE_FIDO) AuthenticatorGetInfoResponse {
  22. public:
  23. AuthenticatorGetInfoResponse(base::flat_set<ProtocolVersion> versions,
  24. base::flat_set<Ctap2Version> in_ctap2_version,
  25. base::span<const uint8_t, kAaguidLength> aaguid);
  26. AuthenticatorGetInfoResponse(AuthenticatorGetInfoResponse&& that);
  27. AuthenticatorGetInfoResponse& operator=(AuthenticatorGetInfoResponse&& other);
  28. AuthenticatorGetInfoResponse(const AuthenticatorGetInfoResponse&) = delete;
  29. AuthenticatorGetInfoResponse& operator=(const AuthenticatorGetInfoResponse&) =
  30. delete;
  31. ~AuthenticatorGetInfoResponse();
  32. static std::vector<uint8_t> EncodeToCBOR(
  33. const AuthenticatorGetInfoResponse& response);
  34. // Returns true if there is a Ctap2Version in |ctap2_versions| greater or
  35. // equal to |ctap2_version|.
  36. bool SupportsAtLeast(Ctap2Version ctap2_version) const;
  37. base::flat_set<ProtocolVersion> versions;
  38. base::flat_set<Ctap2Version> ctap2_versions;
  39. std::array<uint8_t, kAaguidLength> aaguid;
  40. absl::optional<uint32_t> max_msg_size;
  41. absl::optional<uint32_t> max_credential_count_in_list;
  42. absl::optional<uint32_t> max_credential_id_length;
  43. absl::optional<base::flat_set<PINUVAuthProtocol>> pin_protocols;
  44. absl::optional<std::vector<std::string>> extensions;
  45. absl::optional<std::vector<int32_t>> algorithms;
  46. absl::optional<uint32_t> max_serialized_large_blob_array;
  47. absl::optional<uint32_t> remaining_discoverable_credentials;
  48. absl::optional<bool> force_pin_change;
  49. absl::optional<uint32_t> min_pin_length;
  50. absl::optional<base::flat_set<FidoTransportProtocol>> transports;
  51. // max_cred_blob_length is the maximum size credBlob that the authenticator
  52. // supports per credential, or nullopt if credBlob is not supported. If
  53. // present, this value will be >= 32.
  54. absl::optional<uint32_t> max_cred_blob_length;
  55. AuthenticatorSupportedOptions options;
  56. };
  57. } // namespace device
  58. #endif // DEVICE_FIDO_AUTHENTICATOR_GET_INFO_RESPONSE_H_