Repository navigation
feat(macos): opt-in Keychain for sign-ins - #6
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
0d7293f to
ffa05c0
Compare
8738f36 to
d3daf27
Compare
`credentials = "keychain"` in config.toml keeps the Web API token and the streaming credentials in the macOS Keychain instead of files. - cloofy-os gets a secret store, the login keychain on macOS through security-framework, under the service "cloofy". Elsewhere it isn't available, and the setting says so instead of being ignored. - A file in the old place always wins and moves into the keychain when read. That covers the switch from files and `cloofy login`, where librespot writes the reusable credentials itself: they move over right after. Otherwise librespot doesn't get to keep them in a file. - After connecting, cloofy updates the stored credentials when Spotify handed out new ones, as librespot does for files. It's off by default: macOS ties keychain access to the binary, so an unsigned build has to ask again after each update. With signed releases it can become the default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`doctor`, `query` and `dj-sample` connect through `PendingSession::connect`, which didn't save credentials Spotify renewed while connecting. In keychain mode the cache has no file for librespot to update, so those were lost. `connect` now saves them itself, and `login` relies on that too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ffa05c0 to
97380b7
Compare
d3daf27 to
59a2cbe
Compare
Merged with the speed and polish work: the Web API client keeps its timeouts and rate-limit retries and now reads its token from the chosen store, and the player saves renewed credentials before it subscribes to Spotify Connect pushes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged through #7. The only conflicts were with the audit work: the Web API client keeps its new timeouts and rate-limit retries and reads its token from your 🤖 Generated with Claude Code |
Merged with the speed and polish work: the Web API client keeps its timeouts and rate-limit retries and now reads its token from the chosen store, and the player saves renewed credentials before it subscribes to Spotify Connect pushes.
Stacked on #5. Last of the stack.
What changes
credentials = "keychain"inconfig.tomlkeeps both sign-ins in the macOS Keychain instead of files: the Web API token (webapi-token.json) and librespot's reusable streaming credentials (session/credentials.json).cloofy-os. It uses the login keychain throughsecurity-framework(already in the tree via rustls), as generic passwords under the servicecloofy. On other systems it isn't available, and the setting fails with a clear message instead of being ignored silently.Secretincloofy-spotify. A sign-in lives either in a private file or in the keychain.Pathscarries the mode, so every existing call site (paths.webapi_token(),session::prepare(paths)) stays the same.cloofy login, where librespot writes the real reusable credentials (with theirauth_type) itself: they move over right after. The rest of the time, librespot's cache gets no credentials file.session::remember), as librespot does for files.PendingSession::connect(used bylogin,doctor,query) does it itself; the Spirc connections in the TUI and inplay/connectcall it explicitly.Why it's off by default
macOS ties keychain access to the binary's code signature. For an unsigned, ad-hoc signed build, every update is a new binary, so macOS asks again whether cloofy may use its items. Once releases are signed, this can become the default.
Verified
#[ignore]d, since CI can't answer keychain prompts): save, overwrite, read, delete, plus moving a file into the keychain.credentials = "keychain":cloofy doctorread the token from the keychain (401 from Spotify for the fake token, not "not logged in").0600), and thecredentialsvalues.To test by hand
credentials = "keychain"and start cloofy: the files in~/.local/share/cloofydisappear, and Keychain Access shows twocloofyitemscloofy login --force: still signed in, and nocredentials.jsonremainscloofy loginis needed again (sign-ins aren't moved back to files)🤖 Generated with Claude Code