/** * Generate a deterministic hash from options object * Excludes _path so images with same options can be cached across pages * Optionally includes componentHash and version for cache busting */ export declare function hashOgImageOptions(options: Record, componentHash?: string, version?: string): string; /** * Encode OG image options into a URL path segment * @param options - The options to encode * @param defaults - Optional defaults to skip (values matching defaults won't be encoded) * @example encodeOgImageParams({ width: 1200, props: { title: 'Hello' } }) * // Returns: "w_1200,title_Hello" */ export declare function encodeOgImageParams(options: Record, defaults?: Record): string; /** * Decode URL path segment back into OG image options * @example decodeOgImageParams("w_1200,title_Hello") * // Returns: { width: 1200, props: { title: 'Hello' } } */ export declare function decodeOgImageParams(encoded: string): Record; export interface BuildOgImageUrlResult { url: string; hash?: string; } /** * Build full OG image URL * * When encoded params exceed MAX_PATH_LENGTH, falls back to hash mode: * - Returns short path: /_og/s/o_.png * - Returns hash in result for cache storage * * @param options - The options to encode * @param extension - Image extension (png, jpeg, etc.) * @param isStatic - Whether this is a static/prerendered image * @param defaults - Optional defaults to skip from URL (keeps URLs shorter) * @example buildOgImageUrl({ width: 1200, props: { title: 'Hello' } }, 'png', true) * // Returns: { url: "/_og/s/w_1200,title_Hello.png" } */ export declare function buildOgImageUrl(options: Record, extension?: string, isStatic?: boolean, defaults?: Record, secret?: string): BuildOgImageUrlResult; /** * Sign encoded params using a keyed hash (ohash, cross-runtime compatible). * Returns first 16 chars of the base64url hash for URL brevity. */ export declare function signEncodedParams(encoded: string, secret: string): string; /** * Verify a signature against encoded params. * Uses constant-time string comparison to prevent timing attacks. */ export declare function verifyOgImageSignature(encoded: string, signature: string, secret: string): boolean; /** * Parse OG image URL back into options * @example parseOgImageUrl("/_og/s/w_1200,h_600.png") * // Returns: { options: { width: 1200, height: 600 }, extension: 'png', isStatic: true, hash: undefined } * @example parseOgImageUrl("/_og/s/o_abc123.png") * // Returns: { options: {}, extension: 'png', isStatic: true, hash: 'abc123' } */ export declare function parseOgImageUrl(url: string): { options: Record; extension: string; isStatic: boolean; hash?: string; }; /** * Extract the encoded segment from the full path, handling the case where * %2F in prop values has been decoded to / by intermediaries (#522). * Uses the full catch-all match after /_og/d/ (or /_og/s/) instead of * only the last path segment. */ export declare function extractEncodedSegment(path: string, extension: string): string;