0

installed https://github.com/Ride-The-Lightning/c-lightning-REST/

my cl-rest-config.json is

{
    "PORT": 3001,
    "DOCPORT": 4001,
    "PROTOCOL": "http",
    "EXECMODE": "production",
    "LNRPCPATH":"~/.lightning/bitcoin/lightning-rpc",
    "RPCCOMMANDS": ["*"],
    "DOMAIN":"192.168.1.232"
}

launching cl-rest.js produces:

$ node cl-rest.js
Reading config file
warn: --- Starting the cl-rest server ---
warn: --- cl-rest api server is ready and listening on port: 3001 ---
warn: --- cl-rest doc server is ready and listening on port: 4001 ---

when I access http://localhost:3001/v1/getinfo through Firefox i got:

message: "Authentication Failed!"
error: "Bad Macaroon!"

under ~/Downloads/c-lightning-REST-0.9.0/certs are available:

access.macaroon
certificate.pem
rootKey.key

I generated the hex and base64 macaroons with the following index.js:

const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question('\ninsert the path of the macaroon file ', (macaroonPath) => {
    const macaroonHex = fs.readFileSync(macaroonPath).toString('hex');

    console.log(`\nhex-formatted macaroon: ${macaroonHex }`);

    const macaroonBase64 = fs.readFileSync(macaroonPath).toString('base64');

    console.log(`\nbase64-formatted macaroon: ${macaroonBase64 }`);

    rl.close();
});

but I do not know how to pass these to firefox

how do I have to launch Firefox to manage c-lightning-REST?

Roberto
  • 11
  • 2

1 Answers1

0

This might not be the best place to as your question. I suggest raising an issue on https://github.com/Ride-The-Lightning/c-lightning-REST/issues where they'll know what you're trying to accomplish. Specifically the error message "Bad Macaroon!" in the response seems like something specific to that software.

An off-the-cuff guess though is that Firefox does not trust the custom certificate (~/Downloads/c-lightning-REST-0.9.0/certs/certificate.pem) which came with the repo. You may have to follow instructions to add it to your trusted certificate store.

Alain
  • 26,663
  • 20
  • 114
  • 184