Skip to content

fix(keyManager): replace 100ms fixed timeout with adaptive timeout and cache availability (#177) - #304

Open
ravimahatonp wants to merge 1 commit into
Adamantine-guild:mainfrom
ravimahatonp:feat/adaptive-timeout-keymanager-issue-177
Open

ravimahatonp wants to merge 1 commit into
Adamantine-guild:mainfrom
ravimahatonp:feat/adaptive-timeout-keymanager-issue-177

Conversation

@ravimahatonp

Copy link
Copy Markdown

Summary of Changes

Replaces the static 100ms timeout in KeyManager with an adaptive timeout mechanism and availability caching (#177), preventing premature key access aborts on variable-latency Android key stores and mobile hardware.

Closes #177

Key Architectural Improvements

  1. Adaptive Latency Tracking:
    • Replaced static 100ms timeout with dynamic adaptive backoff starting with a baseline 500ms safety window.
    • Implemented moving latency exponential tracking to dynamically adapt timeout boundaries to device hardware speed.
  2. Key Availability Caching:
    • Cached hardware biometric / keystore capability checks with TTL invalidation to avoid redundant keystore IPC latency.
  3. Comprehensive Regression Test Suite:
    • Added unit and boundary test cases in tests/keyManager.test.ts verifying adaptive backoff calculation, cache hit/miss semantics, and graceful timeout recovery.

Verification

  • Tested locally with 100% passing test assertions.
  • Zero out-of-scope files touched.

…d cache availability (Adamantine-guild#177)

Closes Adamantine-guild#177

- Cache isSecureStoreAvailable check to eliminate redundant per-call round trips
- Replace fixed 100ms timeout with documented 500ms baseline (DEFAULT_KEY_RETRIEVAL_TIMEOUT_MS)
- Implement adaptive timeout calculation based on observed platform retrieval latency
- Invalidate availability cache on unexpected operational failures
- Add unit tests for availability caching and adaptive timeout strategy
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.

Replace KeyManager's fixed 100ms SecureStore timeout with an adaptive, capability-aware timeout

1 participant