Documentation
¶
Index ¶
- Variables
- func AddAccount(account map[string]string) int
- func AddHook(command string)
- func CheckExpiredTokenError(err *kserrors.Error)
- func ConfigDir() (dirpath string, err error)
- func ConfigPath() (configPath string, err error)
- func GetAllAccounts() []map[string]string
- func GetAuthToken() string
- func GetCurrentAccount() (user models.User, index int)
- func GetDeviceName() string
- func GetDeviceUID() string
- func GetHook() (string, bool)
- func GetServiceApiKey(serviceName string) string
- func GetUserPrivateKey() (privateKey []byte, err error)
- func GetUserPublicKey() (publicKey []byte, err error)
- func InitConfig(cfgFile string) (err error)
- func IsLoggedIn() bool
- func Logout()
- func RemoveHook()
- func RevokeDevice() error
- func SetAuthToken(token string)
- func SetCurrentAccount(index int)
- func SetServiceApiKey(serviceName string, token string)
- func SetUserPrivateKey(privateKey []byte)
- func SetUserPublicKey(publicKey []byte)
- func UserFromAccount(account map[string]string) (user models.User)
- func Write()
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AddAccount ¶
Adds an account to the config ! does not write to disk
func CheckExpiredTokenError ¶
CheckExpiredTokenError function checks if the API error is a token exipiration and logsout the user if so
func ConfigDir ¶
ConfigDir function returns the path to the config dir, and creates it if it doesn't exist
func ConfigPath ¶
ConfigPath function returns the path to the config file.
func GetAuthToken ¶
func GetAuthToken() string
GetAuthToken function returns the latest auth token we obtained
func GetCurrentAccount ¶
Reads the current account from disk Returns the account as a map, and its index If the user is logged out, the map is empty, and the index is -1
func GetDeviceName ¶
func GetDeviceName() string
GetDeviceName function returns the current device name
func GetServiceApiKey ¶
GetServiceApiKey function returns the API Key for the named CI service
func GetUserPrivateKey ¶
GetUserPrivateKey function returns the currently logged in user's private key
func GetUserPublicKey ¶
GetUserPublicKey function returns the currently logged in users's public key
func InitConfig ¶
initConfig reads in config file and ENV variables if set.
func RemoveHook ¶
func RemoveHook()
func RevokeDevice ¶
func RevokeDevice() error
RevokeDevice removes device information (including keys) from the configuration file
func SetCurrentAccount ¶
func SetCurrentAccount(index int)
Sets the current account as the index at `index` Means the user is logged in as the user of that account
func SetServiceApiKey ¶
SetServiceApiKey function sets the API Key for the named CI service
func SetUserPrivateKey ¶
func SetUserPrivateKey(privateKey []byte)
SetUserPrivateKey function sets the private key for the currenty logged in user
func SetUserPublicKey ¶
func SetUserPublicKey(publicKey []byte)
SetUserPublicKey function sets the pulblic key for the currently logged in use
func UserFromAccount ¶
UserFromAccount function returns a `models.User` instance from an account map
Types ¶
This section is empty.