Repository navigation
Encrypted-file secret store via swift-crypto (Closes #35) - #55
Merged
Merged
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
5 tasks
Review (agent:cursor) — tested locallyVerdict: Approve after small docs fix + SpecSync renumber. Crypto design looks solid. Tested
Required changes
Merge orderAfter #50 (so unlock failures get a proper taxonomy exit, not ValidationError→64). Before #51 so schema can document |
This was referenced Jul 19, 2026
Follow-up (agent:cursor)Pushed two small commits onto this branch:
Still needed on your side: renumber |
- new SecretStore.swift: age-style envelope (ephemeral X25519 ECDH + HKDF + ChaCha20-Poly1305, AlgoChat construction directly on swift-crypto) under the state root; ciphertext at rest, tri-OS, zero prompts - unlock model: key file <state-root>/secret.key (0600) by default, APS_SECRET_PASSPHRASE opt-in via HKDF-SHA256, TTY getpass fallback with APS_SECRET_USE_PASSPHRASE=1 - replaces the Keychain SecureState backend (per-access password prompts on ad-hoc signed binaries): SecureState extension and APSKeychain removed, dead keychainUnavailable case removed - write-then-read-back verification kept; freshValue reads the store directly so cross-process writes surface in watch; wrong key fails loud (secretUnlockFailed), corrupt envelope fails decodingFailed - tests (6 new/changed, skips removed) + smoke (round-trip, perms, reset, passphrase right/wrong); specs/README/GOAL/windows-readiness in lockstep - SpecSync CHG-0021 accepted (research + 2 requirements); evidence rebound for shared changes (audited reopens, actor 0xLeif)
swift-crypto's transitive swift-asn1 1.7.1 requires tools 6.1; the Linux job pinned 6.0 and failed to resolve.
6.1.3's libswiftObservation has a linker bug (undefined swift::threading::fatal); 6.3.1 matches the windows-smoke toolchain.
swift-asn1 1.7+ requires tools 6.1, and the 6.1/6.2 Linux toolchains fail to link Observation (swift::threading::fatal). swift-asn1 1.6.0 keeps the whole graph 6.0-compatible, matching the historically green 6.0 job.
The test-bundle link newly hard-fails on libswiftObservation.so's undefined threading refs (runner image linker strictness); tolerate shlib undefineds like the executable link path does.
Supersede REQ-aps-cli-015 and REQ-state-store-013, and update testing notes to match the issue #35 EncryptedFile backend. Co-authored-by: Leif <leif.algo@pm.me>
Co-authored-by: Leif <leif.algo@pm.me>
Co-authored-by: Leif <leif.algo@pm.me>
Co-authored-by: Leif <leif.algo@pm.me>
cursor
Bot
force-pushed
the
kimi/issue-35-encrypted-secret-store
branch
from
July 19, 2026 13:43
9f5d129 to
210365b
Compare
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.
Closes #35.
Summary
Replaces the Keychain-backed
secretwith an encrypted-file secret store under the state root (design decision 3ii). The macOS Keychain prompted for the password on every access — ad-hoc signed CLI binaries can never earn durable Keychain trust — and SecureState says nothing for Windows/Linux.Construction: ephemeral X25519 ECDH + HKDF + ChaCha20-Poly1305, directly on swift-crypto (new dependency). Same envelope design as AlgoChat's Crypto/ — without the AlgoKit dependency that would sink the tri-OS goal.
Unlock model (interview decisions):
<state-root>/secret.keygenerated on first use, mode 0600 — the SSH model. Zero prompts, headless-safe, every OS.APS_SECRET_PASSPHRASEderives the key via HKDF-SHA256; wrong passphrases fail loudly with the newAPSError.secretUnlockFailed.APS_SECRET_USE_PASSPHRASE=1prompts once with our own getpass (not macOS's).Housekeeping: AppState
SecureStateextension andAPSKeychainremoved; the now-deadkeychainUnavailablecase removed (the #42 lesson applied). AppState itself untouched; SecureState dogfooding continues in AppStateExamples. Write-then-read-back verification kept from #27;freshValuereads the store directly so cross-process writes surface in watch;requireDecodableDiskStatecovers secret with loud corrupt/unlock failures.Verification (all empirical, worktree)
secret.keymode 0600, reset deletessecret.encsecretUnlockFaileddecodingFailed; cross-process watch sees v1 -> v2smoke.shgreen incl. perms and passphrase right/wrongspecsync check --force7/7 files 100%,specsync change check20 active valid,fledge lanes run verifygreenSpecSync
Merge note
Touches the same DemoKey/StateStore/spec files as #50; whichever merges second gets the usual rebase + rebind pass, which I will run.