twofa

package
v0.0.0-...-0ddd045 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package twofa provides utilities to generate and validate 2FA codes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateTOTP

func ValidateTOTP(code, secret string) bool

ValidateTOTP validates a 6 digit TOTP code

Types

type TOTPKey

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

func GenerateTOTP

func GenerateTOTP(issuer, account string) (TOTPKey, error)

GenerateTOTP generates a new TOTP

func (TOTPKey) Image

func (k TOTPKey) Image(width, height int) (image.Image, error)

Image returns the TOTP as an image to add to 2FA Managers

func (TOTPKey) Secret

func (k TOTPKey) Secret() string

Secret returns the TOTP secret

func (TOTPKey) URL

func (k TOTPKey) URL() string

URL returns the TOTP URL

Jump to

Keyboard shortcuts

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