mfa

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleAuthenticator

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

func NewGoogleAuthenticator

func NewGoogleAuthenticator(codeLength, secretLength int) *GoogleAuthenticator

NewGoogleAuthenticator constructor

func (*GoogleAuthenticator) CreateSecret

func (g *GoogleAuthenticator) CreateSecret() (string, error)

CreateSecret in TOTP

func (*GoogleAuthenticator) GenerateQRCode

func (g *GoogleAuthenticator) GenerateQRCode(title string, secret string) (base64QR string, err error)

GenerateQRCode png and encode to base64

func (*GoogleAuthenticator) GetCode

func (g *GoogleAuthenticator) GetCode(secret string, ts ...int64) (string, error)

GetCode in TOTP with secret and time

func (*GoogleAuthenticator) VerifyCode

func (g *GoogleAuthenticator) VerifyCode(secret string, code string, discrepancy int, ts ...int64) bool

VerifyCode checks if the given code is valid for the provided secret and error range

type GoogleAuthenticatorConfig

type GoogleAuthenticatorConfig struct {
	CodeLength   int    `json:"code_length"`
	SecretLength int    `json:"secret_length"`
	Name         string `json:"name"`
}

Jump to

Keyboard shortcuts

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