challenge

package
v0.0.0-...-122f59b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DependencySet = wire.NewSet(
	wire.Struct(new(Provider), "*"),
)
View Source
var ErrInvalidChallenge = errors.New("invalid challenge token")

Functions

func GenerateChallengeToken

func GenerateChallengeToken() string

Types

type Challenge

type Challenge struct {
	Token     string    `json:"token"`
	Purpose   Purpose   `json:"purpose"`
	CreatedAt time.Time `json:"created_at"`
	ExpireAt  time.Time `json:"expire_at"`
}

type Provider

type Provider struct {
	Redis *appredis.Handle
	AppID config.AppID
	Clock clock.Clock
}

func (*Provider) Consume

func (p *Provider) Consume(token string) (*Purpose, error)

func (*Provider) Create

func (p *Provider) Create(purpose Purpose) (*Challenge, error)

func (*Provider) Get

func (p *Provider) Get(token string) (*Challenge, error)

type Purpose

type Purpose string
const (
	PurposeAnonymousRequest Purpose = "anonymous_request"
	PurposeBiometricRequest Purpose = "biometric_request"
	PurposeApp2AppRequest   Purpose = "app2app_request"
)

func (Purpose) IsValid

func (p Purpose) IsValid() bool

func (Purpose) ValidityPeriod

func (p Purpose) ValidityPeriod() time.Duration

Jump to

Keyboard shortcuts

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