cmd

package
v0.0.0-...-604e745 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version version tag
	Version = "v0.1"
	// BuildDate date string of when build was performed filled in by -X compile flag
	BuildDate string

	// LatestCommit date string of when build was performed filled in by -X compile flag
	LatestCommit string

	// BuildNumber date string of when build was performed filled in by -X compile flag
	BuildNumber string

	// BuiltOnIP date string of when build was performed filled in by -X compile flag
	BuiltOnIP string

	// BuiltOnOs date string of when build was performed filled in by -X compile flag
	BuiltOnOs string

	// RuntimeVer date string of when build was performed filled in by -X compile flag
	RuntimeVer string
)
View Source
var (
	// MinTimeLeft minimum number of seconds left when returning a code, api will block till greater than value
	MinTimeLeft = 10
)

Functions

func ConfigPath

func ConfigPath(fname string) (string, error)

ConfigPath get config file path

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func Initialize

func Initialize() (*DeviceRegistration, []*Token, error)

Initialize initialize device info and cached tokens

func SaveDeviceInfo

func SaveDeviceInfo(devInfo *DeviceRegistration) error

SaveDeviceInfo ..

Types

type DeviceRegistration

type DeviceRegistration struct {
	UserID       uint64 `json:"user_id,omitempty"`
	DeviceID     uint64 `json:"device_id,omitempty"`
	Seed         string `json:"seed,omitempty"`
	APIKey       string `json:"api_key,omitempty"`
	MainPassword string `json:"main_password,omitempty"`
}

DeviceRegistration authy account details

func LoadExistingDeviceInfo

func LoadExistingDeviceInfo() (*DeviceRegistration, error)

LoadExistingDeviceInfo ,,,

type Token

type Token struct {
	Name         string `json:"name"`
	OriginalName string `json:"original_name"`
	Digital      int    `json:"digital"`
	Secret       string `json:"secret"`
	Period       int    `json:"period"`
}

Token save in cache

func (*Token) GetTotpCode

func (tk *Token) GetTotpCode() (string, int)

GetTotpCode return code and # of seconds left in current code

type Tokens

type Tokens []*Token

Tokens type for results of search etc

func (Tokens) Len

func (ts Tokens) Len() int

Len - number of Token results

func (Tokens) String

func (ts Tokens) String(i int) string

String return token name of results index

Jump to

Keyboard shortcuts

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