isLoggedIn = NostrAuth::check(); if (! $this->isLoggedIn) { $this->nostrChallenge = NostrAuth::issueChallenge(); } } /** * JS-driven fallback: re-issue the challenge if the client cannot find * one in the rendered snapshot (e.g. after a long-lived tab where the * Volt component snapshot drifted out of sync with the session). */ public function requestNostrChallenge(): string { $challenge = NostrAuth::issueChallenge(); $this->nostrChallenge = $challenge; return $challenge; } #[On('nostrLoggedIn')] public function handleNostrLoggedIn($signedEvent = null): void { NostrAuth::loginWithSignedEvent($signedEvent); $this->js('window.location.reload(true);'); } #[On('nostrLoggedOut')] public function handleNostrLoggedOut(): void { $this->isLoggedIn = false; } } ?>