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

Clarify preimage format / encoding #8

Closed
philippgille opened this issue Aug 5, 2018 · 1 comment
Closed

Clarify preimage format / encoding #8

philippgille opened this issue Aug 5, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@philippgille
Copy link
Owner

Currently the value in the "x-preimage" header is required to be Base64, because that's the format that's used in listed invoices when executing lncli listinvoices. Not only for preimages, but also for their hashes.

But on the other hand the LightningClient's method LookupInvoice(...) expects a hex-encoded payment hash.

That's why in our package, when receiving a request with a correct x-preimage header, we need to:

  1. Base64 Decode the preimage
  2. Sha256 the previous value
  3. Hex the previous value
  4. Send it to lnd

So:

  1. Figure out which format is best for using in the header (Plain preimage, Base64 or hex)
  2. Change our implementation in case it's not Base64
  3. Document which format is expected
@philippgille philippgille added the enhancement New feature or request label Aug 5, 2018
@philippgille
Copy link
Owner Author

Closed by b1d5c04

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

No branches or pull requests

1 participant