Notifiers
Notifiers deliver OTP codes to users. Swap between Nodemailer (email, the default), Console (terminal), or build your own.
The default notifier is NodemailerNotifier - with no SMTP config it
creates an Ethereal test inbox in development. Use
ConsoleNotifier when you’d rather see codes in your terminal.
Console Notifier - dev only
Logs OTPs to stdout. Zero configuration. Great for local development.
import { ConsoleNotifier, createAuth } from "guardo";
const auth = createAuth({
jwt: { secret: "..." },
notifier: new ConsoleNotifier(),
});
// Console: [guardo] OTP for user@example.com via email: 483920 (expires in 300s)