HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/quadcode.com/node_modules/sveltekit-rate-limiter/dist/server/index.d.ts
import type { Cookies, RequestEvent } from '@sveltejs/kit';
export type RateUnit = 'ms' | '100ms' | '250ms' | '500ms' | 's' | '2s' | '5s' | '10s' | '15s' | '30s' | '45s' | 'm' | '15m' | '30m' | 'h' | '2h' | '6h' | '12h' | 'd';
export type Rate = [number, RateUnit];
export interface RateLimiterStore {
    add: (hash: string, unit: RateUnit) => Promise<number>;
    clear: () => Promise<void>;
}
export interface RateLimiterPlugin {
    hash: (event: RequestEvent) => Promise<string | boolean | null>;
    get rate(): Rate;
}
type CookieSerializeOptions = NonNullable<Parameters<Cookies['set']>[2]>;
type CookieRateLimiterOptions = {
    name: string;
    secret: string;
    rate: Rate;
    preflight: boolean;
    serializeOptions?: CookieSerializeOptions;
    hashFunction?: HashFunction;
};
declare class CookieRateLimiter implements RateLimiterPlugin {
    readonly rate: Rate;
    private readonly cookieOptions;
    private readonly secret;
    private readonly requirePreflight;
    private readonly cookieId;
    private readonly hashFunction;
    constructor(options: CookieRateLimiterOptions);
    hash(event: RequestEvent): Promise<string | false>;
    preflight(event: RequestEvent): Promise<string>;
    private userIdFromCookie;
}
type HashFunction = (input: string) => Promise<string>;
export type RateLimiterOptions = Partial<{
    plugins: RateLimiterPlugin[];
    store: RateLimiterStore;
    maxItems: number;
    onLimited: (event: RequestEvent, reason: 'rate' | 'rejected') => Promise<void | boolean> | void | boolean;
    /**
     * @deprecated Add the IP/IPUA/cookie rates to the main object, no need for "rates".
     */
    rates: {
        /**
         * @deprecated Add the IP option to the main object, no need for "rates".
         */
        IP?: Rate;
        /**
         * @deprecated Add the IPUA option to the main object, no need for "rates".
         */
        IPUA?: Rate;
        /**
         * @deprecated Add cookie option to the main object, no need for "rates".
         */
        cookie?: CookieRateLimiterOptions;
    };
    IP?: Rate;
    IPUA?: Rate;
    cookie?: CookieRateLimiterOptions;
    hashFunction: HashFunction;
}>;
export declare class RateLimiter {
    private readonly store;
    private readonly plugins;
    private readonly onLimited;
    private readonly hashFunction;
    readonly cookieLimiter: CookieRateLimiter | undefined;
    static TTLTime(unit: RateUnit): number;
    /**
     * Check if a request event is rate limited.
     * @param {RequestEvent} event
     * @returns {Promise<boolean>} true if request is limited, false otherwise
     */
    isLimited(event: RequestEvent): Promise<boolean>;
    /**
     * Clear all rate limits.
     */
    clear(): Promise<void>;
    /**
     * Check if a request event is rate limited.
     * @param {RequestEvent} event
     * @returns {Promise<boolean>} true if request is limited, false otherwise
     */
    protected _isLimited(event: RequestEvent): Promise<{
        limited: boolean;
        hash: string | null;
        unit: RateUnit;
    }>;
    constructor(options?: RateLimiterOptions);
}
export declare class RetryAfterRateLimiter extends RateLimiter {
    private readonly retryAfter;
    constructor(options?: RateLimiterOptions, retryAfterStore?: RateLimiterStore);
    private static toSeconds;
    private static unitToSeconds;
    /**
     * Clear all rate limits.
     */
    clear(): Promise<void>;
    /**
     * Check if a request event is rate limited.
     * @param {RequestEvent} event
     * @returns {Promise<limited: boolean, retryAfter: number>} Rate limit status for the event.
     */
    check(event: RequestEvent): Promise<{
        limited: boolean;
        retryAfter: number;
    }>;
}
export {};