stackernews / stacker.news

Internet communities that pay you Bitcoin
https://stacker.news
MIT License
419 stars 106 forks source link

Enable SN in Breez (with WebLN) #46

Closed notnout closed 7 months ago

notnout commented 2 years ago

WebLN is a pre-requisite for the app to be included in Breez and other lightning apps.

The implementation can be fairly simple, https://webln.dev/#/ and when ready worth pinging some of the teams like Breez to include SN there. This would be both useful and also good marketing ;)

huumn commented 2 years ago

We already have support for it on invoice/withdrawal. https://github.com/stackernews/stacker.news/issues/35 Is there some functionality I'm missing?

notnout commented 2 years ago

Then I guess the main missing point is sending PR to Breez to enable it there? :)

huumn commented 2 years ago

Submitted relevant assets to Breez. Waiting for ball to come back to my court.

huumn commented 2 years ago

The current blocker is implementing this https://github.com/breez/breezmobile/wiki/Adding-a-WebLN-widget-with-LNURL-Auth ... unfortunately it requires me to implement a novel auth flow just for Breez .

(I wish they'd save credentials by just stashing browser cookies - it'd allow web apps to onboard without having to do anything new with regard to auth regardless of the way the app auths users because they likely all use cookies anyway.)

huumn commented 2 years ago

Note to self: To get this to work I'll have to create a server-side version of this function and then inspect the resulting cookies to grab the jwt https://github.com/nextauthjs/next-auth/blob/78fa33312f4d64b74e01ee479ba4faedf3980f71/src/client/index.js#L177-L238

More on this: Given we aren't being called from a client browser, I'll also probably need to make another request to get a csrf token and then make the above request with the token. This is outlined here https://github.com/nextauthjs/next-auth/discussions/1627.