Register auth routes
CallauthRoutes(router) after resolving your router. It registers guest-only GET /login and GET /register pages plus their POST handlers.
example/main.dart
User; hashes the password; and redirects through the included response helpers.
Hash passwords
UseAuth.hashPassword() before persistence and Auth.verifyPassword() for an explicit comparison. The underlying Hasher uses PBKDF2-HMAC-SHA256 with a random salt, 25,000 iterations, a 32-byte key, a versioned string format, and constant-time comparison.
lib/src/http/routes/register.dart
Log in and resolve users
lib/src/http/routes/login.dart
await Auth.check(request) to test authentication, await Auth.user(request) or await request.user to load the current user, and await Auth.logout(request) to end the session.
Guard routes
lib/src/http/routes/api.dart
Auth.middleware redirects invalid sessions to login. Guest.middleware redirects authenticated users away from login and registration pages.
The
archery_session cookie is created with httpOnly, secure, and SameSite.lax. Serve authentication flows over HTTPS so browsers send the secure cookie.