tokens

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Tag feature.Tag = "srv-factory-tokens"

Variables

View Source
var (
	DefaultNumRandomBytes int           = 128
	DefaultDuration       time.Duration = time.Minute * 10
)

Functions

This section is empty.

Types

type CFeature

type CFeature struct {
	feature.CFeature
	uses_kvc.CUsesKVC[MakeFeature]
	// contains filtered or unexported fields
}

func (*CFeature) Build

func (f *CFeature) Build(b feature.Buildable) (err error)

func (*CFeature) CreateToken

func (f *CFeature) CreateToken(key string) (value, shasum string)

CreateToken will add a new nonce associated with the given key

func (*CFeature) CreateTokenWith

func (f *CFeature) CreateTokenWith(key string, duration time.Duration) (value, shasum string)

CreateTokenWith will add a new token with the given duration, associated with the given key

func (*CFeature) Init

func (f *CFeature) Init(this interface{})

func (*CFeature) Make

func (f *CFeature) Make() (feat Feature)

func (*CFeature) SetDuration

func (f *CFeature) SetDuration(duration time.Duration) MakeFeature

func (*CFeature) SetNumRandomBytes

func (f *CFeature) SetNumRandomBytes(size int) MakeFeature

func (*CFeature) Startup

func (f *CFeature) Startup(ctx *cli.Context) (err error)

func (*CFeature) VerifyToken

func (f *CFeature) VerifyToken(key, value string) (valid bool)

VerifyToken will validate and evict the given nonce value

type Feature

type Feature interface {
	feature.Feature
	feature.TokenFactoryFeature
}

type MakeFeature

type MakeFeature interface {
	uses_kvc.MakeFeature[MakeFeature]

	SetDuration(duration time.Duration) MakeFeature
	SetNumRandomBytes(size int) MakeFeature

	Make() Feature
}

func New

func New() MakeFeature

func NewTagged

func NewTagged(tag feature.Tag) MakeFeature

Jump to

Keyboard shortcuts

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