agentidentity

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StatusPending = "pending"
	StatusActive  = "active"
	StatusRevoked = "revoked"
)

Variables

View Source
var (
	ErrTooSoon  = errors.New("agentidentity: a confirmation was requested a moment ago")
	ErrInvalid  = errors.New("agentidentity: invalid or expired token")
	ErrBadStore = errors.New("agentidentity: store is not configured")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	DB          *sql.DB
	Table       string
	SubjectCol  string
	Prefix      string
	PendingTTL  time.Duration
	ActiveTTL   time.Duration
	ResendAfter time.Duration
}

func (*Store) Confirm

func (s *Store) Confirm(ctx context.Context, confirm string) (int64, error)

func (*Store) List

func (s *Store) List(ctx context.Context, subjectID int64) ([]Summary, error)

func (*Store) Mint

func (s *Store) Mint(ctx context.Context, subjectID int64, name string) (string, error)

func (*Store) Request

func (s *Store) Request(ctx context.Context, subjectID int64, name string) (token, confirm string, err error)

func (*Store) Resolve

func (s *Store) Resolve(ctx context.Context, token string) (int64, bool)

func (*Store) Revoke

func (s *Store) Revoke(ctx context.Context, token string) error

func (*Store) RevokeByID

func (s *Store) RevokeByID(ctx context.Context, subjectID, id int64) error

type Summary

type Summary struct {
	ID         int64
	Name       string
	CreatedAt  time.Time
	LastUsedAt sql.NullTime
}

Jump to

Keyboard shortcuts

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