/// Decrypt response - TRY APPROACH 1 static Map decryptSecureResponseApproach1( String secureResponseHex, String encryptedTokenBase64) { try { debugPrint('=== DECRYPTION APPROACH 1 ==='); // 1. Decrypt token final randKeyDecryptorKey = dotenv.env['RAND_KEY_DECRYPTOR_KEY']!; final randKeyDecryptorSalt = dotenv.env['RAND_KEY_DECRYPTOR_SALT']!; final decryptedTokenHex = _aes256DecryptFromBase64( encryptedTokenBase64, randKeyDecryptorKey, randKeyDecryptorSalt, ); debugPrint('1. Decrypted token (hex): $decryptedTokenHex'); debugPrint(' Length: ${decryptedTokenHex.length}'); // 2. Gunakan token hex langsung sebagai key string (bukan convert ke bytes) debugPrint('2. Using hex token directly as key string'); final secureTextSaltDecryptor = dotenv.env['SECURE_TEXT_SALT_DECRYPTOR']!; final decryptedResponse = _aes256DecryptFromHex( secureResponseHex, decryptedTokenHex, // Gunakan hex string langsung secureTextSaltDecryptor, ); debugPrint('3. Decrypted: $decryptedResponse'); return jsonDecode(decryptedResponse); } catch (e) { debugPrint('Approach 1 failed: $e'); rethrow; } }