totp

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSharedSecret error = errors.New("invalid base64 shared secret")

ErrInvalidSharedSecret is returned when shared secret isn't in base64 form

Functions

func GenerateTotpCode

func GenerateTotpCode(sharedSecret string, time time.Time) (string, error)

GenerateTotpCode generates steam TOTP code which is always 5 symbols.

Types

type Totp

type Totp struct {
	Time time.Time
	// contains filtered or unexported fields
}

Totp is structure holding data needed for generating TOTP token.

func NewTimedTotp

func NewTimedTotp(sharedSecret string, time time.Time) *Totp

NewTimedTotp creates new Totp structure with custom time.

func NewTotp

func NewTotp(sharedSecret string) *Totp

NewTotp creates new Totp structure with current time.

func (*Totp) GenerateCode

func (totp *Totp) GenerateCode() (string, error)

GenerateCode generates Steam TOTP code which is always 5 symbols.

func (*Totp) SharedSecret

func (totp *Totp) SharedSecret() string

SharedSecret returns shared secret of Totp structure.

Jump to

Keyboard shortcuts

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