Versions in this module Expand all Collapse all v0 v0.24.0 Jun 24, 2026 Changes in this version + const AbilityAll + var ErrExpired = errors.New("token: expired") + var ErrMalformed = errors.New("token: malformed") + var ErrNotFound = errors.New("token: not found") + var ErrRevoked = errors.New("token: revoked") + type Issuer struct + func NewIssuer(store Store) *Issuer + func (i *Issuer) Find(ctx context.Context, plain string) (*PersonalAccessToken, error) + func (i *Issuer) Issue(ctx context.Context, userID uint64, name string, abilities []string, ...) (*PersonalAccessToken, string, error) + func (i *Issuer) List(ctx context.Context, userID uint64) ([]*PersonalAccessToken, error) + func (i *Issuer) Revoke(ctx context.Context, id string) error + func (i *Issuer) RevokePlain(ctx context.Context, plain string) error + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (s *MemoryStore) Delete(_ context.Context, id string) error + func (s *MemoryStore) Get(_ context.Context, id string) (*PersonalAccessToken, bool, error) + func (s *MemoryStore) ListByUser(_ context.Context, userID uint64) ([]*PersonalAccessToken, error) + func (s *MemoryStore) Save(_ context.Context, t *PersonalAccessToken) error + type PersonalAccessToken struct + Abilities []string + CreatedAt time.Time + ExpiresAt time.Time + Hash string + ID string + LastUsedAt time.Time + Name string + RevokedAt time.Time + UserID uint64 + func (t *PersonalAccessToken) Can(ability string) bool + func (t *PersonalAccessToken) Cant(ability string) bool + func (t *PersonalAccessToken) Expired() bool + func (t *PersonalAccessToken) Revoked() bool + type Store interface + Delete func(ctx context.Context, id string) error + Get func(ctx context.Context, id string) (*PersonalAccessToken, bool, error) + ListByUser func(ctx context.Context, userID uint64) ([]*PersonalAccessToken, error) + Save func(ctx context.Context, t *PersonalAccessToken) error