config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 5 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                = "token"
	RepoURLKey              = "repo_url"
	RepoOwnerKey            = "repo_owner"
	RepoNameKey             = "repo_name"
	PasswordHashKey         = "password_hash"
	GlobalMasterPasswordKey = "global_master_password"
	ProviderTypeKey         = "provider_type"
	GitLabProjectIDKey      = "gitlab_project_id"
)
View Source
const (
	ProviderGitHub = "github"
	ProviderGitLab = "gitlab"
)

ProviderType constants for storage.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the user's Ostrakon config directory.

func DeleteGitLabProjectID added in v0.1.0

func DeleteGitLabProjectID() error

DeleteGitLabProjectID removes the GitLab project ID from the keychain.

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 DeleteProviderType added in v0.1.0

func DeleteProviderType() error

DeleteProviderType removes the provider type 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 GetGitLabProjectID added in v0.1.0

func GetGitLabProjectID() (int, error)

GetGitLabProjectID retrieves the stored GitLab project ID.

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 GetProviderType added in v0.1.0

func GetProviderType() (string, error)

GetProviderType retrieves the stored provider type.

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 StoreGitLabProjectID added in v0.1.0

func StoreGitLabProjectID(projectID int) error

StoreGitLabProjectID stores the numeric project ID for GitLab.

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 StoreProviderType added in v0.1.0

func StoreProviderType(provider string) error

StoreProviderType stores the provider type (github or gitlab).

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