mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix various code.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user