totp

package
v0.0.0-...-1305305 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LOGGER = logging.MustGetLogger("totp-helper")

Functions

func Check

func Check(user User, token TokenBody) bool

func Create

func Create(accountName string, user User, newTOTP bool) (*Response, *User, bool, bool)

func ResponseError

func ResponseError(w http.ResponseWriter, statusCode int, err error)

func ResponseSuccess

func ResponseSuccess(w http.ResponseWriter, res *Response, statusCode int, msg string)

Types

type QRCode

type QRCode struct {
	// The base64 encoded representation the the QR Code.
	QRCodeURI string `json:"qrcodeURI"`
	// A user friendly name for the registration
	AccountName string `json:"accountName"`
}

type RegistrationData

type RegistrationData struct {
	Email string `json:"email"`
}

type Response

type Response struct {
	Success    bool   `json:"success"`
	Registered bool   `json:"registered"`
	Msg        string `json:"msg"`
	Data       QRCode `json:"data"`
}

type TokenBody

type TokenBody struct {
	Token string `json:"token"`
}

type User

type User struct {
	UID        string `json:"uid" bspn:"uid"`
	Secret     string `json:"secret" bson:"secret"`
	Registered bool   `json:"registered" bson:"registered"`
}

Jump to

Keyboard shortcuts

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