secure

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

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 (
	// 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"
)

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 GetAPIKey

func GetAPIKey(provider string) (string, error)

GetAPIKey retrieves an API key for a given provider 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 ValidateAPIKey

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

ValidateAPIKey checks if the API key works with the provider

Types

This section is empty.

Jump to

Keyboard shortcuts

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