login

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "login",
	Short: "Authenticate with SuperFuzz",
	Long: `The CLI will prompt you to enter information for your Akita API key.

API key information will be stored in ` + cfg.GetCredentialsConfigPath(),
	SuggestFor:   []string{"signin", "sign-in", "log-in"},
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		ans := struct {
			APIKeyID     string
			APIKeySecret string
		}{}

		qs := []*survey.Question{
			{
				Name:   "APIKeyID",
				Prompt: &survey.Input{Message: "API Key ID:"},
			},
			{
				Name:   "APIKeySecret",
				Prompt: &survey.Password{Message: "API Key Secret:"},
			},
		}

		if err := survey.Ask(qs, &ans); err != nil {
			return errors.Wrap(err, "failed to get API key ID and secret")
		}

		if err := cfg.WriteAPIKeyAndSecret("default", ans.APIKeyID, ans.APIKeySecret); err != nil {
			return errors.Wrap(err, "failed to save credentials config file")
		}

		fmt.Println("Login successful!")
		fmt.Println("API keys stored in", cfg.GetCredentialsConfigPath())
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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