Skip to content

Delegate keyring operations to CLI and simplify deployment identity#816

Open
EhabY wants to merge 3 commits intomainfrom
add-keyring-support-cli
Open

Delegate keyring operations to CLI and simplify deployment identity#816
EhabY wants to merge 3 commits intomainfrom
add-keyring-support-cli

Conversation

@EhabY
Copy link
Collaborator

@EhabY EhabY commented Mar 3, 2026

Summary

  • Replace @napi-rs/keyring (4 native .node binaries) with CLI subprocess calls (coder login --use-token-as-session to store, coder login token --url to read, coder logout --url --yes to delete), keeping the credential format in sync with the CLI automatically
  • Make url the single source of truth for deployment identity — fetchBinary, configure, and clearCredentials now derive safeHostname internally via toSafeHost(), eliminating redundant parameters
  • Download the CLI if it does not exist (or out of date) when reading/deleting the session token on login/logout
  • Remove KeyringStore, vendor script, supportedArchitectures config, and @napi-rs/keyring dependency

@EhabY EhabY self-assigned this Mar 3, 2026
@EhabY EhabY force-pushed the add-keyring-support-cli branch 3 times, most recently from 115f6cc to b852660 Compare March 4, 2026 13:42
@EhabY EhabY changed the title Add keyring support through the CLI Delegate keyring operations to CLI and simplify deployment identity Mar 4, 2026
): Promise<string | undefined> {
let binPath: string;
try {
binPath = await this.resolveBinary(url);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently blocks to install the binary (on login, with keyring enabled, and CLI >= 2.29)

): Promise<void> {
let binPath: string;
try {
binPath = await this.resolveBinary(url);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently blocks to install the binary (on logout, with keyring enabled, and CLI >= 2.29)

EhabY added 3 commits March 5, 2026 01:51
Replace @napi-rs/keyring (4 native .node binaries) with CLI subprocess
calls. The extension now runs `coder login --use-token-as-session` to
store tokens and `coder login token --url` to read them, keeping the
credential format in sync with the CLI automatically.

- Add CliCredentialManager that shells out to the Coder CLI
- Update CliManager.configure() to accept binPath and delegate to CLI
- Update LoginCoordinator to fetch CLI binary for keyring reads
- Remove clearCredentials keyring cleanup (stale entries are harmless)
- Remove @napi-rs/keyring dep, vendor script, supportedArchitectures
- Delete KeyringStore and its tests
…both

Make url the single source of truth for deployment identity. fetchBinary,
configure, and clearCredentials now derive safeHostname via toSafeHost()
internally, eliminating redundant parameters and preventing inconsistency.
BinaryResolver and CliCredentialManager methods take url string instead of
Deployment object.
…er logging

Make storeToken resolve its own binary internally via the injected
BinaryResolver, matching readToken and deleteToken. Remove the binPath
parameter from both storeToken and configure since callers no longer
need to supply it.

Add locateBinary to CliManager as a cheap stat-only lookup that the
container resolver tries before falling back to fetchBinary.

Downgrade implementation-detail log messages from info/warn to debug,
keeping info for significant events (server version, download start,
stored/deleted token).
@EhabY EhabY force-pushed the add-keyring-support-cli branch from b852660 to 9c992fe Compare March 4, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant