Lightweight, Redis-backed OTP (one-time password) manager for Node.js and NestJS applications. Current stable version 1.6.1. Provides production-oriented OTP engine with Redis TTL storage, atomic Redis verification, HMAC hashing with secret rotation support, and abuse-control policies (rate limiting, cooldown, lockout). Includes lifecycle hooks for observability. Supports both ESM and CommonJS. Differentiators: intent-aware keying for multi-purpose OTPs, optional sliding window rate limiting, replay protection for token links, and first-class NestJS module export. Requires Node >=18 and peer dependencies for NestJS integration.
npm install redis-otp-managerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows Redis client initialization, OTPManager construction with HMAC and rate limiting, generation and verification of an OTP.
Wrap your Redis client with new RedisAdapter(redisClient).
Use cooldown: { seconds: 60 } instead of resendCooldown: 60.Use a secret of 32+ bytes (e.g., crypto.randomBytes(32).toString('hex')).Set otpLength at initialization and do not change it later for consistency.
Replace resendCooldown with cooldown: { seconds: value }.Ensure redisClient.connect() is called before creating OTPManager. Verify Redis URL.
Use dynamic import() or switch to CommonJS-compatible imports: const { OTPManager } = require('redis-otp-manager');Check that generate() was called with the same type, identifier, and intent. Increase ttl if needed.
Increase rateLimit.max or window, or verify your application logic to avoid excessive calls.