totp

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestFailed = "TotpRequestFailed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	sptty.BaseConfig

	Endpoints map[string]Endpoint `yaml:"endpoints"`
}

func (*Config) ConfigName

func (s *Config) ConfigName() string

func (*Config) Default

func (s *Config) Default() interface{}

func (*Config) Validate

func (s *Config) Validate() error

type Endpoint

type Endpoint struct {
	Issuer  string        `yaml:"issuer"`
	CodeLen int           `yaml:"len"`
	Expiry  time.Duration `yaml:"expiry"`
}

type GenerateBody

type GenerateBody struct {
	Code string `json:"code"`
	Key  string `json:"key"`
}

type RequestEndpoint

type RequestEndpoint struct {
	Endpoint string `json:"endpoint"`
	Account  string `json:"account"`
}

type Service

type Service struct {
	sptty.BaseService
	// contains filtered or unexported fields
}

func (*Service) Gererate

func (s *Service) Gererate(endpoint string, account string) (string, string, error)

func (*Service) Init

func (s *Service) Init(app sptty.ISptty) error

func (*Service) ServiceName

func (s *Service) ServiceName() string

func (*Service) Validate

func (s *Service) Validate(endpoint string, code string, key string) (bool, error)

type ValidateRequest

type ValidateRequest struct {
	RequestEndpoint
	GenerateBody
}

Jump to

Keyboard shortcuts

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