Versions in this module Expand all Collapse all v0 v0.1.1 Oct 25, 2026 v0.1.0 Oct 12, 2026 Changes in this version + var ErrActive = errors.New("apikeys: revoke the key before deleting it") + var ErrInvalidKey = errors.New("apikeys: invalid key") + var ErrInvalidName = errors.New("apikeys: a key name needs 1 to 64 printable characters") + var ErrNotFound = errors.New("apikeys: key not found") + var Migrations = app.Migrations + type Config struct + Prefix string + type Key struct + AccountID string + CreatedAt time.Time + ID string + LastUsedAt *time.Time + Name string + Prefix string + RevokedAt *time.Time + Suffix string + func Current(c *gin.Context) Key + func (k Key) Display() string + type Keys struct + func New(a *app.App, cfg Config) (*Keys, error) + func (k *Keys) Authenticate(ctx context.Context, raw string) (Key, error) + func (k *Keys) Create(ctx context.Context, accountID, name string) (string, Key, error) + func (k *Keys) Delete(ctx context.Context, accountID, keyID string) error + func (k *Keys) List(ctx context.Context, accountID string) ([]Key, error) + func (k *Keys) LockActive(ctx context.Context, tx *sql.Tx, accountID, keyID string) error + func (k *Keys) Mount(r gin.IRouter, layout ui.Layout) + func (k *Keys) Rename(ctx context.Context, accountID, keyID, name string) error + func (k *Keys) RequireKey(c *gin.Context) + func (k *Keys) Revoke(ctx context.Context, accountID, keyID string) error