/* eslint-disable no-bitwise */ import { filterParams } from './buildUrlWithMetadata'; const ENCRYPTION_KEY = 'OmN1p@y$3cUr3K3y2024SDK'; export function encryptData(text: string): string { let hex = ''; try { for (let i = 0; i < text.length; i++) { const xorValue = text.charCodeAt(i) ^ ENCRYPTION_KEY.charCodeAt(i % ENCRYPTION_KEY.length); hex += xorValue.toString(16).padStart(2, '0'); } return hex; } catch (error) { console.error('Encryption error:', error); throw new Error('Failed to encrypt data'); } } export function encryptUrlParams( params: Record ): string { try { const filteredParams = filterParams(params); const jsonString = JSON.stringify(filteredParams); return encryptData(jsonString); } catch (error) { console.error('Encryption error:', error); throw new Error('Failed to encrypt data'); } }