Changed implementation inside __parseSettings for the certificates to throw in case of necessity

This commit is contained in:
alexandercerutti
2018-08-26 12:02:13 +02:00
parent eeb925b2a5
commit 6b4ec893d8

View File

@@ -583,18 +583,21 @@ class Pass {
return readFile(resolvedPath); return readFile(resolvedPath);
}); });
return Promise.all(certPaths).then(contents => { return Promise.all(certPaths)
contents.forEach((file, index) => { .then(contents => {
let certName = optCertsNames[index]; contents.forEach((file, index) => {
let pem = parsePEM(file, options.certificates[certName].passphrase); let certName = optCertsNames[index];
let pem = parsePEM(file, options.certificates[certName].passphrase);
if (!pem) { if (!pem) {
return reject(errors.INVALID_CERTS) return reject(errors.INVALID_CERTS)
} }
this.Certificates[certName] = pem; this.Certificates[certName] = pem;
});
}).catch(err => {
throw new Error(errors.INVALID_CERTS);
}); });
});
} }
} }