secure

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 10 Imported by: 0

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

View Source
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"
)
View Source
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

View Source
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

func DeleteAPIKey(provider string) error

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 GetAPIKey

func GetAPIKey(provider string) (string, error)

GetAPIKey retrieves an API key for a given provider from secure storage

func GetGitHubToken added in v0.3.1

func GetGitHubToken() (string, error)

GetGitHubToken retrieves the GitHub Personal Access Token from secure storage

func GetSecureStorageStatus

func GetSecureStorageStatus() map[string]string

GetSecureStorageStatus returns information about the secure storage status

func StoreAPIKey

func StoreAPIKey(provider, apiKey string) error

StoreAPIKey securely stores an API key for a given provider

func StoreGitHubToken added in v0.3.1

func StoreGitHubToken(token string) error

StoreGitHubToken securely stores a GitHub Personal Access Token

func ValidateAPIKey

func ValidateAPIKey(provider, apiKey string) (bool, error)

ValidateAPIKey checks if the API key works with the provider

func ValidateGitHubToken added in v0.3.1

func ValidateGitHubToken(token string) (bool, map[string]interface{}, error)

ValidateGitHubToken checks if the GitHub token is valid by making a request to the GitHub API

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL