Documentation
¶
Overview ¶
Package secure provides secure storage capabilities for sensitive data like API keys.
Package secure provides secure storage capabilities for sensitive data like API keys. It uses the system's native keyring/keychain when available, with fallbacks for different platforms.
Package secure provides secure storage and validation for API keys
Index ¶
- Constants
- Variables
- func DeleteAPIKey(provider string) error
- func DeleteGitHubToken() error
- func GetAPIKey(provider string) (string, error)
- func GetGitHubToken() (string, error)
- func GetSecureStorageStatus() map[string]string
- func StoreAPIKey(provider, apiKey string) error
- func StoreGitHubToken(token string) error
- func ValidateAPIKey(provider, apiKey string) (bool, error)
- func ValidateGitHubToken(token string) (bool, map[string]interface{}, error)
Constants ¶
const ( // GitHubTokenKey is the key used to store the GitHub token in the secure storage GitHubTokenKey = "github-token" // GitHubAPIURL is the base URL for GitHub API GitHubAPIURL = "https://api.github.com" )
const ( // ServiceName is the name used to identify this application in the keyring ServiceName = "noidea-git-tool" // FallbackDir is the directory used for fallback storage if keyring is unavailable FallbackDir = ".noidea/secure" // FallbackFile is the filename used for fallback storage FallbackFile = "keyring.enc" // AliasFile is the filename for user-defined provider aliases AliasFile = "provider_aliases.json" )
Variables ¶
var ErrKeyNotFound = errors.New("key not found in secure storage")
ErrKeyNotFound indicates that a key was not found in the secure storage
Functions ¶
func DeleteAPIKey ¶
DeleteAPIKey removes an API key from secure storage
func DeleteGitHubToken ¶ added in v0.3.1
func DeleteGitHubToken() error
DeleteGitHubToken removes the GitHub Personal Access Token from secure storage
func GetGitHubToken ¶ added in v0.3.1
GetGitHubToken retrieves the GitHub Personal Access Token from secure storage
func GetSecureStorageStatus ¶
GetSecureStorageStatus returns information about the secure storage status
func StoreAPIKey ¶
StoreAPIKey securely stores an API key for a given provider
func StoreGitHubToken ¶ added in v0.3.1
StoreGitHubToken securely stores a GitHub Personal Access Token
func ValidateAPIKey ¶
ValidateAPIKey checks if the API key works with the provider
Types ¶
This section is empty.