Ejemplo n.º 1
0
 return tslib_1.__awaiter(this, void 0, void 0, function* () {
     try {
         const f = yield fs_1.fsReadFile(this.portFilePath, { encoding: 'utf8' });
         return Number(f);
     }
     catch (e) {
         if (e.code !== 'ENOENT') {
             throw e;
         }
     }
 });
Ejemplo n.º 2
0
 return tslib_1.__awaiter(this, void 0, void 0, function* () {
     try {
         yield fs_1.fsStat(pubkeyPath);
     }
     catch (e) {
         if (e.code === 'ENOENT') {
             throw fs_1.ERROR_FILE_NOT_FOUND;
         }
         throw e;
     }
     return parsePublicKey((yield fs_1.fsReadFile(pubkeyPath, { encoding: 'utf8' })).trim());
 });
Ejemplo n.º 3
0
 return tslib_1.__awaiter(this, void 0, void 0, function* () {
     try {
         yield fs_1.fsStat(keyPath);
     }
     catch (e) {
         if (e.code === 'ENOENT') {
             throw exports.ERROR_SSH_MISSING_PRIVKEY;
         }
         throw e;
     }
     const f = yield fs_1.fsReadFile(keyPath, { encoding: 'utf8' });
     const lines = f.split('\n');
     if (!lines[0].match(/^\-{5}BEGIN [R|D]SA PRIVATE KEY\-{5}$/)) {
         throw exports.ERROR_SSH_INVALID_PRIVKEY;
     }
 });
Ejemplo n.º 4
0
 KEYS = yield Promise.all(conform(c.ssl.keyfile).map(p => fs_1.fsReadFile(p, { encoding: 'utf8' })));