preauth

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("preauth key not found")

Functions

This section is empty.

Types

type Key

type Key struct {
	ID             string
	BotID          string
	Token          string
	IssuedByUserID string
	ExpiresAt      time.Time
	UsedAt         time.Time
	CreatedAt      time.Time
}

Key represents a bot pre-authorization key.

type Service

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

func NewService

func NewService(queries *sqlc.Queries) *Service

func (*Service) Get

func (s *Service) Get(ctx context.Context, token string) (Key, error)

func (*Service) Issue

func (s *Service) Issue(ctx context.Context, botID, issuedByUserID string, ttl time.Duration) (Key, error)

Issue creates a new preauth key for the given bot.

func (*Service) MarkUsed

func (s *Service) MarkUsed(ctx context.Context, id string) (Key, error)

Jump to

Keyboard shortcuts

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