This commit is contained in:
2026-06-10 10:17:40 +07:00
parent 04983be23f
commit 0230fcff23
26 changed files with 718 additions and 1534 deletions

View File

@@ -193,15 +193,20 @@ impl RelayAuth {
fn auth(&self, req: &Arc<AuthRequest>, cx: &App) -> Task<Result<(), Error>> {
let nostr = NostrRegistry::global(cx);
let client = nostr.read(cx).client();
let req = req.clone();
let Some(signer) = nostr.read(cx).signer(cx) else {
return Task::ready(Err(anyhow!("Signer is required")));
};
// Get all pending events for the relay
let req = req.clone();
let pending_events = self.get_pending_events(req.url(), cx);
cx.background_spawn(async move {
// Construct event
let builder = EventBuilder::auth(req.challenge(), req.url().clone());
let event = client.sign_event_builder(builder).await?;
let event = EventBuilder::auth(req.challenge(), req.url().clone())
.finalize_async(&signer)
.await?;
// Get the event ID
let id = event.id;