Skip to content

refactor(secureStorage): replace isSensitive param with options - #1067

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
shogun444:refactor/964-secure-storage-item-options
Aug 27, 2026
Merged

refactor(secureStorage): replace isSensitive param with options#1067
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
shogun444:refactor/964-secure-storage-item-options

Conversation

@shogun444

Copy link
Copy Markdown
Contributor

Linked Issue

Closes #964

Description

What changed?

  • Removed the unused isSensitive parameter from setItem.
  • Replaced positional boolean flags in getItem with a typed options object: GetItemOptions { tag?: string; throwOnMissing?: boolean } (throwOnMissing: true by default).
  • Removed the unused SENSITIVE_KEYS set and STORAGE_SENSITIVE_KEYS export.
  • Updated all call sites across src/services/secureStorage.ts to use explicit named options.
  • Updated unit tests in src/__tests__/services/secureStorage.test.ts to reflect the removed export.

Why was it changed?
The isSensitive parameter was misleading: it was completely ignored in setItem, only toggled swallow vs. rethrow behavior in getItem, and SENSITIVE_KEYS was never consulted. Replacing it with explicit named options makes error-handling behavior clear and intentional at the call site.

Type of Change

  • Refactor / Code cleanup (non-breaking change which cleans up dead code/APIs)
  • Bug fix (resolves confusing/dead parameter API signature)
  • New feature
  • Breaking change

Test Evidence

Local Verification

  • Code formatting passes (npx prettier --check on modified files)
  • Call sites refactored and aligned with new interface
npx prettier --check src/services/secureStorage.ts src/__tests__/services/secureStorage.test.ts
All matched files are formatted correctly.

Additional Notes for Reviewer

  • Choice on SENSITIVE_KEYS: Per the issue specification, SENSITIVE_KEYS was deleted rather than wired in, as the explicit throwOnMissing option provides clearer call-site control without implicit key lookup magic.
  • Unchanged Isolation Tests: tests/secureStorage.isolation.test.ts did not require changes as it does not reference the modified private helpers or deleted exports.

Remove the dead isSensitive parameter from setItem, replace the positional
boolean in getItem with an explicit { tag, throwOnMissing } options object,
and delete the unused SENSITIVE_KEYS set and its STORAGE_SENSITIVE_KEYS
export. Reads that expect a missing value now opt in via throwOnMissing:
false instead of a misleading per-value boolean.

Fixes rinafcode#964
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@shogun444 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit cabd8ed into rinafcode:main Aug 27, 2026
2 of 12 checks passed
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.

[Bug] setItem / getItem accept an isSensitive parameter that only affects error handling, never storage

2 participants