Files
Jarvis/packages/Keychain/README.md
james.maesandClaude Opus 4.7 508cf924d0 docs(packages): per-package README files
Adds README.md to each of the 13 SPM packages (AgentCore, Bus, Config,
DevOverlay, Harness, Keychain, Logging, MCP, Memory, Replay, Shell, Vision,
Voice). Each covers purpose, key public types, deps, consumers, invariants
(pulled from CLAUDE.md + grep-gates + audit findings), test stack, and
notable files. Memory README explicitly marks the package functionally OFF
until vec0.dylib + Ollama models land.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 17:13:33 -05:00

38 lines
1.5 KiB
Markdown

# Keychain
Thin actor wrapper over `SecItem` for secrets (currently the Anthropic API key; any future secret routes through here).
## Key public types
| Type | Purpose |
|------|---------|
| `KeychainStore` (protocol) | Test seam — production = `SystemKeychainStore`, tests = `FakeKeychain` |
| `SystemKeychainStore` | Real `SecItem` actor wrapper |
| `KeychainItem` | Strong-typed key (account + service) |
| `KeychainError` | Errors propagated through construction chains, not swallowed |
## Depends on
(no internal Jarvis package dependencies — the leaf at the bottom of the graph).
## Used by
`packages/AgentCore` (`AnthropicAPIKeyProvider`), `packages/Config`, `App/AppDelegate`.
## Key invariants / contracts
- **Errors propagate.** `AnthropicAPIKeyProvider.make` throws on missing key (Track A fix — was previously swallowed).
- **No plaintext secrets in JSON or `UserDefaults`.** Everything sensitive goes through this package.
- **Fake taxonomy.** `FakeKeychain` is an in-memory dictionary-backed store with realistic behavior (Fake per CLAUDE.md §Test naming conventions).
## Tests
XCTest. Round-trip read/write/delete on `FakeKeychain`. Production `SystemKeychainStore` tests gated to skip in CI (require user-keychain access).
## Notable files
- `Sources/Keychain/KeychainStore.swift` — the protocol
- `Sources/Keychain/SystemKeychainStore.swift` — production
- `Sources/Keychain/KeychainItem.swift` — typed keys
- `Sources/Keychain/KeychainError.swift` — error union