Add ServerCredentialStore for server-side credential management#539
Merged
Conversation
…eric InMemoryKvStorage)
Coverage Report
File CoverageNo changed files found. |
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.
Summary
Introduces
ServerCredentialStore, a project-scoped credential management system that separates secret storage (in aSecretVault) from metadata persistence (inIKvStorage). This enables secure credential handling in the main process with decryption happening only on the server side, never in the renderer.Key Changes
SecretVaultinterface — abstraction for platform-specific secret storage (ElectronsafeStorage, OS keychain, etc.). Implementations handle encryption/decryption and must never log secret values.ServerCredentialStoreclass — implementsICredentialStorewith:${userId}/${projectId}/${key}vault IDsget(),has(), andlistMetadata()listMetadata()returns credential info without exposing secret valuesdeleteAll()clears all credentials in the project scope, including expired entriesCredentialMetadataRowandCredentialMetadataInfotypes — separate persisted metadata (with timestamps and expiry) from API-exposed metadata (no secret values).Comprehensive test suite — covers round-trip storage, expiry handling, scope isolation (by user and project), metadata listing, and failure recovery.
Exports — added to
packages/storage/src/common.tsfor public API access.Implementation Details
get()andhas()check metadata first and auto-delete expired entriesput()preserves existinglabelandproviderif not overridden, andcreatedAttimestamp across updatesdeleteAll()iterates all metadata to find scoped entries, ensuring no orphaned secrets remainhttps://claude.ai/code/session_018MYdampoJqPM8TETqW9Q86