Solve key projectId backwards compatibility

This commit is contained in:
Matej Bačo
2026-04-28 16:35:40 +02:00
parent ccb0ddd578
commit 11f80fc2ed
+13 -2
View File
@@ -26,11 +26,22 @@ class V24 extends Filter
unset($content['sdks']);
unset($content['accessedAt']);
$projectId = '';
if (isset($content['secret'])) {
$parts = explode('_', $content['secret'], 2);
if (count($parts) === 2) {
$jwtParts = explode('.', $parts[1]);
if (count($jwtParts) >= 2) {
$payload = json_decode(base64_decode(str_replace(['-', '_'], ['+', '/'], $jwtParts[1])), true);
$projectId = $payload['projectId'] ?? '';
}
}
}
$content['projectId'] = $projectId;
$content['jwt'] = $content['secret'] ?? '';
unset($content['secret']);
$content['projectId'] = 'WHAT DO I DO NOW?!';
return $content;
}
}