ACINQ / phoenix

Phoenix is a self-custodial Bitcoin wallet using Lightning to send/receive payments.
https://phoenix.acinq.co
Apache License 2.0
619 stars 93 forks source link

Display LNURL Error Reason #482

Closed robbiehanson closed 7 months ago

robbiehanson commented 7 months ago

Fixes issue #468

Initially this looked like a bug specific to iOS. But I found another problem in the shared kotlin layer:

The error returned from the referenced lnurl:

The problem is that we weren't properly following the LUD-01 spec:

HTTP Status Codes and Content-Type:

Neither status codes or any HTTP Header has any meaning. Servers may use whatever they want. Clients should ignore them (and be careful when using libraries that treat responses differently based on headers and status codes) and just parse the response body as JSON, then interpret it accordingly.

So even though the server returns a 404, since it also returns a valid JSON (that matches the spec with status=error & reason=string), we should be returning the given reason as a RemoteFailure.Detailed.