HMAC not static
This commit is contained in:
@ -27,7 +27,7 @@ class Toku extends Ideal\Service
|
||||
protected Subscription $subscription;
|
||||
protected Invoice $invoice;
|
||||
|
||||
public function __construct(LoggerInterface $logger, protected Connection $connection)
|
||||
public function __construct(LoggerInterface $logger, protected Connection $connection, protected HMAC $hmac)
|
||||
{
|
||||
parent::__construct($logger);
|
||||
}
|
||||
@ -446,21 +446,9 @@ class Toku extends Ideal\Service
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($results as $secret) {
|
||||
$this->logger->info('Toku webhook validated', [
|
||||
'timestamp' => $timestamp,
|
||||
'signature' => $signature,
|
||||
'eventId' => $eventId,
|
||||
'eventType' => $eventType,
|
||||
'secret' => $secret,
|
||||
]);
|
||||
if (HMAC::validate($timestamp, $signature, $eventId, $secret)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*if (array_any($results, fn($secret) => HMAC::validate($timestamp, $signature, $eventId, $secret))) {
|
||||
if (array_any($results, fn($secret) => $this->hmac->validate($timestamp, $signature, $eventId, $secret))) {
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
|
||||
} catch (Throwable $throwable) {
|
||||
$this->logger->error($throwable);
|
||||
|
Reference in New Issue
Block a user