config.go
func (cfg *ClientConfig) Save(path string) error {
	encrypted_password, err := Encrypt(cfg.Password)
	if err != nil {
		return fmt.Errorf("Failed to encrypt password: %s", err)
	}
	cfg.Password = encrypted_password
	encrypted_refresh, err := Encrypt(cfg.RefreshToken)
	if err != nil {
		return fmt.Errorf("Failed to encrypt refresh token: %s", err)
	}
	cfg.RefreshToken = encrypted_refresh
	bytes, err := json.Marshal(cfg)
	if err != nil {
		return fmt.Errorf("Failed to serialize config: %s", err)
	}
	err = ioutil.WriteFile(path, bytes, 0644)
	if err != nil {
		return fmt.Errorf("Failed to write config file: %s", err)
	}
	return nil
}
func (cfg *ClientConfig) Save(path string) error {
	encrypted_password, err := Encrypt(cfg.Password)
	if err != nil {
		return fmt.Errorf("Failed to encrypt password: %s", err)
	}
	cfg.Password = encrypted_password
	encrypted_refresh, err := Encrypt(cfg.RefreshToken)
	if err != nil {
		return fmt.Errorf("Failed to encrypt refresh token: %s", err)
	}
	cfg.RefreshToken = encrypted_refresh
	bytes, err := json.Marshal(cfg)
	if err != nil {
		return fmt.Errorf("Failed to serialize config: %s", err)
	}
	err = ioutil.WriteFile(path, bytes, 0644)
	if err != nil {
		return fmt.Errorf("Failed to write config file: %s", err)
	}
	return nil
}
// Save config encrypts the password and/or refresh token;
// persists the config to file