Phase 2.5: extract SecretStore protocol seam - #44
Merged
Conversation
First step of the platform-agnostic core extraction (per WINDOWS_PORT.md). The secret-handling logic in AppState referenced the concrete KeychainStore at three sites with no seam; this introduces a SecretStore protocol and injects it. - SecretStore protocol (read/save; empty-string save = delete) + InMemorySecretStore, both Foundation-only and added to the OpenWhispCore SwiftPM target so the contract is exercised by `swift test`. - KeychainStore: enum of statics -> final class conforming to SecretStore. The Apple-only Security (SecItem*) calls stay isolated here; AppState no longer names it except as the default injected value. - AppState gains `let secretStore: SecretStore`, injected via `init(secretStore:) = KeychainStore()`. The API-key didSet and the one-time legacy-key migration now go through it. Behavior unchanged on macOS. - Tests: 6 SecretStoreTests covering round-trip, overwrite, empty-delete, key independence, seeding. 92 -> 98 tests. - ROADMAP: mark SecretStore done under Phase 2.5. A Windows/Linux port now supplies its own SecretStore (Credential Manager / DPAPI / libsecret) without touching call sites. swift test 98/98; ./build.sh clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step of the platform-agnostic core extraction (WINDOWS_PORT.md).
AppStatereferenced the concreteKeychainStoreat three sites with no seam — this introduces aSecretStoreprotocol and dependency-injects it.Changes
SecretStoreprotocol (read/save; empty-string save = delete) +InMemorySecretStore— both Foundation-only, added to theOpenWhispCoreSwiftPM target so the contract is unit-tested.KeychainStore:enumof statics →final classconforming toSecretStore. The Apple-onlySecurity(SecItem*) calls stay isolated here.AppStategainslet secretStore: SecretStore, injected viainit(secretStore:) = KeychainStore(). The API-keydidSetand the legacy-key migration now route through it. No behavior change on macOS — the default is still the Keychain.SecretStoreTests(round-trip, overwrite, empty-delete, key independence, seeding). 92 → 98.SecretStoremarked done under Phase 2.5.A Windows/Linux port now supplies its own backend (Credential Manager / DPAPI / libsecret) without touching call sites.
swift test98/98 ·./build.shclean.🤖 Generated with Claude Code