config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides functions to store and retrieve configuration data such as GitHub tokens, repository info, and password hashes using the system keychain for secure storage.

Index

Constants

View Source
const (
	ServiceName             = "ostrakon"
	TokenKey                = "github_token"
	RepoURLKey              = "repo_url"
	RepoOwnerKey            = "repo_owner"
	RepoNameKey             = "repo_name"
	PasswordHashKey         = "password_hash"
	GlobalMasterPasswordKey = "global_master_password"
)

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the user's Ostrakon config directory.

func DeleteGlobalMasterPassword

func DeleteGlobalMasterPassword() error

DeleteGlobalMasterPassword removes the global master password from the keyring.

func DeletePasswordHash

func DeletePasswordHash() error

DeletePasswordHash removes the password hash from the keychain.

func DeleteRepoInfo

func DeleteRepoInfo() error

DeleteRepoInfo removes all repo info from the keychain.

func DeleteToken

func DeleteToken() error

DeleteToken removes the GitHub token from the system keychain.

func EnsureConfigDir

func EnsureConfigDir() error

EnsureConfigDir ensures the config directory exists.

func GetGlobalMasterPassword

func GetGlobalMasterPassword() (string, error)

GetGlobalMasterPassword retrieves the stored master password from the keyring.

func GetKeyring

func GetKeyring() keyring.Keyring

GetKeyring returns the current keyring implementation.

func GetPasswordHash

func GetPasswordHash() (string, error)

GetPasswordHash retrieves the stored password hash for validation.

func GetRepoName

func GetRepoName() (string, error)

GetRepoName retrieves the stored repository name.

func GetRepoOwner

func GetRepoOwner() (string, error)

GetRepoOwner retrieves the stored repository owner.

func GetRepoURL

func GetRepoURL() (string, error)

GetRepoURL retrieves the stored repository URL.

func GetToken

func GetToken() (string, error)

GetToken retrieves the GitHub access token from the system keychain.

func HasGlobalMasterPassword

func HasGlobalMasterPassword() bool

HasGlobalMasterPassword checks if a global master password is stored.

func SetKeyring

func SetKeyring(k keyring.Keyring)

SetKeyring sets a custom keyring implementation (for testing).

func StoreGlobalMasterPassword

func StoreGlobalMasterPassword(password string) error

StoreGlobalMasterPassword stores the master password directly in the keyring.

func StorePasswordHash

func StorePasswordHash(hash string) error

StorePasswordHash stores the hashed password validation checksum.

func StoreRepoInfo

func StoreRepoInfo(url, owner, name string) error

StoreRepoInfo stores the repository URL and parsed owner/repo name.

func StoreToken

func StoreToken(token string) error

StoreToken stores the GitHub access token in the system keychain.

Types

This section is empty.

Jump to

Keyboard shortcuts

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