Add Invoice Macaroon to Settings
We are adding a CLN connection to Zaprite. To make it easier for users to connect, it would be great if they had an option to copy an Invoice Macaroon from the Settings screen.
Maybe there could be a toggle to allow the user to choose which one they needed?
I am trying to create an "invoice" rune via the cli. i basically need a limited access rune to create an invoice and to read if that invoice was paid. i tried creating a macaroon (base64) using the cli:
lightning-cli createrune restrictions='[["method=invoice,method=listinvoices"]]'
But i get this error when hitting the rest api with the generated rune:
Bad Macaroon!
Any ideas (*note I am using the CLN app packaged in Umbrel)?
Restrictions are the array of alternatives, so your command should look something like:
lightning-cli createrune restrictions='[["method=invoice"], ["method=listinvoices"]]'
https://github.com/ElementsProject/cln-application/pull/56
Here is what I have it looking like.
@ShahanaFarooqui is the rest 'Macaroon' supposed to be blank?
Here is what I have it looking like. @ShahanaFarooqui is the rest 'Macaroon' supposed to be blank?
Do you have c-lightning-rest running? If yes, have you set APP_CORE_LIGHTNING_REST_CERT_DIR correctly in your environment for macaroon to be read successfully from the location?
Also, adding invoice rune on the c-lightning-rest screen doesn't make sense. It is the old rest API library which generates its own macaroon. It does not support runes. We do not have a connect screen & configured variables (like clnrest-port, host, etc.) required for clnrest library yet.
Oh okay thanks, so I'll update the pr to hide the Invoice Rune when REST is selected.
@john-zaprite c-lightning-REST only supports access.macaroon (admin). Without c-lightning-REST generating invoice macaroon, the UI cannot provide this information. Also, with upcoming sunset of c-lightning-REST, it will not be possible to add that in future also.
Thanks @evansmj for looking into this and writing the code!
@ShahanaFarooqui so would you recommend using LNMessage instead of the REST endpoint for Zaprite to connect to the core-lightning node? I think most of our uses are going to be running the version of CLN-App that is packaged up in Umbrel. https://github.com/aaronbarnardsound/lnmessage
There are many ways to connect to Core Lightning node as explained here. You can choose any one of them according to your requirement. lnmessage is a NodeJS commando client. For REST API solution, clnrest is the built-in Python REST server.
Updated https://github.com/ElementsProject/cln-application/pull/56 to hide Invoice Rune from the rest and grpc menus.
https://github.com/ElementsProject/cln-application/pull/56 is now merged if you would like to check out how it looks for the zaprite article screenshots @ntheile @john-zaprite
Closing with PR #56
Thanks @evansmj and @ShahanaFarooqui ! Super excited to integrate this into Zaprite!