import type { AuthRateLimitStore, AuthStore } from './types.js'; export interface MemoryStoreOptions { /** Required acknowledgement that process-local state is only for tests/development. */ development: true; } /** Create a bounded-lifecycle process-local auth store for tests and development only. */ export declare function memoryAuthStore(options: MemoryStoreOptions): AuthStore; /** Create a process-local fixed-window rate limiter for tests and development only. */ export declare function memoryRateLimitStore(options: MemoryStoreOptions): AuthRateLimitStore; /** * The four Redis commands the durable stores need, in one client-neutral shape. * * This package pins no Redis client. node-redis and ioredis disagree on the * signatures of `SET` with an expiry and of `EVAL` — object options against * positional arguments — and sniffing which client arrived is a guess that * sends a malformed command to the session store. So the caller says which one * it has, through {@link nodeRedisCommandPort} or {@link ioredisCommandPort}, * and anything else that can answer these four calls is a valid port too. */ export interface RedisCommandPort { get(key: string): Promise; /** `SET key value EX ttlSeconds`. */ set(key: string, value: string, ttlSeconds: number): Promise; del(key: string): Promise; /** `EVAL script numkeys KEYS... ARGV...`, resolving to the script's reply. */ eval(script: string, keys: readonly string[], args: readonly string[]): Promise; } /** The surface of a connected node-redis (`redis` on npm, v4+) client this package uses. */ export interface NodeRedisClientLike { get(key: string): Promise; set(key: string, value: string, options: { EX: number; }): Promise; del(key: string): Promise; eval(script: string, options: { keys: string[]; arguments: string[]; }): Promise; } /** The surface of a connected ioredis client this package uses. */ export interface IoredisClientLike { get(key: string): Promise; set(key: string, value: string, mode: 'EX', ttlSeconds: number): Promise; del(key: string): Promise; eval(script: string, numberOfKeys: number, ...keysAndArguments: string[]): Promise; } /** Adapt a node-redis client (`import { createClient } from 'redis'`). */ export declare function nodeRedisCommandPort(client: NodeRedisClientLike): RedisCommandPort; /** Adapt an ioredis client (`import Redis from 'ioredis'`). */ export declare function ioredisCommandPort(client: IoredisClientLike): RedisCommandPort; export interface RedisStoreOptions { /** * Prefix for every key this store writes, so one Redis can hold more than one * application. Letters, digits, and `:._/-` only. @default "ruvyxa:auth:" */ prefix?: string; } /** * A durable, shared session and one-time-token store on Redis. * * `take` is atomic on the server, so two instances behind one load balancer * cannot both accept a magic link or an OAuth state. Driver errors propagate: * the auth runtime answers them with a generic 500, which is the fail-closed * behaviour a store outage should have. */ export declare function redisAuthStore(port: RedisCommandPort, options?: RedisStoreOptions): AuthStore; /** A durable, shared fixed-window rate limiter on Redis. */ export declare function redisRateLimitStore(port: RedisCommandPort, options?: RedisStoreOptions): AuthRateLimitStore; //# sourceMappingURL=stores.d.ts.map