fido_transport_protocol.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_FIDO_TRANSPORT_PROTOCOL_H_
  5. #define DEVICE_FIDO_FIDO_TRANSPORT_PROTOCOL_H_
  6. #include "base/component_export.h"
  7. #include "base/strings/string_piece.h"
  8. #include "device/fido/fido_types.h"
  9. #include "third_party/abseil-cpp/absl/types/optional.h"
  10. namespace device {
  11. // This enum represents the transport protocols over which Fido WebAuthN API is
  12. // currently supported.
  13. // This enum is used for UMA histograms and the values should not be
  14. // reassigned. New transports added should be reflected in the
  15. // WebAuthenticationFidoTransport enum.
  16. enum class FidoTransportProtocol : uint8_t {
  17. kUsbHumanInterfaceDevice = 0,
  18. kNearFieldCommunication = 1,
  19. kBluetoothLowEnergy = 2,
  20. kHybrid = 3,
  21. kInternal = 4,
  22. kAndroidAccessory = 5,
  23. kMaxValue = kAndroidAccessory,
  24. };
  25. // String representation of above FidoTransportProtocol enum.
  26. extern const char kUsbHumanInterfaceDevice[];
  27. extern const char kNearFieldCommunication[];
  28. extern const char kBluetoothLowEnergy[];
  29. extern const char kHybrid[];
  30. extern const char kInternal[];
  31. COMPONENT_EXPORT(DEVICE_FIDO)
  32. absl::optional<FidoTransportProtocol> ConvertToFidoTransportProtocol(
  33. base::StringPiece protocol);
  34. COMPONENT_EXPORT(DEVICE_FIDO)
  35. base::StringPiece ToString(FidoTransportProtocol protocol);
  36. COMPONENT_EXPORT(DEVICE_FIDO)
  37. AuthenticatorAttachment AuthenticatorAttachmentFromTransport(
  38. FidoTransportProtocol transport);
  39. } // namespace device
  40. #endif // DEVICE_FIDO_FIDO_TRANSPORT_PROTOCOL_H_