utils

package
v5.1.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEntityNotFound               = fmt.Errorf("entity not found")
	ErrEmailIsNotConfirmed          = fmt.Errorf("user email has not been confirmed")
	ErrApplicationAlreadyRegistered = fmt.Errorf("error: application with given name already registered")
	ErrAuthFailed                   = fmt.Errorf("authorization failed: incorrect email or password")
	ErrAPIKeyAlreadyRegistered      = fmt.Errorf("error: api key with given name already registered")
	ErrEmptyMFACode                 = fmt.Errorf("error: Multi factor authorization code is empty field")
	ErrPasswordTooWeak              = fmt.Errorf("error: Password is too weak: password must be at least 8 characters length")
	ErrIncorrectAppToken            = fmt.Errorf("error: application token is incorrect")
	ErrInvalidConfirmationCode      = fmt.Errorf("error: confirmation code is invalid")
	ErrEmailAlreadyRegistered       = fmt.Errorf("error: account with this email has been already registered")
)

Functions

func CheckRetry

func CheckRetry(errToCheck *client.VirgilAPIError, vcli *client.VirgilHTTPClient) (token string, err error)

func DeleteAccessToken

func DeleteAccessToken() error

func DeleteAppFile

func DeleteAppFile() error

func DeleteDefaultApp

func DeleteDefaultApp() error

func LoadAccessToken

func LoadAccessToken() (token string, err error)

func LoadAccessTokenOrLogin

func LoadAccessTokenOrLogin(vcli *client.VirgilHTTPClient) (token string, err error)

func LoadDefaultApp

func LoadDefaultApp() (app *models.StoredApplication, err error)

func Login

func Login(email, password string, vcli *client.VirgilHTTPClient) error

Login obtains temporary account access token. Email and password may be empty

func ParseAppConfig

func ParseAppConfig(data []byte) (config models.AppConfig, err error)

func ReadConsoleValue

func ReadConsoleValue(paramName, paramDescription string, options ...string) string

func ReadFileFlagOrParamOrFromConsole

func ReadFileFlagOrParamOrFromConsole(context *cli.Context, flag, paramName, paramDescription string) ([]byte, error)

func ReadFlagOrConsoleValue

func ReadFlagOrConsoleValue(context *cli.Context, flagName, paramDescription string, options ...string) string

func ReadFlagOrDefault

func ReadFlagOrDefault(context *cli.Context, flagName, defaultValue string) string

func ReadKeyStringFromFile

func ReadKeyStringFromFile(context *cli.Context, fileName string) (string, error)

func ReadParamOrDefaultOrFromConsole

func ReadParamOrDefaultOrFromConsole(context *cli.Context, paramName, paramDescription, defaultValue string) string

func SaveAccessToken

func SaveAccessToken(token string) error

func SaveConfig

func SaveConfig(token string) error

func SaveDefaultApp

func SaveDefaultApp(vcli *client.VirgilHTTPClient, app *models.Application) error

func SendWithCheckRetry

func SendWithCheckRetry(
	vcli *client.VirgilHTTPClient,
	method string,
	urlPath string,
	payload interface{},
	respObj interface{},
	extraOptions ...interface{},
) (headers http.Header, cookie string, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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