@greaspace/hyperledger-fabric-client-utils
Version:
Client utilities for communicating with chaincode on a Hyperledger Fabric blockchain network.
19 lines (17 loc) • 547 B
JavaScript
const fs = require('fs');
const logger = require('./logger').getLogger('fabric/loadCert');
module.exports = function loadCert(certPath, certOptions = {}) {
return new Promise((resolve, reject) => {
logger.info(`Loading certificate for path: ${certPath}`);
fs.readFile(certPath, 'utf8', (err, ordererCert) => {
if (err) {
reject(err);
return;
}
resolve({
...certOptions,
pem: ordererCert
});
});
});
};