/** * Storage Module * Safe storage wrapper with fallbacks for Safari private mode * SEC-03 Fix: Added encryption support for PII data */ interface StorageWrapper { get(key: string, defaultValue?: any): any; getString(key: string, defaultValue?: string | null): string | null; set(key: string, value: any): boolean; remove(key: string): boolean; keys(): string[]; getEncrypted(key: string, defaultValue?: any): Promise; setEncrypted(key: string, value: any): Promise; } declare class SafeStorage implements StorageWrapper { private storage; private memory; private prefix; constructor(storage?: Storage); get(key: string, defaultValue?: any): any; /** * Get a value as a RAW string, skipping the JSON.parse that get() applies. * * FSR-17: get() blindly JSON.parses, so a stored user_id like '12345' comes back as * the NUMBER 12345 after reload, and a 16+-digit snowflake id ('1234567890123456789') * is silently precision-corrupted (→ 1234567890123456800) — permanent identity * fragmentation. Identifiers (dl_user_id, dl_anonymous_id, dl_auto_identified_email) * must round-trip as the exact string they were stored as; use this for them. */ getString(key: string, defaultValue?: string | null): string | null; set(key: string, value: any): boolean; remove(key: string): boolean; keys(): string[]; /** * Migrate data from legacy '__dl_dl_*' keys to new 'dl_*' keys * * This fixes the double-prefix issue from earlier SDK versions. * Called automatically during SDK initialization. * * @returns Number of keys migrated */ migrateFromLegacyPrefix(): number; /** * Get encrypted value from storage (SEC-03 Fix) * * @param key - Storage key * @param defaultValue - Default value if not found * @returns Decrypted value */ getEncrypted(key: string, defaultValue?: any): Promise; /** * Set encrypted value in storage (SEC-03 Fix) * * FIXED (SEC-03): Now throws error if encryption fails instead of silent fallback * * @param key - Storage key * @param value - Value to encrypt and store * @returns Success boolean * @throws Error if encryption is not available or fails */ setEncrypted(key: string, value: any): Promise; } declare class CookieStorage { private domain; private maxAge; private sameSite; private secure; constructor(options?: { domain?: string | 'auto'; maxAge?: number; sameSite?: 'Strict' | 'Lax' | 'None'; secure?: boolean | 'auto'; }); get(name: string): string | null; set(name: string, value: string, days?: number): boolean; remove(name: string): boolean; /** * Auto-detect the best domain for cross-subdomain tracking */ private getAutoDomain; } export declare const storage: SafeStorage; export declare const sessionStorage: SafeStorage; export { CookieStorage }; export declare const cookies: CookieStorage; //# sourceMappingURL=storage.d.ts.map