github

package
v1.1.5 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: 21 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrInvalidOptions   = errors.New("invalid options")
	ErrDBIsRequired     = errors.New("db is required")
	ErrCreatingFlow     = errors.New("error creating flow")
	ErrCompletingFlow   = errors.New("error completing flow")
	ErrInvalidNextURL   = errors.New("invalid next URL")
	ErrInvalidResponse  = errors.New("invalid response")
	ErrNoVerifiedEmails = errors.New("no verified emails")
)

Functions

This section is empty.

Types

type Github

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

func New

func New(options Options, db *db.DB, logger types.Logger) (*Github, error)

func (*Github) Close

func (c *Github) Close() error

func (*Github) CompleteFlow

func (c *Github) CompleteFlow(ctx context.Context, identifier pgtype.UUID, code string) (flow.Data, error)

CompleteFlow completes a GitHub OAuth flow Called from API handler - inputs should be pre-validated pgx types Defensive check: validates identifier.Valid (returns error → 500 if invalid) Note: code is an OAuth authorization code string (not a database ID)

func (*Github) CreateFlow

func (c *Github) CreateFlow(ctx context.Context, deviceIdentifier pgtype.UUID, userIdentifier pgtype.UUID, nextURL string) (string, error)

CreateFlow creates a new GitHub OAuth flow Called from API handler - inputs should be pre-validated pgx types Defensive check: validates deviceIdentifier.Valid and userIdentifier.Valid if provided Note: nextURL is a string URL (not a database ID)

type Options

type Options struct {
	RedirectURL  string
	ClientID     string
	ClientSecret string
	HTTPClient   *http.Client // Optional: custom HTTP client for testing
}

Jump to

Keyboard shortcuts

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