service

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Red red
	Red = "\033[1;31m%s\033[0m"
	// Green green
	Green = "\033[1;32m%s\033[0m"
	// Teal teal
	Teal = "\033[1;36m%s\033[0m"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlfredOutput

type AlfredOutput struct {
	Title    string `json:"title"`
	Subtitle string `json:"subtitle"`
	Arg      string `json:"arg"`
	Icon     struct {
		Type string `json:"type"`
		Path string `json:"path"`
	} `json:"icon"`
	Valid bool `json:"valid"`
	Text  struct {
		Copy string `json:"copy"`
	} `json:"text"`
}

AlfredOutput ..

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device ..

func NewDevice

func NewDevice(conf NewDeviceConfig) *Device

NewDevice ..

func (*Device) ConfigPath

func (d *Device) ConfigPath(fname string) (string, error)

ConfigPath get config file path Return the path to the config file If the file does not exist, it will be created at $HOME ( or optionally AUTHY_ROOT )

func (*Device) DeleteMainPassword

func (d *Device) DeleteMainPassword()

DeleteMainPassword delete main password

func (*Device) LoadExistingDeviceInfo

func (d *Device) LoadExistingDeviceInfo() (devInfo DeviceRegistration, err error)

LoadExistingDeviceInfo ...

func (*Device) LoadTokenFromAuthyServer

func (d *Device) LoadTokenFromAuthyServer()

LoadTokenFromAuthyServer load token from authy server, make sure that you've enabled Authenticator Backups And Multi-Device Sync

func (*Device) LoadTokenFromCache

func (d *Device) LoadTokenFromCache() (err error)

LoadTokenFromCache load token from local cache

func (*Device) RegisterOrGetDeviceInfo

func (d *Device) RegisterOrGetDeviceInfo() (devInfo DeviceRegistration)

RegisterOrGetDeviceInfo get device info from local cache, if not exist register a new device

func (*Device) SaveDeviceInfo

func (d *Device) SaveDeviceInfo() (err error)

SaveDeviceInfo ..

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 device register info

type NewDeviceConfig

type NewDeviceConfig struct {
	CountryCode string
	Mobile      string
	Password    string

	ConfigFilePath string
	ConfigFileName string
	CacheFileName  string
}

NewDeviceConfig new device config

type Output

type Output struct {
	*Token
	OTitle     string
	Code       string
	RemainSecs int

	Error error
}

Output cale token output

func (Output) AfredSubtitle

func (o Output) AfredSubtitle() string

AfredSubtitle alfred subtitle

func (Output) Title

func (o Output) Title() string

Title ...

func (Output) ToAfred

func (o Output) ToAfred() AlfredOutput

ToAfred to alfred output

type Searcher

type Searcher struct {
	*Device
	// contains filtered or unexported fields
}

Searcher

func NewSearcher

func NewSearcher(keyword string, isAlfred bool) *Searcher

NewSearcher ..

func (*Searcher) Search

func (s *Searcher) Search()

Search fuzzy search tokens by name and origin_name

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"`
	Weight       int    `json:"weight"`
}

Token ..

func (Token) Title

func (t Token) Title() string

Title show string

type Tokens

type Tokens []*Token

Tokens for sort

func (Tokens) Len

func (t Tokens) Len() int

func (Tokens) Less

func (t Tokens) Less(i, j int) bool

func (Tokens) String

func (t Tokens) String(i int) string

String implement fuzz search

func (Tokens) Swap

func (t Tokens) Swap(i, j int)

Jump to

Keyboard shortcuts

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