Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init(config_path, root_path) {
const config = CaliperUtils.parseYaml(config_path);
networkRoot = root_path;
ORGS = config.fabric.network;
isLegacy = (config.info.Version.startsWith('1.0') || config.info.Version.startsWith('1.1'));
if(!isLegacy){
Gateway = require('fabric-network').Gateway;
InMemoryWallet = require('fabric-network').InMemoryWallet;
X509WalletMixin = require('fabric-network').X509WalletMixin;
}
}
async _addToWallet(org, certificate, key, name) {
const walletId = FabricNetworkAPI.X509WalletMixin.createIdentity(this.networkUtil.getMspIdOfOrganization(org), certificate, key);
await this.wallet.import(name, walletId);
logger.info(`Identity ${name} created and imported to wallet`);
}