Store API tokens in Obsidian Keychain#178
Open
jdevera wants to merge 5 commits into
Open
Conversation
Use the SecretStorage API (Obsidian 1.11.4+) to store GitHub tokens in the OS keychain instead of plain text in data.json. - Add keychain module with clear token CRUD operations - Automatically migrate existing plain-text tokens on first load - Strip tokens from data.json on every save - Bump DATA_VERSION to 2 and minAppVersion to 1.11.4
Update obsidian package to latest for SecretStorage types. Add missing members to test mocks for API compatibility.
Avoids SonarCloud S1186 (unexpected empty method).
02aea5a to
b477774
Compare
Author
|
Reworking this to be more idiomatic with Obsidian's SecretStorage API:
Converting to draft while I rework. |
Switch to Obsidian's built-in SecretComponent UI widget for token selection, letting users pick or create named secrets through the standard Obsidian keychain interface. - Add tokenSecret field to GithubAccount to store the secret name - Replace plain text token input with SecretComponent via addComponent - Auto-generate secret names from account name during migration - Read token values at runtime via secretStorage.getSecret(tokenSecret)
7429759 to
52bece2
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.



Summary
Resolves #177
Uses the Obsidian SecretStorage API (introduced in v1.11.4) to store GitHub tokens in the OS keychain (macOS Keychain, Windows Credential Manager, Linux libsecret) instead of plain text in
data.json.keychain.tsmoduledata.jsonon every saveminAppVersionbumped to1.11.4What I have tested
data.jsonhas an empty token fielddata.jsoncontaining a plain-text token (dataVersion 1), reload, verify the token moves to keychain anddata.jsontoken is cleared