token

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingToken = errors.New("missing bearer token")
	ErrInvalidToken = errors.New("invalid bearer token")
)

Functions

This section is empty.

Types

type Service

type Service interface {
	// ValidateAndGetUserID validates a bearer token from the Authorization header
	// and returns the associated WHOOP user ID.
	// Returns ErrMissingToken if the header is empty or malformed.
	// Returns ErrInvalidToken if the token is invalid or expired.
	ValidateAndGetUserID(ctx context.Context, authHeader string) (int64, error)
}

type Validator

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

func NewValidator

func NewValidator(cache storage.TokenCache, whoopLimiter storage.WhoopRateLimiter) *Validator

func (*Validator) ValidateAndGetUserID

func (v *Validator) ValidateAndGetUserID(ctx context.Context, authHeader string) (int64, error)

Jump to

Keyboard shortcuts

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