otpstore

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCodeNotFound is returned when the code is not found
	ErrCodeNotFound = fmt.Errorf("code not found")
)

Errors

Functions

This section is empty.

Types

type InMemory

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

func NewInMemory

func NewInMemory() *InMemory

NewInMemory creates a new in-memory store

func (*InMemory) GenerateKeyString

func (i *InMemory) GenerateKeyString(code, purpose string) string

GenerateKeyString generates a new key string

func (*InMemory) Get

func (i *InMemory) Get(code, purpose string) (*otp.EmailCode, error)

Get gets a code. It returns an ErrCodeNotFound if the code is not found

func (*InMemory) List

func (i *InMemory) List() ([]otp.EmailCode, error)

List lists all the codes

func (*InMemory) Register

func (i *InMemory) Register(code, purpose, entity string) (*otp.EmailCode, error)

Register registers a new code

func (*InMemory) Remove

func (i *InMemory) Remove(code, purpose string) error

Remove removes a code

Jump to

Keyboard shortcuts

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