auth-verify — OTP & JWT made simple

A tiny, battle‑tested Node.js library for generating and sending OTPs, issuing JWTs, revoking tokens and managing sessions (memory or Redis).

Why auth-verify?

✅ Secure OTP generation (crypto-based)
✅ Email & SMS & Telegram senders
✅ JWT signing, verify & revoke
✅ Memory or Redis backing for scale
✅ Cookie auto-handling for JWT
✅ OAuth v2 integration

Install

npm i auth-verify

Quick start


          

Tip: Use auth.setSender({...}) to configure email/sms/telegram or auth.register.sender() to add a custom transmitter.

Examples

Sign & verify JWT
const token = await auth.jwt.sign({ userId: 123 }, '1h')
await auth.jwt.verify(token)
OTP flow (email)
auth.otp.generate(6).set('user@example.com')
await auth.otp.message({ to: 'user@example.com' })
await auth.otp.verify({ check: 'user@example.com', code: '123456' })
Custom sender (dev)
// register a custom sender
auth.register.sender('console', async ({to, code}) => console.log('deliver', to, code))
await auth.use('console').send({ to: '+998901234567', code: '123456' })