Skip to content

refactor(error): per-transport TransportError and generic ceremony Error#297

Open
AlfioEmanueleFresta wants to merge 1 commit into
masterfrom
refactor/transport-error-types
Open

refactor(error): per-transport TransportError and generic ceremony Error#297
AlfioEmanueleFresta wants to merge 1 commit into
masterfrom
refactor/transport-error-types

Conversation

@AlfioEmanueleFresta

@AlfioEmanueleFresta AlfioEmanueleFresta commented Jun 20, 2026

Copy link
Copy Markdown
Member

Today every transport failure collapses into one catch-all transport error, and the underlying cause from the OS, Bluetooth, USB, or tunnel layer is discarded. That makes diagnostics weak and leaves the error surface unsettled ahead of a 1.0 freeze.

This reworks the error model so the transport error type is known at compile time and the cause is preserved.

Changes

  • The Channel trait gains an associated TransportError type. Each transport (HID, BLE, NFC, hybrid) has its own concrete error enum that carries the native cause instead of flattening it away.
  • The WebAuthn ceremony error becomes generic over the channel's error type. Running a ceremony on a concrete channel yields a concrete, matchable error with no boxing and no downcasting.
  • The CTAP protocol error variant stays transport independent, so code that matches on it is unaffected.
  • Request preparation keeps its own validation error types. A preparation error is a distinct phase and is not representable as a ceremony error.

The ceremony error:

pub enum Error<TE> {
    Ctap(CtapError),
    Transport(TE),
    Platform(PlatformError),
}

Closes #130.

@AlfioEmanueleFresta AlfioEmanueleFresta force-pushed the refactor/transport-error-types branch from 5b0aea6 to a4fd9a4 Compare June 20, 2026 22:15
@AlfioEmanueleFresta AlfioEmanueleFresta marked this pull request as ready for review June 21, 2026 14:28
@AlfioEmanueleFresta AlfioEmanueleFresta requested review from iinuwa and msirringhaus and removed request for iinuwa June 22, 2026 08:40
@AlfioEmanueleFresta AlfioEmanueleFresta force-pushed the refactor/transport-error-types branch from a4fd9a4 to 14afd71 Compare June 22, 2026 09:54
@AlfioEmanueleFresta AlfioEmanueleFresta changed the title refactor(error): per-transport error types and generic WebAuthnError refactor(error): per-transport TransportError and generic ceremony Error Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transport-specific associated error types

1 participant