From 87f0673dff13f89b55db7567e4d488bdbcc967e7 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Thu, 17 Dec 2020 11:44:16 -0800 Subject: [PATCH] configurable creds --- dist/src/utils/lightning.js | 4 ++-- dist/src/utils/lightning.js.map | 2 +- dist/src/utils/macaroon.js | 8 ++++++-- dist/src/utils/macaroon.js.map | 2 +- dist/src/utils/signer.js | 2 +- dist/src/utils/signer.js.map | 2 +- src/utils/lightning.ts | 4 ++-- src/utils/macaroon.ts | 8 ++++++-- src/utils/signer.ts | 2 +- 9 files changed, 21 insertions(+), 13 deletions(-) diff --git a/dist/src/utils/lightning.js b/dist/src/utils/lightning.js index 004820f..06d4696 100644 --- a/dist/src/utils/lightning.js +++ b/dist/src/utils/lightning.js @@ -27,10 +27,10 @@ const SPHINX_CUSTOM_RECORD_KEY = 133773310; exports.SPHINX_CUSTOM_RECORD_KEY = SPHINX_CUSTOM_RECORD_KEY; var lightningClient = null; var walletUnlocker = null; -const loadCredentials = () => { +const loadCredentials = (macName) => { var lndCert = fs.readFileSync(config.tls_location); var sslCreds = grpc.credentials.createSsl(lndCert); - var macaroon = macaroon_1.getMacaroon(); + var macaroon = macaroon_1.getMacaroon(macName); var metadata = new grpc.Metadata(); metadata.add('macaroon', macaroon); var macaroonCreds = grpc.credentials.createFromMetadataGenerator((_args, callback) => { diff --git a/dist/src/utils/lightning.js.map b/dist/src/utils/lightning.js.map index a1ceb90..a0ec326 100644 --- a/dist/src/utils/lightning.js.map +++ b/dist/src/utils/lightning.js.map @@ -1 +1 @@ -{"version":3,"file":"lightning.js","sourceRoot":"","sources":["../../../src/utils/lightning.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,yCAAwC;AACxC,yBAAwB;AACxB,6BAA4B;AAC5B,wCAAmC;AACnC,iCAAgC;AAChC,iCAAgC;AAChC,4CAAoC;AACpC,yCAAwC;AACxC,qCAAmC;AAEnC,kDAAkD;AAClD,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;A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ACL,MAAM,CAAC,GAAG,CAAC,CAAA;iBACZ;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA;AAgDC,oCAAY;AA9Cd,SAAe,cAAc;;QAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,SAAS,GAAG,aAAa,EAAE,CAAA;YACjC,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,GAAG,EAAE,QAAQ;gBAClD,IAAI,GAAG,IAAI,IAAI,EAAE;oBACf,OAAO,CAAC,QAAQ,CAAC,CAAA;iBAClB;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,CAAA;iBACZ;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA;AAoCC,wCAAc;AAlChB,SAAS,aAAa,CAAC,GAAG;IACxB,IAAI,IAAI,GAAa,EAAE,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAI,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAChB;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/dist/src/utils/macaroon.js b/dist/src/utils/macaroon.js index 16057c5..b4339f4 100644 --- a/dist/src/utils/macaroon.js +++ b/dist/src/utils/macaroon.js @@ -4,12 +4,16 @@ const fs = require("fs"); const config_1 = require("./config"); const config = config_1.loadConfig(); let inMemoryMacaroon = ''; // hex encoded -function getMacaroon() { +function getMacaroon(macName) { if (config.unlock) { return inMemoryMacaroon; } else { - const m = fs.readFileSync(config.macaroon_location); + let macLocation = config.macaroon_location; + if (macName) { + macLocation = macLocation.replace(/admin.macaroon/, macName); + } + const m = fs.readFileSync(macLocation); return m.toString('hex'); } } diff --git a/dist/src/utils/macaroon.js.map b/dist/src/utils/macaroon.js.map index 12cae38..480718c 100644 --- a/dist/src/utils/macaroon.js.map +++ b/dist/src/utils/macaroon.js.map @@ -1 +1 @@ -{"version":3,"file":"macaroon.js","sourceRoot":"","sources":["../../../src/utils/macaroon.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AACxB,qCAAmC;AAEnC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAE3B,IAAI,gBAAgB,GAAW,EAAE,CAAC,CAAC,cAAc;AAEjD,SAAgB,WAAW;IACzB,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,OAAO,gBAAgB,CAAA;KACxB;SAAM;QACL,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;QACnD,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC1B;AACH,CAAC;AAPD,kCAOC;AAED,SAAgB,mBAAmB,CAAC,GAAW;IAC7C,gBAAgB,GAAG,GAAG,CAAA;AACxB,CAAC;AAFD,kDAEC"} \ No newline at end of file +{"version":3,"file":"macaroon.js","sourceRoot":"","sources":["../../../src/utils/macaroon.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AACxB,qCAAmC;AAEnC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAE3B,IAAI,gBAAgB,GAAW,EAAE,CAAC,CAAC,cAAc;AAEjD,SAAgB,WAAW,CAAC,OAAe;IACzC,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,OAAO,gBAAgB,CAAA;KACxB;SAAM;QACL,IAAI,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAA;QAC1C,IAAG,OAAO,EAAE;YACV,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;SAC7D;QACD,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QACtC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC1B;AACH,CAAC;AAXD,kCAWC;AAED,SAAgB,mBAAmB,CAAC,GAAW;IAC7C,gBAAgB,GAAG,GAAG,CAAA;AACxB,CAAC;AAFD,kDAEC"} \ No newline at end of file diff --git a/dist/src/utils/signer.js b/dist/src/utils/signer.js index 687dea6..9b6c849 100644 --- a/dist/src/utils/signer.js +++ b/dist/src/utils/signer.js @@ -23,7 +23,7 @@ exports.loadSigner = () => { } else { try { - var credentials = lightning_1.loadCredentials(); + var credentials = lightning_1.loadCredentials('signer.macaroon'); var lnrpcDescriptor = grpc.load("proto/signer.proto"); var signer = lnrpcDescriptor.signrpc; signerClient = new signer.Signer(LND_IP + ':' + config.lnd_port, credentials); diff --git a/dist/src/utils/signer.js.map b/dist/src/utils/signer.js.map index 126ef75..e61d792 100644 --- a/dist/src/utils/signer.js.map +++ b/dist/src/utils/signer.js.map @@ -1 +1 @@ -{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../src/utils/signer.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,6BAA4B;AAC5B,2CAA6C;AAC7C,yCAAwC;AACxC,qCAAmC;AAEnC,kDAAkD;AAClD,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,WAAW,CAAA;AAE3C,IAAI,YAAY,GAAQ,IAAI,CAAC;AAEhB,QAAA,UAAU,GAAG,GAAG,EAAE;IAC7B,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAA;KACpB;SAAM;QACL,IAAI;YACF,IAAI,WAAW,GAAG,2BAAe,EAAE,CAAA;YACnC,IAAI,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACtD,IAAI,MAAM,G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AAM,CAAC,CAAA;SACR;IACH,CAAC;CAAA;AAPD,kCAOC;AAED,SAAS,aAAa,CAAC,GAAG;IACxB,IAAI,IAAI,GAAa,EAAE,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAI,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAChB;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/src/utils/lightning.ts b/src/utils/lightning.ts index fe81c62..67c5659 100644 --- a/src/utils/lightning.ts +++ b/src/utils/lightning.ts @@ -18,10 +18,10 @@ const SPHINX_CUSTOM_RECORD_KEY = 133773310 var lightningClient = null; var walletUnlocker = null; -const loadCredentials = () => { +const loadCredentials = (macName?:string) => { var lndCert = fs.readFileSync(config.tls_location); var sslCreds = grpc.credentials.createSsl(lndCert); - var macaroon = getMacaroon() + var macaroon = getMacaroon(macName) var metadata = new grpc.Metadata() metadata.add('macaroon', macaroon) var macaroonCreds = grpc.credentials.createFromMetadataGenerator((_args, callback) => { diff --git a/src/utils/macaroon.ts b/src/utils/macaroon.ts index 834f114..5ee8099 100644 --- a/src/utils/macaroon.ts +++ b/src/utils/macaroon.ts @@ -5,11 +5,15 @@ const config = loadConfig() let inMemoryMacaroon: string = ''; // hex encoded -export function getMacaroon() { +export function getMacaroon(macName?:string) { if (config.unlock) { return inMemoryMacaroon } else { - const m = fs.readFileSync(config.macaroon_location) + let macLocation = config.macaroon_location + if(macName) { + macLocation = macLocation.replace(/admin.macaroon/, macName) + } + const m = fs.readFileSync(macLocation) return m.toString('hex'); } } diff --git a/src/utils/signer.ts b/src/utils/signer.ts index ba37c22..6571d57 100644 --- a/src/utils/signer.ts +++ b/src/utils/signer.ts @@ -15,7 +15,7 @@ export const loadSigner = () => { return signerClient } else { try { - var credentials = loadCredentials() + var credentials = loadCredentials('signer.macaroon') var lnrpcDescriptor = grpc.load("proto/signer.proto"); var signer: any = lnrpcDescriptor.signrpc signerClient = new signer.Signer(LND_IP + ':' + config.lnd_port, credentials);