UNPKG

create-request

Version:

A modern, chainable wrapper for fetch with automatic retries, timeouts, comprehensive error handling, and first-class TypeScript support

25 lines (24 loc) 903 B
/** * Utility class for CSRF token management */ export declare class CsrfUtils { /** * Extracts CSRF token from a meta tag in the document head * @param metaName The name attribute of the meta tag (default: "csrf-token") * @returns The CSRF token or null if not found */ static getTokenFromMeta(metaName?: string): string | null; /** * Extracts CSRF token from a cookie * @param cookieName The name of the cookie containing the CSRF token * @returns The CSRF token or null if not found */ static getTokenFromCookie(cookieName?: string): string | null; /** * Validates if the provided string is a potential CSRF token * Checks if the token meets security requirements * @param token The token to validate * @returns Whether the token is valid */ static isValidToken(token: string | null | undefined): boolean; }