v0.5.0 (2018-09-24)
- Added: Support for c-lightning with Lightning Charge (issue #6)
- Note: The current implementation's performance decreases with the amount of invoices in the Lightning Charge server. This will be fixed in an upcoming release.
- Added: Package
pay
(issue #20)- Interface
pay.LNclient
- Abstraction of a Lightning Network node client for paying LN invoices. Enables developers to write their own implementations if the provided ones aren't enough. - Struct
pay.Client
- Replacement for a standard Gohttp.Client
- Factory function
NewClient(httpClient *http.Client, lnClient LNclient) Client
-httpClient
can be passed asnil
, leading tohttp.DefaultClient
being used - Method
Do(req *http.Request) (*http.Response, error)
- Meant to be used as equivalent to the same Gohttp.Client
method, but handles the Lightning Network payment in the background. - Method
Get(url string) (*http.Response, error)
- A convenience method for theDo(...)
method, also an equivalent to the same Gohttp.Client
method (regarding its usage)
- Factory function
- Example client in
examples/client/main.go
-
Note: Currently only
ln.LNDclient
can be used in the client, because Lightning Charge doesn't support sending payments (and maybe never will)
- Interface
- Added: Method
Pay(invoice string) (string, error)
forln.LNDclient
- Implements the newpay.LNclient
interface, so that theLNDclient
can be used as parameter in thepay.NewClient(...)
function. (Issue #20) - Fixed: A client could cheat in multiple ways, for example use a preimage for a request to endpoint A while the invoice was for endpoint B, with B being cheaper than A. Or if the LN node is used for other purposes as well, a client could send any preimage that might be for a totally different invoice, not related to the API at all. (Issue #16)
- Fixed: Some info logs were logged to
stderr
instead ofstdout
Breaking changes
- Changed: The preimage in the
X-Preimage
header must now be hex encoded instead of Base64 encoded. The hex encoded representation is the typical representation, as used by "lncli listpayments", Eclair on Android and bolt11 payment request decoders like https://lndecode.com. Base64 was used previously because "lncli listinvoices" uses that encoding. (Issue #8) - Changed: Interface
wall.StorageClient
and thus all its implementations in thestorage
package were significantly changed. The methods are now completely independent of any ln-paywall specifics, withSet(...)
andGet(...)
just setting and retrieving any arbitraryinterface{}
to/from the storage. (Required for issue #16.) - Changed: The method
GenerateInvoice(int64, string) (string, error)
in the interfacewall.LNclient
was changed to return aln.Invoice
object, which makes it much easier to access the invoice ID (a.k.a. preimage hash, a.k.a. payment hash), instead of having to decode the invoice. (Useful for issue #16, in which the invoice ID is required as key in the storage.)