device

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GCInterval = time.Minute
	Expiry     = time.Minute * 5
	Timeout    = time.Second * 30
)

Variables

View Source
var (
	ErrDBIsRequired     = errors.New("db is required")
	ErrCreatingFlow     = errors.New("error creating flow")
	ErrPollingFlow      = errors.New("error polling flow")
	ErrGettingFlow      = errors.New("error getting flow")
	ErrCompletingFlow   = errors.New("error completing flow")
	ErrRateLimitFlow    = errors.New("error rate limit")
	ErrFlowNotCompleted = errors.New("flow not completed")
)

Functions

This section is empty.

Types

type Device

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

func New

func New(db *db.DB, logger types.Logger) (*Device, error)

func (*Device) Close

func (c *Device) Close() error

func (*Device) CompleteFlow

func (c *Device) CompleteFlow(ctx context.Context, identifier pgtype.UUID, sessionIdentifier pgtype.UUID) error

CompleteFlow marks a device flow as completed by setting its session identifier Called from API handler - inputs should be pre-validated pgx types Defensive check: validates identifier.Valid and sessionIdentifier.Valid (returns error → 500 if invalid)

func (*Device) CreateFlow

func (c *Device) CreateFlow(ctx context.Context) (string, string, error)

func (*Device) ExistsFlow

func (c *Device) ExistsFlow(ctx context.Context, code string) (string, error)

func (*Device) PollFlow

func (c *Device) PollFlow(ctx context.Context, poll pgtype.UUID, pollRate time.Duration) (string, error)

PollFlow checks if a device code flow has been completed Called from API handler - inputs should be pre-validated pgx types Defensive check: validates poll.Valid (returns error → 500 if invalid)

Jump to

Keyboard shortcuts

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