@huatek/ghostkey-redis-adapter
v0.1.8
Published
Redis cache adapter for GhostKey Auth.
Downloads
1,263
Readme
@huatek/ghostkey-redis-adapter
Redis cache adapter for GhostKey Auth.
Use this optional package to store short-lived challenges, consume challenge state and rate limit counters in Redis.
Install
npm install @huatek/ghostkey-redis-adapter ioredisUsage
import Redis from "ioredis";
import { createRedisAdapter } from "@huatek/ghostkey-redis-adapter";
const redis = new Redis(process.env.REDIS_URL);
const cache = createRedisAdapter(redis);
const auth = new GhostKeyAuth({
// ...
cache
});What it stores
- Short-lived challenge records.
- Challenge consumption markers.
- Rate limit counters.
Notes
- Redis is optional for local development. In production or distributed deployments, treat it as required for atomic challenge consumption and rate-limit counters.
- Redis improves replay protection consistency and rate limit behavior across multiple app instances.
- Keep challenge TTL short, usually 60 to 180 seconds.
