otp

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCode

func GenerateCode(secret string, counter uint64, options *OtpOptions) (string, error)

func ToggleDebug

func ToggleDebug()

func ValidateCode

func ValidateCode(code string, counter uint64, secret string, options *OtpOptions) (bool, error)

Types

type OtpKey

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

func GenerateKey

func GenerateKey(algorithm string, opts *OtpKeyOptions) (*OtpKey, error)

func NewKeyFromUrl

func NewKeyFromUrl(keyUrl url.URL) (*OtpKey, error)

func (*OtpKey) Algorithm

func (k *OtpKey) Algorithm() string

func (*OtpKey) Image

func (k *OtpKey) Image() (image.Image, error)

func (*OtpKey) Issuer

func (k *OtpKey) Issuer() string

func (*OtpKey) Png

func (k *OtpKey) Png() ([]byte, error)

func (*OtpKey) Secret

func (k *OtpKey) Secret() string

func (*OtpKey) String

func (k *OtpKey) String() string

func (*OtpKey) Type

func (k *OtpKey) Type() string

func (*OtpKey) UserId

func (k *OtpKey) UserId() string

type OtpKeyOptions

type OtpKeyOptions struct {
	Issuer  string
	UserId  string
	Secret  *OtpSecret
	Options *OtpOptions
}

func NewDefaultOtpKeyOptions

func NewDefaultOtpKeyOptions(issuer string, userId string) *OtpKeyOptions

type OtpOptions

type OtpOptions struct {
	CodeSize  common.PassCodeSize
	Algorithm common.Algorithm
}

func NewDefaultOtpOptions

func NewDefaultOtpOptions() *OtpOptions

type OtpSecret

type OtpSecret struct {
	SecretSize uint
	// contains filtered or unexported fields
}

func NewRandomOtpSecret

func NewRandomOtpSecret(size int) *OtpSecret

func NewSecret

func NewSecret(secret string) *OtpSecret

func (*OtpSecret) Value

func (s *OtpSecret) Value() string

Jump to

Keyboard shortcuts

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