otp

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package otp contains the implementation of the issuance of verification codes. Codes can be configured by creating an Request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCode

func GenerateCode(length uint) (string, error)

GenerateCode creates a new OTP code.

Types

type Request

type Request struct {
	DB            *database.Database
	RealmID       uint
	Length        uint
	ExpiresAt     time.Time
	TestType      string
	SymptomDate   *time.Time
	MaxSymptomAge time.Duration
	IssuingUser   *database.User
	IssuingApp    *database.AuthorizedApp
}

Request represents the parameters of a verification code request.

func (*Request) Issue

func (o *Request) Issue(ctx context.Context, retryCount uint) (string, string, error)

Issue will generate a verification code and save it to the database, based on the paremters provided. It returns the code, a UUID for accessing the code, and any errors.

Jump to

Keyboard shortcuts

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