Fix various code.

This commit is contained in:
James Cole
2025-05-27 17:06:15 +02:00
parent d8f512ca3a
commit 2cb14f6b72
123 changed files with 581 additions and 500 deletions

View File

@@ -24,10 +24,13 @@ declare(strict_types=1);
namespace FireflyIII\Helpers\Webhook;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\WebhookMessage;
use JsonException;
use function Safe\json_encode;
/**
* Class Sha3SignatureGenerator
*/
@@ -47,7 +50,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
$json = '';
try {
$json = \Safe\json_encode($message->message, JSON_THROW_ON_ERROR);
$json = json_encode($message->message, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
app('log')->error('Could not generate hash.');
app('log')->error(sprintf('JSON value: %s', $json));
@@ -63,7 +66,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
// The character .
// The character .
// The actual JSON payload (i.e., the request body)
$timestamp = time();
$timestamp = Carbon::now()->getTimestamp();
$payload = sprintf('%s.%s', $timestamp, $json);
$signature = hash_hmac('sha3-256', $payload, (string) $message->webhook->secret, false);