otp

package
v0.0.0-...-15a51b0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(sub string, sec ...string) *otp.Key

Generate a new TOTP Key.

func GeneratePassCode

func GeneratePassCode(secret string) string

Creates a TOTP token using the current time.

func GenerateQRCode

func GenerateQRCode(key *otp.Key) string

Convert OTP key into a PNG.

func GenerateSecret

func GenerateSecret(secretLength ...int) string

Generate a OTP Secret

func Init

func Init(path string)

func Validate

func Validate(passcode, secret string) bool

Validate a TOTP using the current time.

Types

type Account

type Account struct {
	OTP    string `json:"otp"`
	Name   string `json:"name"`
	QRCode string `json:"qr_code"`
}

func Get

func Get(name string) (*Account, error)

func (*Account) Key

func (account *Account) Key() (*otp.Key, error)

func (*Account) Save

func (account *Account) Save() error

Jump to

Keyboard shortcuts

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