otp

package
v0.0.0-...-795d1ad Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateRequest

type GenerateRequest struct {
	// expiration in seconds (default: 60)
	Expiry int64 `json:"expiry"`
	// unique id, email or user to generate an OTP for
	Id string `json:"id"`
	// number of characters (default: 6)
	Size int64 `json:"size"`
}

type GenerateResponse

type GenerateResponse struct {
	// one time pass code
	Code string `json:"code"`
}

type OtpService

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

func NewOtpService

func NewOtpService(token string) *OtpService

func (*OtpService) Generate

func (t *OtpService) Generate(request *GenerateRequest) (*GenerateResponse, error)

Generate an OTP (one time pass) code

func (*OtpService) Validate

func (t *OtpService) Validate(request *ValidateRequest) (*ValidateResponse, error)

Validate the OTP code

type ValidateRequest

type ValidateRequest struct {
	// one time pass code to validate
	Code string `json:"code"`
	// unique id, email or user for which the code was generated
	Id string `json:"id"`
}

type ValidateResponse

type ValidateResponse struct {
	// returns true if the code is valid for the ID
	Success bool `json:"success"`
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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