Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

Refactored keyring implementation per feedback

  • Extract keyring logic to internal/keyring/keyring.go
  • Create internal/keyring/keyring_linux.go with file-based storage
  • Create internal/keyring/keyring_darwin.go with system keyring
  • Create internal/keyring/keyring_windows.go with system keyring
  • Update internal/config/config.go to use new keyring package
  • Add tests for keyring package
  • Remove old fallback implementation
  • All tests pass

Implementation Details

New Package Structure

  • internal/keyring/keyring.go: Defines Provider interface and package-level Set/Get functions
  • internal/keyring/keyring_linux.go: Linux-specific implementation using file storage only (no dbus dependency)
  • internal/keyring/keyring_darwin.go: macOS implementation using system keyring
  • internal/keyring/keyring_windows.go: Windows implementation using system keyring

Linux File Storage

On Linux, tokens are stored in ~/.config/jira-cli/token as JSON:

{
  "host1.atlassian.net": "token1",
  "host2.atlassian.net": "token2"
}
  • File permissions: 0600 (owner read/write only)
  • Directory permissions: 0700

Platform Selection

Go build tags automatically select the correct implementation:

  • Linux: Uses file-based storage
  • macOS/Windows: Uses system keyring via go-keyring

Testing

All tests pass (11 total):

  • 7 existing tests (unchanged)
  • 4 new keyring tests
Original prompt

The key-chain we use does not work on linux if you do not have dbus installed. When that happens, lets fall back to use a file.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 14, 2025
Copilot AI and others added 2 commits November 14, 2025 01:23
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI changed the title [WIP] Add fallback to file for key-chain on Linux without dbus Add file-based fallback for token storage when dbus unavailable Nov 14, 2025
Copilot AI requested a review from alexec November 14, 2025 01:30
@alexec
Copy link
Contributor

alexec commented Nov 14, 2025

@copilot Nope. Extract the key-ring logic to a new file (internal/keyring/keyring.go) and internal/keyring/keyring_linux.go which just uses files for the moment.

…mplementations

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
@alexec alexec marked this pull request as ready for review November 14, 2025 02:07
@alexec alexec merged commit 9f9df6c into main Nov 14, 2025
2 checks passed
@alexec alexec deleted the copilot/fallback-to-file-when-dbus-missing branch November 14, 2025 02:08
Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot Nope. Extract the key-ring logic to a new file (internal/keyring/keyring.go) and internal/keyring/keyring_linux.go which just uses files for the moment.

Done. Refactored to use platform-specific implementations:

  • internal/keyring/keyring.go - interface and common code
  • internal/keyring/keyring_linux.go - file-based storage (no dbus)
  • internal/keyring/keyring_darwin.go - system keyring for macOS
  • internal/keyring/keyring_windows.go - system keyring for Windows

Commit: 6f2ced0

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.

2 participants