feat(cli): store access tokens securely in OS keyring#746
Open
feat(cli): store access tokens securely in OS keyring#746
Conversation
🦋 Changeset detectedLatest commit: 963d850 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
0dad18a to
b047bed
Compare
commit: |
This comment has been minimized.
This comment has been minimized.
7437b49 to
51b0d46
Compare
- Add @napi-rs/keyring for OS keyring integration (macOS Keychain, Windows Credential Manager, Linux Secret Service) - Introduce V2 config schema with discriminated union (keyring | file) - V1→V2 migration keeps tokens in file; keyring upgrade on next login/refresh - Both regular and machine user login store tokens via keyring when available - Add resolveTokens/saveUserTokens/deleteUserTokens async helpers - Fall back to file-based storage with warning when keyring unavailable Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b047bed to
b9113a0
Compare
…ecure-token-storage # Conflicts: # packages/sdk/src/cli/commands/login.ts # packages/sdk/src/cli/commands/logout.ts
…ecure-token-storage # Conflicts: # packages/sdk/src/cli/commands/logout.ts
…d warn on failure
Keep V1 config format on disk to avoid breaking older SDK versions. Keyring storage can be opted into via TAILOR_USE_KEYRING env var. readPlatformConfig no longer writes back V2 format to disk.
Enable SDK version check for latest_min_sdk_version warning. Add latest_version and latest_min_sdk_version optional fields to V2 config schema for future version migration announcements.
This comment has been minimized.
This comment has been minimized.
…er refs Replace lexicographic string comparison with proper semver numeric comparison for latest_min_sdk_version check. Clear current_user in toV1ForDisk when the referenced user is keyring-only and would be dropped.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6856d63 to
963d850
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
@napi-rs/keyringTAILOR_USE_KEYRING=1to enable, keeping V1 config format for backward compatibility with older SDK versionsmin_sdk_version(semver validated viaz.templateLiteral),latest_version, andlatest_min_sdk_versionfields for future version migration announcementsreadPlatformConfig()andloadWorkspaceId()are now async — enables SDK version comparison forlatest_min_sdk_versionwarningwritePlatformConfigconverts V2→V1 for disk by default; V2 only written whenTAILOR_USE_KEYRINGis setawaittoken revocation in logout withtokenTypeHintfor machine user supportLATEST_CONFIG_VERSIONconstantDesign decisions
TAILOR_USE_KEYRINGenv var until a safe migration path is established.min_sdk_versionin V2 config: Written to disk so older SDKs encountering a newer config can tell the user exactly which version to update to.latest_version/latest_min_sdk_version: Optional fields for pre-announcing future config version migrations. When present and the current SDK is older thanlatest_min_sdk_version, a warning is shown.readPlatformConfig: Required to read SDK version frompackage.jsonfor thelatest_min_sdk_versioncomparison. All callers were already in async contexts.🤖 Generated with Claude Code
ref: #674 (comment)