# Packages
# README
go-keyconfig
A Golang package for simplifying storing configuration in the OS-provided secret manager.
Operating System Support
OS | Secret Manager |
---|---|
MacOS | OSX Keychain |
Linux | Gnome Keyring |
Linux | KWallet |
Windows | Windows Credential Manager |
Installation
go get -u github.com/infamousjoeg/go-keyconfig
Usage
Example
For a full example of usage, please see example/example.go.
import "github.com/infamousjoeg/go-keyconfig"
func SetConfig
func SetConfig (configID string, config interface{}) error
keyconfig.SetConfig
sets a struct type containing config key/values to the secret store of the current OS using the configID
value as the identifier. It first encodes the struct to JSON and then Base64 encodes it for prior to setting in the secret store. Only an error will be returned, if one occurs.
func GetConfig
func GetConfig (configID string, config interface{}) error
keyconfig.GetConfig
gets a Base64-encoded key/value config from the current OS secret store using the configID
value as the identifier. It then Base64 decodes to JSON and then will unmarshal the JSON data into the struct provided as the config interface{}
value. Since the struct is provided when the function is called, only an error will be returned otherwise, if one occurs.
func DeleteConfig
func DeleteConfig (configID string) error
keyconfig.DeleteConfig
removes a Base64-encoded key/value config from the current OS secret store using the configID
value as the identifier. Only an error will be returned, if one occurs.
Screenshots
MacOS
Linux
Windows
Testing
go test -v ./...
Security
Please responsibly disclose any security issues or concerns as outlined in the Security Guidelines.
License
MIT
Maintainer
Contributions
Pull Requests are currently being accepted. Please read and follow the guidelines laid out in CONTRIBUTING.md.