Skip to content

feat: hash API keys used internally for caching#635

Open
joshmyers-medibank wants to merge 1 commit into
optimizely:masterfrom
joshmyers-medibank:joshmyers-medibank/obfuscate-api-keys
Open

feat: hash API keys used internally for caching#635
joshmyers-medibank wants to merge 1 commit into
optimizely:masterfrom
joshmyers-medibank:joshmyers-medibank/obfuscate-api-keys

Conversation

@joshmyers-medibank
Copy link
Copy Markdown

@joshmyers-medibank joshmyers-medibank commented May 22, 2026

Summary

  • Hash sdkKey-derived persistence identifiers for cached datafiles, persisted Last-Modified metadata, and ODP event queue storage.
  • Update storage test helpers and add coverage for hashed persistence names, legacy raw-key cache misses, and hashed ODP queue persistence.
  • Fix the datafile download session cleanup ordering so the affected tests complete without leaking mock sessions.

This aligns the Swift SDK with issue #634 by avoiding raw API key persistence in on-device cache names and UserDefaults keys, while still using the raw key where it is required for network requests. Legacy raw-named cache entries are intentionally not migrated, so existing persisted cache state is treated as a one-time cache miss after upgrade.

Test plan

  • xcodebuild test -quiet -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' -only-testing:OptimizelyTests-Common-iOS/DatafileHandlerTests -only-testing:OptimizelyTests-MultiClients-iOS/DatafileHandlerTests_MultiClients -only-testing:OptimizelyTests-APIs-iOS/OptimizelyClientTests_DatafileHandler -only-testing:OptimizelyTests-Common-iOS/OdpEventManagerTests
  • xcodebuild test -quiet -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=latest' -only-testing:OptimizelyTests-Common-tvOS/DatafileHandlerTests -only-testing:OptimizelyTests-Common-tvOS/OdpEventManagerTests
  • Verified the new coverage for hashed datafile cache naming, hashed Last-Modified storage, legacy raw-key cache behavior, and hashed ODP event queue persistence.

Issues

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