Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIP-42: CLOSED in response to REQ when not authenticated #171

Open
verbiricha opened this issue Dec 31, 2023 · 4 comments
Open

NIP-42: CLOSED in response to REQ when not authenticated #171

verbiricha opened this issue Dec 31, 2023 · 4 comments

Comments

@verbiricha
Copy link
Contributor

verbiricha commented Dec 31, 2023

When submitting REQs to relays that require NIP-42 auth, some of them (for example eden.nostr.land) will send back an AUTH message and keep the REQ open until the client is authenticated, sending events for the REQs after successful authentication. Others (for example filter.nostr.wine) will send back a both an AUTH message and CLOSED message for the REQ with the auth-required prefix.

Is it possible for NDK to detect the second scenario and re-send the REQs that were CLOSED due to lack of authentication after successfully authenticating? I also think it'd be nice to include the reason string from the relay's CLOSED message when emitting the close event on a subscription, thoughts @pablof7z ?

@fiatjaf
Copy link
Contributor

fiatjaf commented Dec 31, 2023

The message is CLOSED, not CLOSE, right?

@verbiricha
Copy link
Contributor Author

verbiricha commented Dec 31, 2023 via email

@verbiricha verbiricha changed the title NIP-42: CLOSE in response to REQ when not authenticated NIP-42: CLOSED in response to REQ when not authenticated Jan 1, 2024
@jeremyd
Copy link
Contributor

jeremyd commented Jun 28, 2024

I am seeing this as well. I am trying to find in the code where it sees the CLOSED message from the relay itself, but as far as I can tell NDK is not tracking these kind of messages at all. It only closes subscriptions client side, it has no idea when a relay sends CLOSED on a sub, it only knows about EOSE.. Not sure how to work around this yet or if it can be fixed. Ideally you could subscribe to a CLOSED from the relay just like EOSE, and re-send the subscription after auth.

@jeremyd
Copy link
Contributor

jeremyd commented Jun 29, 2024

I ended up delaying the subscription until after auth, pasted some example code here if you are curious.

#246 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants