getQueryParams()['src-time'] ?? null; $hash = $request->getQueryParams()['src-hash'] ?? null; if (empty($time) || !is_string($time) || empty($hash) || !is_string($hash)) { return new JsonResponse(['error' => 'Query params src-time` and src-hash` are required.'], 400); } $expectedHash = $this->hashService->hmac($time, 'server-response-check'); if (!hash_equals($expectedHash, $hash)) { return new JsonResponse(['error' => 'Invalid time or hash provided.'], 400); } if ((int)$time + 60 < time()) { return new JsonResponse(['error' => 'Request expired.'], 400); } return new JsonResponse([ 'server.HTTP_HOST' => $_SERVER['HTTP_HOST'] ?? null, 'server.SERVER_NAME' => $_SERVER['SERVER_NAME'] ?? null, 'server.SERVER_PORT' => $_SERVER['SERVER_PORT'] ?? null, ]); } }