feat(config): write credentials to state.toml and the OS keychain#236
Open
LorrisSaintGenez wants to merge 5 commits into
Open
feat(config): write credentials to state.toml and the OS keychain#236LorrisSaintGenez wants to merge 5 commits into
LorrisSaintGenez wants to merge 5 commits into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 47 |
| Duplication | -2 |
TIP This summary will be updated as you push new changes.
bbf8f2b to
b861374
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.
What
auth login,application createandapplication selectnow persist credentials to the new model: API key in the OS keychain,api_key_uuid+ alias + current application instate.toml(config.toml is no longer written by these flows)state.toml, so a keychain failure never leaves state pointing at a missing key; empty alias/uuid preserve existing values, and the stored crawler key survives re-loginauth crawlerstores the crawler API key in the application's keychain entry; it now requires a new-model application (legacy-only users are told to runalgolia auth login)Test
make build— produces./algoliawith the required ldflags (OAuth client ID, dashboard URL); a stable binary also avoids repeated macOS keychain prompts./algolia auth login— thencat ~/.config/algolia/state.toml: expectcurrent_application_id, plusapi_key_uuidandaliasunder[applications.<APP_ID>]api_key_uuidis only set when a fresh key was generated; if the key was reused (already in the keychain or in a legacy config.toml profile), it stays empty by design — same rule as the upcoming migration (GROUT-363)security find-generic-password -s algolia-cli -a "app:<APP_ID>" -w | sed 's/^go-keyring-base64://' | base64 -d(macOS) — expect the{"api_key": ...}JSON entry; go-keyring's macOS backend stores values base64-encoded with ago-keyring-base64:prefix (decoded transparently on read)./algolia application select— re-selecting the same application must NOT create a new dashboard key (key is reused); selecting another one updatescurrent_application_id./algolia auth crawler— addscrawler_api_keyto the same keychain entry; then run any crawler command to exercise the lazy user-ID fetch./algolia indices list— exercises the read path end to end;config.toml's mtime must never change (these flows no longer write it)GROUT-305