Evan Feenstra
4 years ago
committed by
GitHub
75 changed files with 2282 additions and 599 deletions
@ -1 +1 @@ |
|||||
{"version":3,"file":"app.js","sourceRoot":"","sources":["../app.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAkC;AAClC,0CAAyC;AACzC,iCAAgC;AAChC,8CAA6C;AAC7C,6BAA4B;AAC5B,iCAAgC;AAChC,6BAA4B;AAC5B,yCAAmC;AACnC,+CAAuC;AACvC,mCAAkE;AAClE,6CAA0D;AAC1D,iDAAgD;AAChD,6CAA4C;AAC5C,yCAAwC;AAExC,IAAI,MAAM,GAAQ,IAAI,CAAA;AACtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACrE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC,cAAc,IAAI,IAAI,CAAA;AAE9D,OAAO,CAAC,GAAG,CAAC,SAAS,EAAC,GAAG,CAAC,CAAA;AAC1B,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACpD,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAC,MAAM,CAAC,cAAc,CAAC,CAAA;AAE9D,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,YAAY,CAAA;AAEjD,IAAI,CAAC,GAAG,CAAC,CAAA;AAET,eAAe;AACf,SAAe,KAAK;;QACnB,MAAM,qBAAa,EAAE,CAAA;QACrB,YAAY,EAAE,CAAA;QACd,qBAAe,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;CAAA;AACD,KAAK,EAAE,CAAA;AAEP,SAAe,YAAY;;QAC1B,CAAC,EAAE,CAAA;QACH,OAAO,CAAC,GAAG,CAAC,mCAAmC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IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;QAEhD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YAC3B,IAAI,GAAG;gBAAE,MAAM,GAAG,CAAC;YACnB,+BAA+B;YAC/B,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,GAAG,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,oBAAoB;QACpB,IAAG,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACtB,OAAO,EAAE,CAAA;SACT;aAAM;YACN,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,UAAe,GAAG,EAAC,GAAG;;oBACzC,MAAM,EAAE,GAAG,MAAM,eAAQ,CAAC,GAAG,EAAC,GAAG,CAAC,CAAA;oBAClC,IAAG,EAAE,EAAE;wBACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;wBACjC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;wBACrB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;wBACtB,OAAO,EAAE,CAAA;qBACT;gBACF,CAAC;aAAA,CAAC,CAAA;SACF;IAEF,CAAC,CAAC,CAAA;AACH,CAAC"} |
@ -0,0 +1,136 @@ |
|||||
|
"use strict"; |
||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { |
||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
||||
|
return new (P || (P = Promise))(function (resolve, reject) { |
||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
||||
|
}); |
||||
|
}; |
||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
|
const crypto = require("crypto"); |
||||
|
const models_1 = require("./models"); |
||||
|
const cryptoJS = require("crypto-js"); |
||||
|
const path = require("path"); |
||||
|
const res_1 = require("./utils/res"); |
||||
|
const macaroon_1 = require("./utils/macaroon"); |
||||
|
const fs = require('fs'); |
||||
|
const env = process.env.NODE_ENV || 'development'; |
||||
|
const config = require(path.join(__dirname, '../config/app.json'))[env]; |
||||
|
/* |
||||
|
"unlock": true, |
||||
|
"encrypted_macaroon_path": "/relay/.lnd/admin.macaroon.enc" |
||||
|
*/ |
||||
|
function unlocker(req, res) { |
||||
|
return __awaiter(this, void 0, void 0, function* () { |
||||
|
const { password } = req.body; |
||||
|
if (!password) { |
||||
|
res_1.failure(res, 'no password'); |
||||
|
return false; |
||||
|
} |
||||
|
const encMacPath = config.encrypted_macaroon_path; |
||||
|
if (!encMacPath) { |
||||
|
res_1.failure(res, 'no macaroon path'); |
||||
|
return false; |
||||
|
} |
||||
|
let hexMac; |
||||
|
try { |
||||
|
var encMac = fs.readFileSync(config.encrypted_macaroon_path, "utf8"); |
||||
|
if (!encMac) { |
||||
|
res_1.failure(res, 'no macaroon'); |
||||
|
return false; |
||||
|
} |
||||
|
console.log("PWD", password, typeof password); |
||||
|
console.log("ENCMAC", encMac, typeof encMac); |
||||
|
const decMac = decryptMacaroon(password, encMac); |
||||
|
if (!decMac) { |
||||
|
res_1.failure(res, 'failed to decrypt macaroon'); |
||||
|
return false; |
||||
|
} |
||||
|
hexMac = base64ToHex(decMac); |
||||
|
} |
||||
|
catch (e) { |
||||
|
res_1.failure(res, e); |
||||
|
return false; |
||||
|
} |
||||
|
if (hexMac) { |
||||
|
macaroon_1.setInMemoryMacaroon(hexMac); |
||||
|
res_1.success(res, 'success!'); |
||||
|
return true; |
||||
|
} |
||||
|
else { |
||||
|
res_1.failure(res, 'failed to set macaroon in memory'); |
||||
|
return false; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
exports.unlocker = unlocker; |
||||
|
function authModule(req, res, next) { |
||||
|
return __awaiter(this, void 0, void 0, function* () { |
||||
|
if (req.path == '/app' || |
||||
|
req.path == '/' || |
||||
|
req.path == '/unlock' || |
||||
|
req.path == '/info' || |
||||
|
req.path == '/action' || |
||||
|
req.path == '/contacts/tokens' || |
||||
|
req.path == '/latest' || |
||||
|
req.path.startsWith('/static') || |
||||
|
req.path == '/contacts/set_dev') { |
||||
|
next(); |
||||
|
return; |
||||
|
} |
||||
|
if (process.env.HOSTING_PROVIDER === 'true') { |
||||
|
// const domain = process.env.INVITE_SERVER
|
||||
|
const host = req.headers.origin; |
||||
|
console.log('=> host:', host); |
||||
|
const referer = req.headers.referer; |
||||
|
console.log('=> referer:', referer); |
||||
|
if (req.path === '/invoices') { |
||||
|
next(); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
const token = req.headers['x-user-token'] || req.cookies['x-user-token']; |
||||
|
if (token == null) { |
||||
|
res.writeHead(401, 'Access invalid for user', { 'Content-Type': 'text/plain' }); |
||||
|
res.end('Invalid credentials'); |
||||
|
} |
||||
|
else { |
||||
|
const user = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); |
||||
|
const hashedToken = crypto.createHash('sha256').update(token).digest('base64'); |
||||
|
if (user.authToken == null || user.authToken != hashedToken) { |
||||
|
res.writeHead(401, 'Access invalid for user', { 'Content-Type': 'text/plain' }); |
||||
|
res.end('Invalid credentials'); |
||||
|
} |
||||
|
else { |
||||
|
next(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
exports.authModule = authModule; |
||||
|
function decryptMacaroon(password, macaroon) { |
||||
|
try { |
||||
|
const decrypted = cryptoJS.AES.decrypt(macaroon || '', password).toString(cryptoJS.enc.Base64); |
||||
|
const decryptResult = atob(decrypted); |
||||
|
return decryptResult; |
||||
|
} |
||||
|
catch (e) { |
||||
|
console.error('cipher mismatch, macaroon decryption failed'); |
||||
|
console.error(e); |
||||
|
return ''; |
||||
|
} |
||||
|
} |
||||
|
function base64ToHex(str) { |
||||
|
const raw = atob(str); |
||||
|
let result = ''; |
||||
|
for (let i = 0; i < raw.length; i++) { |
||||
|
const hex = raw.charCodeAt(i).toString(16); |
||||
|
result += (hex.length === 2 ? hex : '0' + hex); |
||||
|
} |
||||
|
return result.toUpperCase(); |
||||
|
} |
||||
|
exports.base64ToHex = base64ToHex; |
||||
|
const atob = a => Buffer.from(a, 'base64').toString('binary'); |
||||
|
//# sourceMappingURL=auth.js.map
|
@ -0,0 +1 @@ |
|||||
|
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAgC;AAChC,qCAAiC;AACjC,sCAAqC;AACrC,6BAA4B;AAC5B,qCAA8C;AAC9C,+CAAoD;AACpD,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAExB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAExE;;;EAGE;AAEF,SAAsB,QAAQ,CAAC,GAAG,EAAE,GAAG;;QACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,IAAI,CAAA;QAC7B,IAAG,CAAC,QAAQ,EAAE;YACZ,aAAO,CAAC,GAAG,EAAE,aAAa,CAAC,CAAA;YAC3B,OAAO,KAAK,CAAA;SACb;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,uBAAuB,CAAA;QACjD,IAAG,CAAC,UAAU,EAAE;YACd,aAAO,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAA;YAChC,OAAO,KAAK,CAAA;SACb;QAED,IAAI,MAAa,CAAA;QAEjB,IAAI;YAEF,IAAI,MAAM,GAAG,EAAE,CAAC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,EAAE,EAAE;QACpB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;QACnB,cAAc,EAAE,EAAE;QAClB,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,EAAE;QACf,wBAAwB,EAAE,EAAE;QAC5B,SAAS,EAAE,EAAE;KACd;IACD,cAAc,EAAE;QACd,SAAS,EAAE,WAAW;QACtB,UAAU,EAAE,sBAAsB;QAClC,OAAO,EAAE,OAAO;QAChB,2BAA2B,EAAE,2BAA2B;QACxD,SAAS,EAAE,SAAS;KACrB;IACD,UAAU,EAAE;QACV,cAAc,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;KACX;IACD,SAAS,EAAE;QACT,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;KACZ;IACD,UAAU,EAAE;QACV,GAAG,EAAE,CAAC;QACN,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;KACZ;CACF,CAAA;AAED,kBAAe,SAAS,CAAA"} |
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;AAAA,MAAM,SAAS,GAAG;IAChB,cAAc,EAAE,CAAC;IACjB,eAAe,EAAE;QACf,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,CAAC;QAChB,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;KACrB;IACD,gBAAgB,EAAE;QAChB,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;KACf;IACD,QAAQ,EAAE;QACR,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,CAAC;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SAAS,EAAE;QACT,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;KACZ;IACD,UAAU,EAAE;QACV,GAAG,EAAE,CAAC;QACN,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;KACZ;CACF,CAAA;AAED,kBAAe,SAAS,CAAA"} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@ |
|||||
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../src/models/ts/message.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAGtE,IAAqB,OAAO,GAA5B,MAAqB,OAAQ,SAAQ,4BAAc;CA2FlD,CAAA;AAnFC;IANC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC;;mCACQ;AAGV;IADC,6BAAM;;qCACK;AAGZ;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;uCACV;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;qCACZ;AAGZ;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;uCACV;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;yCACR;AAGhB;IADC,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC;;uCACX;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC;;2CACP;AAGlB;IADC,6BAAM;;4CACY;AAGnB;IADC,6BAAM,CAAC,+BAAQ,CAAC,IAAI,CAAC;;+CACA;AAGtB;IADC,6BAAM;8BACD,IAAI;qCAAA;AAGV;IADC,6BAAM;8BACS,IAAI;+CAAA;AAGpB;IADC,6BAAM,CAAC,+BAAQ,CAAC,IAAI,CAAC;;+CACA;AAGtB;IADC,6BAAM,CAAC,+BAAQ,CAAC,IAAI,CAAC;;qDACM;AAG5B;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;uCACV;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,IAAI,CAAC;;0CACL;AAGjB;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;yCACR;AAGhB;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;+CACF;AAGtB;IADC,6BAAM;;yCACS;AAGhB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM;;2CACW;AAOlB;IALC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,OAAO;QACtB,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,KAAK;KACjB,CAAC;;qCACW;AAGb;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;;4CACY;AAGnB;IADC,6BAAM;;6CACa;AAGpB;IADC,6BAAM;;0CACU;AA1FE,OAAO;IAD3B,4BAAK,CAAC,EAAC,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACpC,OAAO,CA2F3B;kBA3FoB,OAAO"} |
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../src/models/ts/message.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAGtE,IAAqB,OAAO,GAA5B,MAAqB,OAAQ,SAAQ,4BAAc;CA8FlD,CAAA;AAtFC;IANC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,UAAU,EAA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8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;;4CACY;AAGnB;IADC,6BAAM;;6CACa;AAGpB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC;;6CACL;AA7FD,OAAO;IAD3B,4BAAK,CAAC,EAAC,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACpC,OAAO,CA8F3B;kBA9FoB,OAAO"} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,22 @@ |
|||||
|
"use strict"; |
||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
|
const fs = require("fs"); |
||||
|
const path = require("path"); |
||||
|
const env = process.env.NODE_ENV || 'development'; |
||||
|
const config = require(path.join(__dirname, '../../config/app.json'))[env]; |
||||
|
let inMemoryMacaroon = ''; // hex encoded
|
||||
|
function getMacaroon() { |
||||
|
if (config.unlock) { |
||||
|
return inMemoryMacaroon; |
||||
|
} |
||||
|
else { |
||||
|
const m = fs.readFileSync(config.macaroon_location); |
||||
|
return m.toString('hex'); |
||||
|
} |
||||
|
} |
||||
|
exports.getMacaroon = getMacaroon; |
||||
|
function setInMemoryMacaroon(mac) { |
||||
|
inMemoryMacaroon = mac; |
||||
|
} |
||||
|
exports.setInMemoryMacaroon = setInMemoryMacaroon; |
||||
|
//# sourceMappingURL=macaroon.js.map
|
@ -0,0 +1 @@ |
|||||
|
{"version":3,"file":"macaroon.js","sourceRoot":"","sources":["../../../src/utils/macaroon.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AACxB,6BAA4B;AAE5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAA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generator) { |
||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
||||
|
return new (P || (P = Promise))(function (resolve, reject) { |
||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
||||
|
}); |
||||
|
}; |
||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
|
const path = require("path"); |
||||
|
const lightning_1 = require("./lightning"); |
||||
|
const fs = require('fs'); |
||||
|
const readline = require('readline'); |
||||
|
const env = process.env.NODE_ENV || 'development'; |
||||
|
const config = require(path.join(__dirname, '../../config/app.json'))[env]; |
||||
|
console.log(JSON.stringify(config, null, 2)); |
||||
|
/* |
||||
|
"lnd_pwd_path": "/relay/.lnd/.lndpwd" |
||||
|
*/ |
||||
|
function tryToUnlockLND() { |
||||
|
return __awaiter(this, void 0, void 0, function* () { |
||||
|
const p = config.lnd_pwd_path; |
||||
|
if (!p) |
||||
|
return; |
||||
|
console.log('==>', p); |
||||
|
var pwd = yield getFirstLine(config.lnd_pwd_path); |
||||
|
if (!pwd) |
||||
|
return; |
||||
|
console.log('==>', pwd, typeof pwd); |
||||
|
try { |
||||
|
yield lightning_1.unlockWallet(String(pwd)); |
||||
|
} |
||||
|
catch (e) { |
||||
|
console.log('[unlock] Error:', e); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
exports.tryToUnlockLND = tryToUnlockLND; |
||||
|
function getFirstLine(pathToFile) { |
||||
|
return __awaiter(this, void 0, void 0, function* () { |
||||
|
const readable = fs.createReadStream(pathToFile); |
||||
|
const reader = readline.createInterface({ input: readable }); |
||||
|
const line = yield new Promise((resolve) => { |
||||
|
reader.on('line', (line) => { |
||||
|
reader.close(); |
||||
|
resolve(line); |
||||
|
}); |
||||
|
}); |
||||
|
readable.close(); |
||||
|
return line; |
||||
|
}); |
||||
|
} |
||||
|
//# sourceMappingURL=unlock.js.map
|
@ -0,0 +1 @@ |
|||||
|
{"version":3,"file":"unlock.js","sourceRoot":"","sources":["../../../src/utils/unlock.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,2CAA0C;AAC1C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAErC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE1E,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC,CAAA;AAE1C;;EAEE;AAEF,SAAsB,cAAc;;QAChC,MAAM,CAAC,GAAG,MAAM,CAAC,YAAY,CAAA;QAC7B,IAAI,CAAC,CAAC;YAAE,OAAM;QAEd,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,CAAC,CAAC,CAAA;QAEpB,IAAI,GAAG,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAClD,IAAG,CAAC,GAAG;YAAE,OAAM;QAEf,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,GAAG,EAAC,OAAO,GAAG,CAAC,CAAA;QAEjC,IAAI;YACA,MAAM,wBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;SAClC;QAAC,OAAM,CAAC,EAAE;YACP,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAC,CAAC,CAAC,CAAA;SACnC;IACL,CAAC;CAAA;AAhBD,wCAgBC;AAED,SAAe,YAAY,CAAC,UAAU;;QAClC,MAAM,QAAQ,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACvC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvB,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA"} |
@ -0,0 +1,661 @@ |
|||||
|
syntax = "proto3"; |
||||
|
|
||||
|
import "rpc.proto"; |
||||
|
|
||||
|
package routerrpc; |
||||
|
|
||||
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc"; |
||||
|
|
||||
|
// Router is a service that offers advanced interaction with the router |
||||
|
// subsystem of the daemon. |
||||
|
service Router { |
||||
|
/* |
||||
|
SendPaymentV2 attempts to route a payment described by the passed |
||||
|
PaymentRequest to the final destination. The call returns a stream of |
||||
|
payment updates. |
||||
|
*/ |
||||
|
rpc SendPaymentV2 (SendPaymentRequest) returns (stream lnrpc.Payment); |
||||
|
|
||||
|
/* |
||||
|
TrackPaymentV2 returns an update stream for the payment identified by the |
||||
|
payment hash. |
||||
|
*/ |
||||
|
rpc TrackPaymentV2 (TrackPaymentRequest) returns (stream lnrpc.Payment); |
||||
|
|
||||
|
/* |
||||
|
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it |
||||
|
may cost to send an HTLC to the target end destination. |
||||
|
*/ |
||||
|
rpc EstimateRouteFee (RouteFeeRequest) returns (RouteFeeResponse); |
||||
|
|
||||
|
/* |
||||
|
Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via |
||||
|
the specified route. This method differs from SendPayment in that it |
||||
|
allows users to specify a full route manually. This can be used for |
||||
|
things like rebalancing, and atomic swaps. It differs from the newer |
||||
|
SendToRouteV2 in that it doesn't return the full HTLC information. |
||||
|
*/ |
||||
|
rpc SendToRoute (SendToRouteRequest) returns (SendToRouteResponse) { |
||||
|
option deprecated = true; |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
SendToRouteV2 attempts to make a payment via the specified route. This |
||||
|
method differs from SendPayment in that it allows users to specify a full |
||||
|
route manually. This can be used for things like rebalancing, and atomic |
||||
|
swaps. |
||||
|
*/ |
||||
|
rpc SendToRouteV2 (SendToRouteRequest) returns (lnrpc.HTLCAttempt); |
||||
|
|
||||
|
/* |
||||
|
ResetMissionControl clears all mission control state and starts with a clean |
||||
|
slate. |
||||
|
*/ |
||||
|
rpc ResetMissionControl (ResetMissionControlRequest) |
||||
|
returns (ResetMissionControlResponse); |
||||
|
|
||||
|
/* |
||||
|
QueryMissionControl exposes the internal mission control state to callers. |
||||
|
It is a development feature. |
||||
|
*/ |
||||
|
rpc QueryMissionControl (QueryMissionControlRequest) |
||||
|
returns (QueryMissionControlResponse); |
||||
|
|
||||
|
/* |
||||
|
QueryProbability returns the current success probability estimate for a |
||||
|
given node pair and amount. |
||||
|
*/ |
||||
|
rpc QueryProbability (QueryProbabilityRequest) |
||||
|
returns (QueryProbabilityResponse); |
||||
|
|
||||
|
/* |
||||
|
BuildRoute builds a fully specified route based on a list of hop public |
||||
|
keys. It retrieves the relevant channel policies from the graph in order to |
||||
|
calculate the correct fees and time locks. |
||||
|
*/ |
||||
|
rpc BuildRoute (BuildRouteRequest) returns (BuildRouteResponse); |
||||
|
|
||||
|
/* |
||||
|
SubscribeHtlcEvents creates a uni-directional stream from the server to |
||||
|
the client which delivers a stream of htlc events. |
||||
|
*/ |
||||
|
rpc SubscribeHtlcEvents (SubscribeHtlcEventsRequest) |
||||
|
returns (stream HtlcEvent); |
||||
|
|
||||
|
/* |
||||
|
Deprecated, use SendPaymentV2. SendPayment attempts to route a payment |
||||
|
described by the passed PaymentRequest to the final destination. The call |
||||
|
returns a stream of payment status updates. |
||||
|
*/ |
||||
|
rpc SendPayment (SendPaymentRequest) returns (stream PaymentStatus) { |
||||
|
option deprecated = true; |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for |
||||
|
the payment identified by the payment hash. |
||||
|
*/ |
||||
|
rpc TrackPayment (TrackPaymentRequest) returns (stream PaymentStatus) { |
||||
|
option deprecated = true; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
HtlcInterceptor dispatches a bi-directional streaming RPC in which |
||||
|
Forwarded HTLC requests are sent to the client and the client responds with |
||||
|
a boolean that tells LND if this htlc should be intercepted. |
||||
|
In case of interception, the htlc can be either settled, cancelled or |
||||
|
resumed later by using the ResolveHoldForward endpoint. |
||||
|
*/ |
||||
|
rpc HtlcInterceptor (stream ForwardHtlcInterceptResponse) |
||||
|
returns (stream ForwardHtlcInterceptRequest); |
||||
|
} |
||||
|
|
||||
|
message SendPaymentRequest { |
||||
|
// The identity pubkey of the payment recipient |
||||
|
bytes dest = 1; |
||||
|
|
||||
|
/* |
||||
|
Number of satoshis to send. |
||||
|
|
||||
|
The fields amt and amt_msat are mutually exclusive. |
||||
|
*/ |
||||
|
int64 amt = 2; |
||||
|
|
||||
|
/* |
||||
|
Number of millisatoshis to send. |
||||
|
|
||||
|
The fields amt and amt_msat are mutually exclusive. |
||||
|
*/ |
||||
|
int64 amt_msat = 12; |
||||
|
|
||||
|
// The hash to use within the payment's HTLC |
||||
|
bytes payment_hash = 3; |
||||
|
|
||||
|
/* |
||||
|
The CLTV delta from the current height that should be used to set the |
||||
|
timelock for the final hop. |
||||
|
*/ |
||||
|
int32 final_cltv_delta = 4; |
||||
|
|
||||
|
/* |
||||
|
A bare-bones invoice for a payment within the Lightning Network. With the |
||||
|
details of the invoice, the sender has all the data necessary to send a |
||||
|
payment to the recipient. The amount in the payment request may be zero. In |
||||
|
that case it is required to set the amt field as well. If no payment request |
||||
|
is specified, the following fields are required: dest, amt and payment_hash. |
||||
|
*/ |
||||
|
string payment_request = 5; |
||||
|
|
||||
|
/* |
||||
|
An upper limit on the amount of time we should spend when attempting to |
||||
|
fulfill the payment. This is expressed in seconds. If we cannot make a |
||||
|
successful payment within this time frame, an error will be returned. |
||||
|
This field must be non-zero. |
||||
|
*/ |
||||
|
int32 timeout_seconds = 6; |
||||
|
|
||||
|
/* |
||||
|
The maximum number of satoshis that will be paid as a fee of the payment. |
||||
|
If this field is left to the default value of 0, only zero-fee routes will |
||||
|
be considered. This usually means single hop routes connecting directly to |
||||
|
the destination. To send the payment without a fee limit, use max int here. |
||||
|
|
||||
|
The fields fee_limit_sat and fee_limit_msat are mutually exclusive. |
||||
|
*/ |
||||
|
int64 fee_limit_sat = 7; |
||||
|
|
||||
|
/* |
||||
|
The maximum number of millisatoshis that will be paid as a fee of the |
||||
|
payment. If this field is left to the default value of 0, only zero-fee |
||||
|
routes will be considered. This usually means single hop routes connecting |
||||
|
directly to the destination. To send the payment without a fee limit, use |
||||
|
max int here. |
||||
|
|
||||
|
The fields fee_limit_sat and fee_limit_msat are mutually exclusive. |
||||
|
*/ |
||||
|
int64 fee_limit_msat = 13; |
||||
|
|
||||
|
/* |
||||
|
Deprecated, use outgoing_chan_ids. The channel id of the channel that must |
||||
|
be taken to the first hop. If zero, any channel may be used (unless |
||||
|
outgoing_chan_ids are set). |
||||
|
*/ |
||||
|
uint64 outgoing_chan_id = 8 [jstype = JS_STRING, deprecated = true]; |
||||
|
|
||||
|
/* |
||||
|
The channel ids of the channels are allowed for the first hop. If empty, |
||||
|
any channel may be used. |
||||
|
*/ |
||||
|
repeated uint64 outgoing_chan_ids = 19; |
||||
|
|
||||
|
/* |
||||
|
The pubkey of the last hop of the route. If empty, any hop may be used. |
||||
|
*/ |
||||
|
bytes last_hop_pubkey = 14; |
||||
|
|
||||
|
/* |
||||
|
An optional maximum total time lock for the route. This should not exceed |
||||
|
lnd's `--max-cltv-expiry` setting. If zero, then the value of |
||||
|
`--max-cltv-expiry` is enforced. |
||||
|
*/ |
||||
|
int32 cltv_limit = 9; |
||||
|
|
||||
|
/* |
||||
|
Optional route hints to reach the destination through private channels. |
||||
|
*/ |
||||
|
repeated lnrpc.RouteHint route_hints = 10; |
||||
|
|
||||
|
/* |
||||
|
An optional field that can be used to pass an arbitrary set of TLV records |
||||
|
to a peer which understands the new records. This can be used to pass |
||||
|
application specific data during the payment attempt. Record types are |
||||
|
required to be in the custom range >= 65536. When using REST, the values |
||||
|
must be encoded as base64. |
||||
|
*/ |
||||
|
map<uint64, bytes> dest_custom_records = 11; |
||||
|
|
||||
|
// If set, circular payments to self are permitted. |
||||
|
bool allow_self_payment = 15; |
||||
|
|
||||
|
/* |
||||
|
Features assumed to be supported by the final node. All transitive feature |
||||
|
dependencies must also be set properly. For a given feature bit pair, either |
||||
|
optional or remote may be set, but not both. If this field is nil or empty, |
||||
|
the router will try to load destination features from the graph as a |
||||
|
fallback. |
||||
|
*/ |
||||
|
repeated lnrpc.FeatureBit dest_features = 16; |
||||
|
|
||||
|
/* |
||||
|
The maximum number of partial payments that may be use to complete the full |
||||
|
amount. |
||||
|
*/ |
||||
|
uint32 max_parts = 17; |
||||
|
|
||||
|
/* |
||||
|
If set, only the final payment update is streamed back. Intermediate updates |
||||
|
that show which htlcs are still in flight are suppressed. |
||||
|
*/ |
||||
|
bool no_inflight_updates = 18; |
||||
|
} |
||||
|
|
||||
|
message TrackPaymentRequest { |
||||
|
// The hash of the payment to look up. |
||||
|
bytes payment_hash = 1; |
||||
|
|
||||
|
/* |
||||
|
If set, only the final payment update is streamed back. Intermediate updates |
||||
|
that show which htlcs are still in flight are suppressed. |
||||
|
*/ |
||||
|
bool no_inflight_updates = 2; |
||||
|
} |
||||
|
|
||||
|
message RouteFeeRequest { |
||||
|
/* |
||||
|
The destination once wishes to obtain a routing fee quote to. |
||||
|
*/ |
||||
|
bytes dest = 1; |
||||
|
|
||||
|
/* |
||||
|
The amount one wishes to send to the target destination. |
||||
|
*/ |
||||
|
int64 amt_sat = 2; |
||||
|
} |
||||
|
|
||||
|
message RouteFeeResponse { |
||||
|
/* |
||||
|
A lower bound of the estimated fee to the target destination within the |
||||
|
network, expressed in milli-satoshis. |
||||
|
*/ |
||||
|
int64 routing_fee_msat = 1; |
||||
|
|
||||
|
/* |
||||
|
An estimate of the worst case time delay that can occur. Note that callers |
||||
|
will still need to factor in the final CLTV delta of the last hop into this |
||||
|
value. |
||||
|
*/ |
||||
|
int64 time_lock_delay = 2; |
||||
|
} |
||||
|
|
||||
|
message SendToRouteRequest { |
||||
|
// The payment hash to use for the HTLC. |
||||
|
bytes payment_hash = 1; |
||||
|
|
||||
|
// Route that should be used to attempt to complete the payment. |
||||
|
lnrpc.Route route = 2; |
||||
|
} |
||||
|
|
||||
|
message SendToRouteResponse { |
||||
|
// The preimage obtained by making the payment. |
||||
|
bytes preimage = 1; |
||||
|
|
||||
|
// The failure message in case the payment failed. |
||||
|
lnrpc.Failure failure = 2; |
||||
|
} |
||||
|
|
||||
|
message ResetMissionControlRequest { |
||||
|
} |
||||
|
|
||||
|
message ResetMissionControlResponse { |
||||
|
} |
||||
|
|
||||
|
message QueryMissionControlRequest { |
||||
|
} |
||||
|
|
||||
|
// QueryMissionControlResponse contains mission control state. |
||||
|
message QueryMissionControlResponse { |
||||
|
reserved 1; |
||||
|
|
||||
|
// Node pair-level mission control state. |
||||
|
repeated PairHistory pairs = 2; |
||||
|
} |
||||
|
|
||||
|
// PairHistory contains the mission control state for a particular node pair. |
||||
|
message PairHistory { |
||||
|
// The source node pubkey of the pair. |
||||
|
bytes node_from = 1; |
||||
|
|
||||
|
// The destination node pubkey of the pair. |
||||
|
bytes node_to = 2; |
||||
|
|
||||
|
reserved 3, 4, 5, 6; |
||||
|
|
||||
|
PairData history = 7; |
||||
|
} |
||||
|
|
||||
|
message PairData { |
||||
|
// Time of last failure. |
||||
|
int64 fail_time = 1; |
||||
|
|
||||
|
/* |
||||
|
Lowest amount that failed to forward rounded to whole sats. This may be |
||||
|
set to zero if the failure is independent of amount. |
||||
|
*/ |
||||
|
int64 fail_amt_sat = 2; |
||||
|
|
||||
|
/* |
||||
|
Lowest amount that failed to forward in millisats. This may be |
||||
|
set to zero if the failure is independent of amount. |
||||
|
*/ |
||||
|
int64 fail_amt_msat = 4; |
||||
|
|
||||
|
reserved 3; |
||||
|
|
||||
|
// Time of last success. |
||||
|
int64 success_time = 5; |
||||
|
|
||||
|
// Highest amount that we could successfully forward rounded to whole sats. |
||||
|
int64 success_amt_sat = 6; |
||||
|
|
||||
|
// Highest amount that we could successfully forward in millisats. |
||||
|
int64 success_amt_msat = 7; |
||||
|
} |
||||
|
|
||||
|
message QueryProbabilityRequest { |
||||
|
// The source node pubkey of the pair. |
||||
|
bytes from_node = 1; |
||||
|
|
||||
|
// The destination node pubkey of the pair. |
||||
|
bytes to_node = 2; |
||||
|
|
||||
|
// The amount for which to calculate a probability. |
||||
|
int64 amt_msat = 3; |
||||
|
} |
||||
|
|
||||
|
message QueryProbabilityResponse { |
||||
|
// The success probability for the requested pair. |
||||
|
double probability = 1; |
||||
|
|
||||
|
// The historical data for the requested pair. |
||||
|
PairData history = 2; |
||||
|
} |
||||
|
|
||||
|
message BuildRouteRequest { |
||||
|
/* |
||||
|
The amount to send expressed in msat. If set to zero, the minimum routable |
||||
|
amount is used. |
||||
|
*/ |
||||
|
int64 amt_msat = 1; |
||||
|
|
||||
|
/* |
||||
|
CLTV delta from the current height that should be used for the timelock |
||||
|
of the final hop |
||||
|
*/ |
||||
|
int32 final_cltv_delta = 2; |
||||
|
|
||||
|
/* |
||||
|
The channel id of the channel that must be taken to the first hop. If zero, |
||||
|
any channel may be used. |
||||
|
*/ |
||||
|
uint64 outgoing_chan_id = 3 [jstype = JS_STRING]; |
||||
|
|
||||
|
/* |
||||
|
A list of hops that defines the route. This does not include the source hop |
||||
|
pubkey. |
||||
|
*/ |
||||
|
repeated bytes hop_pubkeys = 4; |
||||
|
} |
||||
|
|
||||
|
message BuildRouteResponse { |
||||
|
/* |
||||
|
Fully specified route that can be used to execute the payment. |
||||
|
*/ |
||||
|
lnrpc.Route route = 1; |
||||
|
} |
||||
|
|
||||
|
message SubscribeHtlcEventsRequest { |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
HtlcEvent contains the htlc event that was processed. These are served on a |
||||
|
best-effort basis; events are not persisted, delivery is not guaranteed |
||||
|
(in the event of a crash in the switch, forward events may be lost) and |
||||
|
some events may be replayed upon restart. Events consumed from this package |
||||
|
should be de-duplicated by the htlc's unique combination of incoming and |
||||
|
outgoing channel id and htlc id. [EXPERIMENTAL] |
||||
|
*/ |
||||
|
message HtlcEvent { |
||||
|
/* |
||||
|
The short channel id that the incoming htlc arrived at our node on. This |
||||
|
value is zero for sends. |
||||
|
*/ |
||||
|
uint64 incoming_channel_id = 1; |
||||
|
|
||||
|
/* |
||||
|
The short channel id that the outgoing htlc left our node on. This value |
||||
|
is zero for receives. |
||||
|
*/ |
||||
|
uint64 outgoing_channel_id = 2; |
||||
|
|
||||
|
/* |
||||
|
Incoming id is the index of the incoming htlc in the incoming channel. |
||||
|
This value is zero for sends. |
||||
|
*/ |
||||
|
uint64 incoming_htlc_id = 3; |
||||
|
|
||||
|
/* |
||||
|
Outgoing id is the index of the outgoing htlc in the outgoing channel. |
||||
|
This value is zero for receives. |
||||
|
*/ |
||||
|
uint64 outgoing_htlc_id = 4; |
||||
|
|
||||
|
/* |
||||
|
The time in unix nanoseconds that the event occurred. |
||||
|
*/ |
||||
|
uint64 timestamp_ns = 5; |
||||
|
|
||||
|
enum EventType { |
||||
|
UNKNOWN = 0; |
||||
|
SEND = 1; |
||||
|
RECEIVE = 2; |
||||
|
FORWARD = 3; |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
The event type indicates whether the htlc was part of a send, receive or |
||||
|
forward. |
||||
|
*/ |
||||
|
EventType event_type = 6; |
||||
|
|
||||
|
oneof event { |
||||
|
ForwardEvent forward_event = 7; |
||||
|
ForwardFailEvent forward_fail_event = 8; |
||||
|
SettleEvent settle_event = 9; |
||||
|
LinkFailEvent link_fail_event = 10; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
message HtlcInfo { |
||||
|
// The timelock on the incoming htlc. |
||||
|
uint32 incoming_timelock = 1; |
||||
|
|
||||
|
// The timelock on the outgoing htlc. |
||||
|
uint32 outgoing_timelock = 2; |
||||
|
|
||||
|
// The amount of the incoming htlc. |
||||
|
uint64 incoming_amt_msat = 3; |
||||
|
|
||||
|
// The amount of the outgoing htlc. |
||||
|
uint64 outgoing_amt_msat = 4; |
||||
|
} |
||||
|
|
||||
|
message ForwardEvent { |
||||
|
// Info contains details about the htlc that was forwarded. |
||||
|
HtlcInfo info = 1; |
||||
|
} |
||||
|
|
||||
|
message ForwardFailEvent { |
||||
|
} |
||||
|
|
||||
|
message SettleEvent { |
||||
|
} |
||||
|
|
||||
|
message LinkFailEvent { |
||||
|
// Info contains details about the htlc that we failed. |
||||
|
HtlcInfo info = 1; |
||||
|
|
||||
|
// FailureCode is the BOLT error code for the failure. |
||||
|
lnrpc.Failure.FailureCode wire_failure = 2; |
||||
|
|
||||
|
/* |
||||
|
FailureDetail provides additional information about the reason for the |
||||
|
failure. This detail enriches the information provided by the wire message |
||||
|
and may be 'no detail' if the wire message requires no additional metadata. |
||||
|
*/ |
||||
|
FailureDetail failure_detail = 3; |
||||
|
|
||||
|
// A string representation of the link failure. |
||||
|
string failure_string = 4; |
||||
|
} |
||||
|
|
||||
|
enum FailureDetail { |
||||
|
UNKNOWN = 0; |
||||
|
NO_DETAIL = 1; |
||||
|
ONION_DECODE = 2; |
||||
|
LINK_NOT_ELIGIBLE = 3; |
||||
|
ON_CHAIN_TIMEOUT = 4; |
||||
|
HTLC_EXCEEDS_MAX = 5; |
||||
|
INSUFFICIENT_BALANCE = 6; |
||||
|
INCOMPLETE_FORWARD = 7; |
||||
|
HTLC_ADD_FAILED = 8; |
||||
|
FORWARDS_DISABLED = 9; |
||||
|
INVOICE_CANCELED = 10; |
||||
|
INVOICE_UNDERPAID = 11; |
||||
|
INVOICE_EXPIRY_TOO_SOON = 12; |
||||
|
INVOICE_NOT_OPEN = 13; |
||||
|
MPP_INVOICE_TIMEOUT = 14; |
||||
|
ADDRESS_MISMATCH = 15; |
||||
|
SET_TOTAL_MISMATCH = 16; |
||||
|
SET_TOTAL_TOO_LOW = 17; |
||||
|
SET_OVERPAID = 18; |
||||
|
UNKNOWN_INVOICE = 19; |
||||
|
INVALID_KEYSEND = 20; |
||||
|
MPP_IN_PROGRESS = 21; |
||||
|
CIRCULAR_ROUTE = 22; |
||||
|
} |
||||
|
|
||||
|
enum PaymentState { |
||||
|
/* |
||||
|
Payment is still in flight. |
||||
|
*/ |
||||
|
IN_FLIGHT = 0; |
||||
|
|
||||
|
/* |
||||
|
Payment completed successfully. |
||||
|
*/ |
||||
|
SUCCEEDED = 1; |
||||
|
|
||||
|
/* |
||||
|
There are more routes to try, but the payment timeout was exceeded. |
||||
|
*/ |
||||
|
FAILED_TIMEOUT = 2; |
||||
|
|
||||
|
/* |
||||
|
All possible routes were tried and failed permanently. Or were no |
||||
|
routes to the destination at all. |
||||
|
*/ |
||||
|
FAILED_NO_ROUTE = 3; |
||||
|
|
||||
|
/* |
||||
|
A non-recoverable error has occured. |
||||
|
*/ |
||||
|
FAILED_ERROR = 4; |
||||
|
|
||||
|
/* |
||||
|
Payment details incorrect (unknown hash, invalid amt or |
||||
|
invalid final cltv delta) |
||||
|
*/ |
||||
|
FAILED_INCORRECT_PAYMENT_DETAILS = 5; |
||||
|
|
||||
|
/* |
||||
|
Insufficient local balance. |
||||
|
*/ |
||||
|
FAILED_INSUFFICIENT_BALANCE = 6; |
||||
|
} |
||||
|
|
||||
|
message PaymentStatus { |
||||
|
// Current state the payment is in. |
||||
|
PaymentState state = 1; |
||||
|
|
||||
|
/* |
||||
|
The pre-image of the payment when state is SUCCEEDED. |
||||
|
*/ |
||||
|
bytes preimage = 2; |
||||
|
|
||||
|
reserved 3; |
||||
|
|
||||
|
/* |
||||
|
The HTLCs made in attempt to settle the payment [EXPERIMENTAL]. |
||||
|
*/ |
||||
|
repeated lnrpc.HTLCAttempt htlcs = 4; |
||||
|
} |
||||
|
|
||||
|
message CircuitKey { |
||||
|
/// The id of the channel that the is part of this circuit. |
||||
|
uint64 chan_id = 1; |
||||
|
|
||||
|
/// The index of the incoming htlc in the incoming channel. |
||||
|
uint64 htlc_id = 2; |
||||
|
} |
||||
|
|
||||
|
message ForwardHtlcInterceptRequest { |
||||
|
/* |
||||
|
The key of this forwarded htlc. It defines the incoming channel id and |
||||
|
the index in this channel. |
||||
|
*/ |
||||
|
CircuitKey incoming_circuit_key = 1; |
||||
|
|
||||
|
// The incoming htlc amount. |
||||
|
uint64 incoming_amount_msat = 5; |
||||
|
|
||||
|
// The incoming htlc expiry. |
||||
|
uint32 incoming_expiry = 6; |
||||
|
|
||||
|
/* |
||||
|
The htlc payment hash. This value is not guaranteed to be unique per |
||||
|
request. |
||||
|
*/ |
||||
|
bytes payment_hash = 2; |
||||
|
|
||||
|
// The requested outgoing channel id for this forwarded htlc. Because of |
||||
|
// non-strict forwarding, this isn't necessarily the channel over which the |
||||
|
// packet will be forwarded eventually. A different channel to the same peer |
||||
|
// may be selected as well. |
||||
|
uint64 outgoing_requested_chan_id = 7; |
||||
|
|
||||
|
// The outgoing htlc amount. |
||||
|
uint64 outgoing_amount_msat = 3; |
||||
|
|
||||
|
// The outgoing htlc expiry. |
||||
|
uint32 outgoing_expiry = 4; |
||||
|
|
||||
|
// Any custom records that were present in the payload. |
||||
|
map<uint64, bytes> custom_records = 8; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
ForwardHtlcInterceptResponse enables the caller to resolve a previously hold |
||||
|
forward. The caller can choose either to: |
||||
|
- `Resume`: Execute the default behavior (usually forward). |
||||
|
- `Reject`: Fail the htlc backwards. |
||||
|
- `Settle`: Settle this htlc with a given preimage. |
||||
|
*/ |
||||
|
message ForwardHtlcInterceptResponse { |
||||
|
/** |
||||
|
The key of this forwarded htlc. It defines the incoming channel id and |
||||
|
the index in this channel. |
||||
|
*/ |
||||
|
CircuitKey incoming_circuit_key = 1; |
||||
|
|
||||
|
// The resolve action for this intercepted htlc. |
||||
|
ResolveHoldForwardAction action = 2; |
||||
|
|
||||
|
// The preimage in case the resolve action is Settle. |
||||
|
bytes preimage = 3; |
||||
|
} |
||||
|
|
||||
|
enum ResolveHoldForwardAction { |
||||
|
SETTLE = 0; |
||||
|
FAIL = 1; |
||||
|
RESUME = 2; |
||||
|
} |
@ -0,0 +1,238 @@ |
|||||
|
syntax = "proto3"; |
||||
|
|
||||
|
import "rpc.proto"; |
||||
|
|
||||
|
package lnrpc; |
||||
|
|
||||
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc"; |
||||
|
|
||||
|
/* |
||||
|
* Comments in this file will be directly parsed into the API |
||||
|
* Documentation as descriptions of the associated method, message, or field. |
||||
|
* These descriptions should go right above the definition of the object, and |
||||
|
* can be in either block or // comment format. |
||||
|
* |
||||
|
* An RPC method can be matched to an lncli command by placing a line in the |
||||
|
* beginning of the description in exactly the following format: |
||||
|
* lncli: `methodname` |
||||
|
* |
||||
|
* Failure to specify the exact name of the command will cause documentation |
||||
|
* generation to fail. |
||||
|
* |
||||
|
* More information on how exactly the gRPC documentation is generated from |
||||
|
* this proto file can be found here: |
||||
|
* https://github.com/lightninglabs/lightning-api |
||||
|
*/ |
||||
|
|
||||
|
// WalletUnlocker is a service that is used to set up a wallet password for |
||||
|
// lnd at first startup, and unlock a previously set up wallet. |
||||
|
service WalletUnlocker { |
||||
|
/* |
||||
|
GenSeed is the first method that should be used to instantiate a new lnd |
||||
|
instance. This method allows a caller to generate a new aezeed cipher seed |
||||
|
given an optional passphrase. If provided, the passphrase will be necessary |
||||
|
to decrypt the cipherseed to expose the internal wallet seed. |
||||
|
|
||||
|
Once the cipherseed is obtained and verified by the user, the InitWallet |
||||
|
method should be used to commit the newly generated seed, and create the |
||||
|
wallet. |
||||
|
*/ |
||||
|
rpc GenSeed (GenSeedRequest) returns (GenSeedResponse); |
||||
|
|
||||
|
/* |
||||
|
InitWallet is used when lnd is starting up for the first time to fully |
||||
|
initialize the daemon and its internal wallet. At the very least a wallet |
||||
|
password must be provided. This will be used to encrypt sensitive material |
||||
|
on disk. |
||||
|
|
||||
|
In the case of a recovery scenario, the user can also specify their aezeed |
||||
|
mnemonic and passphrase. If set, then the daemon will use this prior state |
||||
|
to initialize its internal wallet. |
||||
|
|
||||
|
Alternatively, this can be used along with the GenSeed RPC to obtain a |
||||
|
seed, then present it to the user. Once it has been verified by the user, |
||||
|
the seed can be fed into this RPC in order to commit the new wallet. |
||||
|
*/ |
||||
|
rpc InitWallet (InitWalletRequest) returns (InitWalletResponse); |
||||
|
|
||||
|
/* lncli: `unlock` |
||||
|
UnlockWallet is used at startup of lnd to provide a password to unlock |
||||
|
the wallet database. |
||||
|
*/ |
||||
|
rpc UnlockWallet (UnlockWalletRequest) returns (UnlockWalletResponse); |
||||
|
|
||||
|
/* lncli: `changepassword` |
||||
|
ChangePassword changes the password of the encrypted wallet. This will |
||||
|
automatically unlock the wallet database if successful. |
||||
|
*/ |
||||
|
rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse); |
||||
|
} |
||||
|
|
||||
|
message GenSeedRequest { |
||||
|
/* |
||||
|
aezeed_passphrase is an optional user provided passphrase that will be used |
||||
|
to encrypt the generated aezeed cipher seed. When using REST, this field |
||||
|
must be encoded as base64. |
||||
|
*/ |
||||
|
bytes aezeed_passphrase = 1; |
||||
|
|
||||
|
/* |
||||
|
seed_entropy is an optional 16-bytes generated via CSPRNG. If not |
||||
|
specified, then a fresh set of randomness will be used to create the seed. |
||||
|
When using REST, this field must be encoded as base64. |
||||
|
*/ |
||||
|
bytes seed_entropy = 2; |
||||
|
} |
||||
|
message GenSeedResponse { |
||||
|
/* |
||||
|
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed |
||||
|
cipher seed obtained by the user. This field is optional, as if not |
||||
|
provided, then the daemon will generate a new cipher seed for the user. |
||||
|
Otherwise, then the daemon will attempt to recover the wallet state linked |
||||
|
to this cipher seed. |
||||
|
*/ |
||||
|
repeated string cipher_seed_mnemonic = 1; |
||||
|
|
||||
|
/* |
||||
|
enciphered_seed are the raw aezeed cipher seed bytes. This is the raw |
||||
|
cipher text before run through our mnemonic encoding scheme. |
||||
|
*/ |
||||
|
bytes enciphered_seed = 2; |
||||
|
} |
||||
|
|
||||
|
message InitWalletRequest { |
||||
|
/* |
||||
|
wallet_password is the passphrase that should be used to encrypt the |
||||
|
wallet. This MUST be at least 8 chars in length. After creation, this |
||||
|
password is required to unlock the daemon. When using REST, this field |
||||
|
must be encoded as base64. |
||||
|
*/ |
||||
|
bytes wallet_password = 1; |
||||
|
|
||||
|
/* |
||||
|
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed |
||||
|
cipher seed obtained by the user. This may have been generated by the |
||||
|
GenSeed method, or be an existing seed. |
||||
|
*/ |
||||
|
repeated string cipher_seed_mnemonic = 2; |
||||
|
|
||||
|
/* |
||||
|
aezeed_passphrase is an optional user provided passphrase that will be used |
||||
|
to encrypt the generated aezeed cipher seed. When using REST, this field |
||||
|
must be encoded as base64. |
||||
|
*/ |
||||
|
bytes aezeed_passphrase = 3; |
||||
|
|
||||
|
/* |
||||
|
recovery_window is an optional argument specifying the address lookahead |
||||
|
when restoring a wallet seed. The recovery window applies to each |
||||
|
individual branch of the BIP44 derivation paths. Supplying a recovery |
||||
|
window of zero indicates that no addresses should be recovered, such after |
||||
|
the first initialization of the wallet. |
||||
|
*/ |
||||
|
int32 recovery_window = 4; |
||||
|
|
||||
|
/* |
||||
|
channel_backups is an optional argument that allows clients to recover the |
||||
|
settled funds within a set of channels. This should be populated if the |
||||
|
user was unable to close out all channels and sweep funds before partial or |
||||
|
total data loss occurred. If specified, then after on-chain recovery of |
||||
|
funds, lnd begin to carry out the data loss recovery protocol in order to |
||||
|
recover the funds in each channel from a remote force closed transaction. |
||||
|
*/ |
||||
|
ChanBackupSnapshot channel_backups = 5; |
||||
|
|
||||
|
/* |
||||
|
stateless_init is an optional argument instructing the daemon NOT to create |
||||
|
any *.macaroon files in its filesystem. If this parameter is set, then the |
||||
|
admin macaroon returned in the response MUST be stored by the caller of the |
||||
|
RPC as otherwise all access to the daemon will be lost! |
||||
|
*/ |
||||
|
bool stateless_init = 6; |
||||
|
} |
||||
|
message InitWalletResponse { |
||||
|
/* |
||||
|
The binary serialized admin macaroon that can be used to access the daemon |
||||
|
after creating the wallet. If the stateless_init parameter was set to true, |
||||
|
this is the ONLY copy of the macaroon and MUST be stored safely by the |
||||
|
caller. Otherwise a copy of this macaroon is also persisted on disk by the |
||||
|
daemon, together with other macaroon files. |
||||
|
*/ |
||||
|
bytes admin_macaroon = 1; |
||||
|
} |
||||
|
|
||||
|
message UnlockWalletRequest { |
||||
|
/* |
||||
|
wallet_password should be the current valid passphrase for the daemon. This |
||||
|
will be required to decrypt on-disk material that the daemon requires to |
||||
|
function properly. When using REST, this field must be encoded as base64. |
||||
|
*/ |
||||
|
bytes wallet_password = 1; |
||||
|
|
||||
|
/* |
||||
|
recovery_window is an optional argument specifying the address lookahead |
||||
|
when restoring a wallet seed. The recovery window applies to each |
||||
|
individual branch of the BIP44 derivation paths. Supplying a recovery |
||||
|
window of zero indicates that no addresses should be recovered, such after |
||||
|
the first initialization of the wallet. |
||||
|
*/ |
||||
|
int32 recovery_window = 2; |
||||
|
|
||||
|
/* |
||||
|
channel_backups is an optional argument that allows clients to recover the |
||||
|
settled funds within a set of channels. This should be populated if the |
||||
|
user was unable to close out all channels and sweep funds before partial or |
||||
|
total data loss occurred. If specified, then after on-chain recovery of |
||||
|
funds, lnd begin to carry out the data loss recovery protocol in order to |
||||
|
recover the funds in each channel from a remote force closed transaction. |
||||
|
*/ |
||||
|
ChanBackupSnapshot channel_backups = 3; |
||||
|
|
||||
|
/* |
||||
|
stateless_init is an optional argument instructing the daemon NOT to create |
||||
|
any *.macaroon files in its file system. |
||||
|
*/ |
||||
|
bool stateless_init = 4; |
||||
|
} |
||||
|
message UnlockWalletResponse { |
||||
|
} |
||||
|
|
||||
|
message ChangePasswordRequest { |
||||
|
/* |
||||
|
current_password should be the current valid passphrase used to unlock the |
||||
|
daemon. When using REST, this field must be encoded as base64. |
||||
|
*/ |
||||
|
bytes current_password = 1; |
||||
|
|
||||
|
/* |
||||
|
new_password should be the new passphrase that will be needed to unlock the |
||||
|
daemon. When using REST, this field must be encoded as base64. |
||||
|
*/ |
||||
|
bytes new_password = 2; |
||||
|
|
||||
|
/* |
||||
|
stateless_init is an optional argument instructing the daemon NOT to create |
||||
|
any *.macaroon files in its filesystem. If this parameter is set, then the |
||||
|
admin macaroon returned in the response MUST be stored by the caller of the |
||||
|
RPC as otherwise all access to the daemon will be lost! |
||||
|
*/ |
||||
|
bool stateless_init = 3; |
||||
|
|
||||
|
/* |
||||
|
new_macaroon_root_key is an optional argument instructing the daemon to |
||||
|
rotate the macaroon root key when set to true. This will invalidate all |
||||
|
previously generated macaroons. |
||||
|
*/ |
||||
|
bool new_macaroon_root_key = 4; |
||||
|
} |
||||
|
message ChangePasswordResponse { |
||||
|
/* |
||||
|
The binary serialized admin macaroon that can be used to access the daemon |
||||
|
after rotating the macaroon root key. If both the stateless_init and |
||||
|
new_macaroon_root_key parameter were set to true, this is the ONLY copy of |
||||
|
the macaroon that was created from the new root key and MUST be stored |
||||
|
safely by the caller. Otherwise a copy of this macaroon is also persisted on |
||||
|
disk by the daemon, together with other macaroon files. |
||||
|
*/ |
||||
|
bytes admin_macaroon = 1; |
||||
|
} |
@ -0,0 +1,132 @@ |
|||||
|
import * as crypto from 'crypto' |
||||
|
import { models } from './models' |
||||
|
import * as cryptoJS from 'crypto-js' |
||||
|
import * as path from 'path' |
||||
|
import { success, failure } from './utils/res' |
||||
|
import {setInMemoryMacaroon} from './utils/macaroon' |
||||
|
const fs = require('fs') |
||||
|
|
||||
|
const env = process.env.NODE_ENV || 'development'; |
||||
|
const config = require(path.join(__dirname, '../config/app.json'))[env]; |
||||
|
|
||||
|
/* |
||||
|
"unlock": true, |
||||
|
"encrypted_macaroon_path": "/relay/.lnd/admin.macaroon.enc" |
||||
|
*/ |
||||
|
|
||||
|
export async function unlocker(req, res): Promise<boolean> { |
||||
|
const { password } = req.body |
||||
|
if(!password) { |
||||
|
failure(res, 'no password') |
||||
|
return false |
||||
|
} |
||||
|
|
||||
|
const encMacPath = config.encrypted_macaroon_path |
||||
|
if(!encMacPath) { |
||||
|
failure(res, 'no macaroon path') |
||||
|
return false |
||||
|
} |
||||
|
|
||||
|
let hexMac:string |
||||
|
|
||||
|
try { |
||||
|
|
||||
|
var encMac = fs.readFileSync(config.encrypted_macaroon_path, "utf8"); |
||||
|
if(!encMac) { |
||||
|
failure(res, 'no macaroon') |
||||
|
return false |
||||
|
} |
||||
|
|
||||
|
console.log("PWD",password,typeof password) |
||||
|
console.log("ENCMAC",encMac,typeof encMac) |
||||
|
const decMac = decryptMacaroon(password, encMac) |
||||
|
if(!decMac) { |
||||
|
failure(res, 'failed to decrypt macaroon') |
||||
|
return false |
||||
|
} |
||||
|
|
||||
|
hexMac = base64ToHex(decMac) |
||||
|
|
||||
|
} catch(e) { |
||||
|
failure(res, e) |
||||
|
return false |
||||
|
} |
||||
|
|
||||
|
if(hexMac) { |
||||
|
setInMemoryMacaroon(hexMac) |
||||
|
success(res, 'success!') |
||||
|
return true |
||||
|
} else { |
||||
|
failure(res, 'failed to set macaroon in memory') |
||||
|
return false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export async function authModule(req, res, next) { |
||||
|
if ( |
||||
|
req.path == '/app' || |
||||
|
req.path == '/' || |
||||
|
req.path == '/unlock' || |
||||
|
req.path == '/info' || |
||||
|
req.path == '/action' || |
||||
|
req.path == '/contacts/tokens' || |
||||
|
req.path == '/latest' || |
||||
|
req.path.startsWith('/static') || |
||||
|
req.path == '/contacts/set_dev' |
||||
|
) { |
||||
|
next() |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
if (process.env.HOSTING_PROVIDER === 'true') { |
||||
|
// const domain = process.env.INVITE_SERVER
|
||||
|
const host = req.headers.origin |
||||
|
console.log('=> host:', host) |
||||
|
const referer = req.headers.referer |
||||
|
console.log('=> referer:', referer) |
||||
|
if (req.path === '/invoices') { |
||||
|
next() |
||||
|
return |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const token = req.headers['x-user-token'] || req.cookies['x-user-token'] |
||||
|
|
||||
|
if (token == null) { |
||||
|
res.writeHead(401, 'Access invalid for user', { 'Content-Type': 'text/plain' }); |
||||
|
res.end('Invalid credentials'); |
||||
|
} else { |
||||
|
const user = await models.Contact.findOne({ where: { isOwner: true } }) |
||||
|
const hashedToken = crypto.createHash('sha256').update(token).digest('base64'); |
||||
|
if (user.authToken == null || user.authToken != hashedToken) { |
||||
|
res.writeHead(401, 'Access invalid for user', { 'Content-Type': 'text/plain' }); |
||||
|
res.end('Invalid credentials'); |
||||
|
} else { |
||||
|
next(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function decryptMacaroon(password: string, macaroon: string) { |
||||
|
try { |
||||
|
const decrypted = cryptoJS.AES.decrypt(macaroon || '', password).toString(cryptoJS.enc.Base64) |
||||
|
const decryptResult = atob(decrypted) |
||||
|
return decryptResult |
||||
|
} catch (e) { |
||||
|
console.error('cipher mismatch, macaroon decryption failed') |
||||
|
console.error(e) |
||||
|
return '' |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function base64ToHex (str) { |
||||
|
const raw = atob(str) |
||||
|
let result = '' |
||||
|
for (let i = 0; i < raw.length; i++) { |
||||
|
const hex = raw.charCodeAt(i).toString(16) |
||||
|
result += (hex.length === 2 ? hex : '0' + hex) |
||||
|
} |
||||
|
return result.toUpperCase() |
||||
|
} |
||||
|
|
||||
|
const atob = a => Buffer.from(a, 'base64').toString('binary') |
@ -0,0 +1,20 @@ |
|||||
|
import * as fs from 'fs' |
||||
|
import * as path from 'path' |
||||
|
|
||||
|
const env = process.env.NODE_ENV || 'development'; |
||||
|
const config = require(path.join(__dirname, '../../config/app.json'))[env] |
||||
|
|
||||
|
let inMemoryMacaroon: string = ''; // hex encoded
|
||||
|
|
||||
|
export function getMacaroon() { |
||||
|
if(config.unlock) { |
||||
|
return inMemoryMacaroon |
||||
|
} else { |
||||
|
const m = fs.readFileSync(config.macaroon_location) |
||||
|
return m.toString('hex'); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function setInMemoryMacaroon(mac:string) { |
||||
|
inMemoryMacaroon = mac |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
import * as path from 'path' |
||||
|
import { unlockWallet } from './lightning' |
||||
|
const fs = require('fs') |
||||
|
const readline = require('readline'); |
||||
|
|
||||
|
const env = process.env.NODE_ENV || 'development'; |
||||
|
const config = require(path.join(__dirname, '../../config/app.json'))[env] |
||||
|
|
||||
|
console.log(JSON.stringify(config,null,2)) |
||||
|
|
||||
|
/* |
||||
|
"lnd_pwd_path": "/relay/.lnd/.lndpwd" |
||||
|
*/ |
||||
|
|
||||
|
export async function tryToUnlockLND() { |
||||
|
const p = config.lnd_pwd_path |
||||
|
if (!p) return |
||||
|
|
||||
|
console.log('==>',p) |
||||
|
|
||||
|
var pwd = await getFirstLine(config.lnd_pwd_path); |
||||
|
if(!pwd) return |
||||
|
|
||||
|
console.log('==>',pwd,typeof pwd) |
||||
|
|
||||
|
try { |
||||
|
await unlockWallet(String(pwd)) |
||||
|
} catch(e) { |
||||
|
console.log('[unlock] Error:',e) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function getFirstLine(pathToFile) { |
||||
|
const readable = fs.createReadStream(pathToFile); |
||||
|
const reader = readline.createInterface({ input: readable }); |
||||
|
const line = await new Promise((resolve) => { |
||||
|
reader.on('line', (line) => { |
||||
|
reader.close(); |
||||
|
resolve(line); |
||||
|
}); |
||||
|
}); |
||||
|
readable.close(); |
||||
|
return line; |
||||
|
} |
||||
|
|
||||
|
|
Loading…
Reference in new issue