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

chore: validate node config in middleware #229

Closed
wants to merge 4 commits into from

Conversation

im-adithya
Copy link
Member

Helps stop frontend from making requests before the setup process is complete.

@rolznz
Copy link
Contributor

rolznz commented Jan 22, 2024

hmm, sorry I wasn't clear on this one:

handle requests made before LNClient starts up - should return an error code if svc.lnClient is nil

I meant NIP-47 requests (because all of those will blow up if there is no lnClient)

I'm not sure if we need this and it looks hard to maintain since we have to check all config options for every backend type. Could we just improve the frontend redirect works?

But some of those checks might be good when initially setting up the node (but for the LND one you only need to specify either the hex or file options)

// if user == nil {
// return c.NoContent(http.StatusUnauthorized)
// }
if svc.lnClient == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good check but doesn't fit the name of the middleware, and is not related to the middleware that this would be for (checking if the user has unlocked NWC / has authed in http mode)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to ValidateNodeMiddleware

@rolznz
Copy link
Contributor

rolznz commented Jan 30, 2024

I cannot test this and am not sure if this is really needed. The frontend will not allow you to get in this state any more with the improved redirects from the onboarding branch that was merged. @im-adithya what do you think?

@rolznz
Copy link
Contributor

rolznz commented Feb 2, 2024

Closing for now. If you think we should re-open this please open a new PR at https://github.com/getAlby/nostr-wallet-connect-next

@rolznz rolznz closed this Feb 2, 2024
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

Successfully merging this pull request may close these issues.

2 participants