Skip to content

Refactoring for ctap::storage - #847

Open
kaczmarczyck wants to merge 1 commit into
google:developfrom
kaczmarczyck:cleanup-storage-stubs
Open

kaczmarczyck wants to merge 1 commit into
google:developfrom
kaczmarczyck:cleanup-storage-stubs

Conversation

@kaczmarczyck

Copy link
Copy Markdown
Collaborator

Before the Persist API existed, we had storage.rs. We kept the calls to not have to update.
Lately though, the unrefactored code has confused contributors with less understanding of the codebase (aka AI agents).
Therefore, we refactor it now to make the correct function to call more discoverable.
Generally, this PR does not change behavior, it is purely shifting around code.

Since we now don't have the storage layer to have retry-centric naming, we rename the Persist functions to have CTAP naming. The implementation still counts failures. Also key names were outdated.
Split ctap::storage into its owning CTAP modules:

  • keys.rs: rename FRIENDLY_NAMES -> TEMPLATE_INFOS, UV_RETRIES ->
    UV_FAILS, PIN_RETRIES -> PIN_FAILS (numeric IDs unchanged), and order
    AAGUID (3) before ATTESTATION_ID (4).
  • persist.rs: rename incr_pin_fails -> decr_pin_retries, incr_uv_fails -> decr_uv_retries, and decr_uv_fails -> incr_uv_retries (matching existing doc comments and reset_*_retries).
  • Remove pure stub wrappers and dissolve ctap/storage.rs into:
    • ctap/credential_store.rs (resident credential CRUD and iteration)
    • ctap/client_pin.rs (pin_retries)
    • ctap/fingerprint.rs (uv_retries)
    • ctap/config_command.rs (toggle_always_uv, set_min_pin_length_rp_ids)
    • ctap/mod.rs (init, has_user_verification, min_pin_length, min_pin_length_rp_ids, enterprise_attestation, has_always_uv)

Use retry-centric names on Persist mutators while keeping fail counts in
storage, rename drifted keys in api::persist::keys, and split
ctap::storage into its owning CTAP modules:

- keys.rs: rename FRIENDLY_NAMES -> TEMPLATE_INFOS, UV_RETRIES ->
  UV_FAILS, PIN_RETRIES -> PIN_FAILS (numeric IDs unchanged), and order
  AAGUID (3) before ATTESTATION_ID (4).
- persist.rs: rename incr_pin_fails -> decr_pin_retries, incr_uv_fails
  -> decr_uv_retries, and decr_uv_fails -> incr_uv_retries (matching
  existing doc comments and reset_*_retries).
- Remove pure stub wrappers and dissolve ctap/storage.rs into:
  - ctap/credential_store.rs (resident credential CRUD and iteration)
  - ctap/client_pin.rs (pin_retries)
  - ctap/fingerprint.rs (uv_retries)
  - ctap/config_command.rs (toggle_always_uv, set_min_pin_length_rp_ids,
    keeping the entire module behind #[cfg(feature = "config_command")])
  - ctap/mod.rs (init, has_user_verification, min_pin_length,
    min_pin_length_rp_ids, enterprise_attestation, has_always_uv)
@kaczmarczyck
kaczmarczyck requested a review from ia0 November 23, 2026 12:23
@kaczmarczyck kaczmarczyck self-assigned this Nov 23, 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.

1 participant