You can also consider making even stronger types for the $event array, instead constructing it as a class like
class SignedNostrEvent {
public function __construct(
public string $pubkey,
public string $id,
public string $sig,
public int $kind,
public string $content,
public array $tags,
public int $created_at
) {}
}
public function getEventHash(SignedNostrEvent $event): string
{
$serializedEvent = $this->serializeEvent(json_encode($event));
$eventHash = hash("sha256", $serializedEvent);
return $eventHash;
}
You can also consider making even stronger types for the $event array, instead constructing it as a class like