@satoshibits/cache-keys
Version:
Type-safe cache key generation with zero dependencies
41 lines • 1.58 kB
text/typescript
import type { SanitizeOptions } from './types.mjs';
/**
* Default base64url decoder
*/
export declare function base64urlDecode(str: string): string;
/**
* Sanitize a cache key component to prevent injection attacks
* @param component The component to sanitize
* @param options Sanitization options
* @returns Sanitized component
*/
export declare function sanitizeKeyComponent(component: string, options?: SanitizeOptions): string;
/**
* Attempt to decode a potentially encoded component
* @param component The component that might be encoded
* @returns Decoded component or original if not encoded
*/
export declare function decodeKeyComponent(component: string): string;
/**
* Validate that a key component is safe to use
* @param component The component to validate
* @returns true if the component is safe
*/
export declare function isValidKeyComponent(component: string): boolean;
/**
* Join multiple components into a cache key
* @param components Components to join
* @param separator Separator between components
* @param sanitize Whether to sanitize components
* @returns Joined cache key
*/
export declare function joinKeyComponents(components: string[], separator?: string, sanitize?: boolean): string;
/**
* Split a cache key into components
* @param key The key to split
* @param separator Separator between components
* @param decode Whether to decode components
* @returns Array of components
*/
export declare function splitKeyComponents(key: string, separator?: string, decode?: boolean): string[];
//# sourceMappingURL=sanitizer.d.mts.map