Replace keytar with @napi-rs/keyring for credential storage - #20
Closed
joerj123 wants to merge 1 commit into
Closed
Conversation
keytar is unmaintained and is a native addon that relies on an install-time build script to produce its binary. Modern package managers skip dependency build scripts by default (pnpm v10+, bun), so a normal install never built keytar: on macOS the CLI silently fell back to a `security`-CLI shim, and on Linux/Windows there was no fallback, so it could not read or write credentials and auth broke. Enabling keytar required an extra manual build-approval step (and a running secret service on Linux), a poor first-run experience. @napi-rs/keyring is actively maintained and ships prebuilt, per-platform binaries (incl. musl) as optional dependencies with no install/build script, so installs work out of the box with no approval prompt, while keeping credentials encrypted at rest in the OS keychain. - Swap keytar -> @napi-rs/keyring (KeytarSecretStore -> OsKeyringSecretStore) - Drop the macOS-only `security` CLI fallback; the library covers all platforms - Remove the now-unneeded pnpm onlyBuiltDependencies allowlist
joerj123
force-pushed
the
replace-keytar-with-napi-rs-keyring
branch
from
June 15, 2026 09:47
621a0e4 to
493df72
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
Replace the
keytardependency with@napi-rs/keyringfor storing Shop credentials in the OS secret store.Why
keytaris archived/unmaintained and is a native addon that depends on an install-time build script to produce its binary. Modern package managers block dependency build scripts by default (pnpm v10+, bun), so a normalpnpm add @shopify/shop-clinever builds keytar. The result:security-CLI shim, andEnabling keytar required an extra, non-obvious manual approval step (
pnpm approve-builds), and on Linux also system packages plus a running secret service. That's a poor first-run experience, especially for non-interactive/automated installs.@napi-rs/keyringis actively maintained and ships prebuilt, per-platform binaries (as optional dependencies) with no install/build script. So:pnpm add/npm install/bun addall work out of the box, with no build-approval prompt;Changes
keytar→@napi-rs/keyring; renameKeytarSecretStore→OsKeyringSecretStore.security-CLI fallback (the library covers all three platforms natively).pnpm.onlyBuiltDependenciesallowlist.search) still work when no secret store is available, and a single clear, actionable error is shown when the store can't be accessed.Tradeoff
Headless environments with no secret service (e.g. a bare container) have no OS vault; the CLI now reports a clear error instead of hanging. There is intentionally no plaintext file fallback — credentials are always encrypted at rest.
Testing
pnpm typecheck && pnpm test && pnpm buildpass.auth status,auth logout,config set-country/show, and catalogsearch;