otp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OTP

type OTP struct {
	Key     string
	Created time.Time
}

type RetentionMap

type RetentionMap map[string]OTP

func NewRetentionMap

func NewRetentionMap(ctx context.Context, retentionPeriod time.Duration) RetentionMap

NewRetentionMap will create a new retentionmap and start the retention given the set period

func (RetentionMap) NewOTP

func (rm RetentionMap) NewOTP() OTP

NewOTP creates and adds a new otp to the map

func (RetentionMap) Retention

func (rm RetentionMap) Retention(ctx context.Context, retentionPeriod time.Duration)

Retention will make sure old OTPs are removed Is Blocking, so run as a Goroutine

func (RetentionMap) VerifyOTP

func (rm RetentionMap) VerifyOTP(otp string) bool

VerifyOTP will make sure a OTP exists and return true if so It will also delete the key so it cant be reused

Jump to

Keyboard shortcuts

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