/** * @typedef {object} MemoryStoreOptions * @property {number} [maxKeys=10000] Hard cap; oldest entry dropped when exceeded. * @property {number} [sweepMs=60000] Interval for the background TTL sweep. */ /** * @param {MemoryStoreOptions} [options] * @returns {import('./index.js').IncrStore & { _size: () => number, _stop: () => void }} */ declare function memoryStore(options?: MemoryStoreOptions): IncrStore & { _size: () => number; _stop: () => void; }; type MemoryStoreOptions = { /** * Hard cap; oldest entry dropped when exceeded. */ maxKeys?: number | undefined; /** * Interval for the background TTL sweep. */ sweepMs?: number | undefined; }; /** * @typedef {object} RedisStoreOptions * @property {string} [keyPrefix='chall:'] Prepended to every key. */ /** * @param {any} client * @param {RedisStoreOptions} [options] * @returns {import('./index.js').IncrStore} */ declare function redisStore(client: any, options?: RedisStoreOptions): IncrStore; type RedisStoreOptions = { /** * Prepended to every key. */ keyPrefix?: string | undefined; }; declare const customStore: (impl: object) => Record Promise>; type IncrStore = { /** * Atomic increment-with-expiry. First call for a fresh key returns * `{ count: 1 }` and arms a TTL of `ttlMs`; subsequent calls before * expiry return the incremented count. `verifyChallenge` reads * `count > 1` as "already consumed". */ incr: (key: string, ttlMs: number) => Promise<{ count: number; expiresAt?: number; }>; }; export { customStore, memoryStore, redisStore }; export type { IncrStore };