Package: auth

Authentication primitives: auth cookies, token helpers, and rate limiting used by the login flows.

Package: auth

Low-level authentication primitives used by the Dracory login flows. The package provides helpers for setting and reading authentication cookies, parsing tokens, and throttling authentication attempts.

Repository: https://github.com/dracory/auth

Installation

go get github.com/dracory/auth

Features

  • Auth Cookies — AuthCookieSet / AuthCookieGet / AuthCookieRemove helpers for the auth token cookie.
  • Token Parsing — validation and expiration checks for auth tokens.
  • Rate Limiting — RateLimitExceeded primitives used to throttle login attempts.
  • IP Helpers — client IP extraction used for rate limiting keys.

Where It Is Used

The website's auth controllers (internal/controllers/auth) build on this package to implement OTP, magic link, password, and AuthKnight login methods. See the Authentication guide for the higher-level flow.