rewt is a Node.js library that wraps JWT (JSON Web Token) signing and verification, sourcing a shared secret from Redis for easy and fast rotation. Version 3.0.0 is the latest stable release. The library automatically handles secret generation with TTL for rotation, allows manual secret invalidation, and supports custom namespacing. It is designed for server-to-server authentication scenarios where secret rotation and revocation are critical.
npm install rewtNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows init with Redis connection, signing a JWT, verifying it, and cleanup. Uses async/await with callback-based API.
Upgrade Node to >=10 and Redis to >=5.
Use `redis` v4 and call `.connect()` before passing to Rewt.
Set ttl in seconds (e.g., 86400 for 24h).
Wrap `sign` and `verify` in Promise constructor.
Set unique `redisNamespace` per application.
Ensure Redis connection is established and rewt has been used to sign at least one token to generate the secret.
Use `const Rewt = require('rewt');` (not `const { Rewt } = require('rewt');`).Ensure the token passed to `verify` is a valid signed JWT string.