Skip to content

feat(transport): advertise NFC/hybrid and report registration transports #258

@AlfioEmanueleFresta

Description

@AlfioEmanueleFresta

What's wrong

libwebauthn implements four transports (USB/HID, BLE, NFC, caBLE/hybrid) but the public surface advertises only two, and registration responses never report the transport used.

  • Transport and available_transports() in libwebauthn/src/lib.rs expose only Usb and Ble. NFC (transport::nfc, gated behind nfc-backend-pcsc/nfc-backend-libnfc) and caBLE/hybrid (transport::cable) are implemented but omitted.
  • MakeCredentialResponse::to_idl_model() (ops/webauthn/make_credential.rs, ~line 104) always sets transports = Vec::new(), so AuthenticatorAttestationResponseJSON.transports (ops/webauthn/idl/response.rs) is always empty.

Note: the public crate::Transport enum is distinct from the internal transport::Transport marker trait (transport/transport.rs), which already covers HID, BLE, Cable, and Nfc.

Why it matters

Callers reading available_transports() can't discover NFC or hybrid. Per WebAuthn L3 5.2.1.1, RPs persist the response transports and replay them as allowCredentials[].transports hints, so an empty list degrades later authentication UX. The list must be unique and lexicographically sorted, holding only AuthenticatorTransport values (L3 5.8.4: usb, nfc, ble, hybrid, internal, smart-card).

What to do

  • Add NFC and hybrid/caBLE to the public Transport enum (lib.rs).
  • Update available_transports() to report compiled-in transports. NFC only appears under an nfc-backend-* feature. caBLE is always compiled (runtime depends on a BLE adapter, cable::is_available()), so decide whether to report compiled-in support or consult is_available().
  • Expose the active transport from Channel (transport/channel.rs) and pass it into to_idl_model for the registration response conversion.
  • Populate AuthenticatorAttestationResponseJSON.transports from the active transport, mapping via Ctap2Transport (proto/ctap2/model.rs), which already serializes the correct lowercase tokens.
  • Ensure the emitted list is deduplicated, lexicographically sorted, and free of unknown values (L3 5.2.1.1). Leave it empty when the transport is unknown.
  • Cover both the FIDO2 and U2F-downgrade registration paths.
  • Update test_response_to_idl_model in make_credential.rs, which asserts an empty list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions