Files
ladill-care/app/Services/Events/ServiceEventSignature.php
isaaccladandCursor 6c9c742ed8
Deploy Ladill Care / deploy (push) Failing after 13s
Initial Ladill Care release.
Healthcare management app: patients, appointments, consultations, lab,
pharmacy inventory, billing, and reports at care.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 11:36:22 +00:00

24 lines
541 B
PHP

<?php
namespace App\Services\Events;
/**
* HMAC-SHA256 signing for platform service-event webhooks.
*/
class ServiceEventSignature
{
public static function sign(string $body, string $secret): string
{
return 'sha256='.hash_hmac('sha256', $body, $secret);
}
public static function verify(string $body, string $signature, string $secret): bool
{
if ($secret === '' || $signature === '') {
return false;
}
return hash_equals(self::sign($body, $secret), $signature);
}
}