CellBIS/mojo-hakkefuin ? reverse-engineered prompt

Reverse engineered prompt

Build me a Mojolicious plugin for simple authentication that works with a cookie plus a server side CSRF token, and can keep sessions enforced from the backend even if the browser still has a cookie.

I want it to work with SQLite by default, and also support MariaDB, MySQL, and PostgreSQL when I give it a database URL. It should create its auth table automatically on startup, manage cookie and session lifetimes, and let me change the helper name prefix and stash keys.

Please include helpers for sign in, sign out, checking whether a user is authenticated, updating or rotating auth data, getting and regenerating CSRF tokens, and accessing the backend object. If possible, add an optional lock and unlock flow that lets me put a user into a locked state and show a screen lock style experience, with callbacks I can hook into.

Make it easy to use in both Mojolicious Lite and normal apps, and keep the setup straightforward. If you need to check the latest Mojolicious docs, go ahead and look them up online.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab