Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const tlsOptions = {
trustedRoots: [],
verify: false
};
const CAClient = require('fabric-ca-client');
let crypto = CAClient.newCryptoSuite({ software: true, keysize: 384 });
const keyValStorePath = path.join(testutil.getTempDir(), 'kvsTemp');
if (!crypto._cryptoKeyStore) {
t.pass('cryptoKeyStore is not set on a new cryptoSuite');
} else {
t.fail('cryptoKeyStore should not be set on a new cryptoSuite');
}
const cks = CAClient.newCryptoKeyStore({ path: keyValStorePath });
crypto.setCryptoKeyStore(cks);
const client = new CAClient('http://localhost:7054', tlsOptions, 'peerOrg1', crypto);
client.setCryptoSuite(crypto);
crypto = client.getCryptoSuite();
if (crypto && crypto._cryptoKeyStore) {
t.pass('Successfully called getCryptoSuite() with cryptoKeyStore set');
}
else {
if (!crypto) {
t.fail('getCryptoSuite() did not return an object');
} else {
t.fail('getCryptoSuite() should contain a cryptoKeyStore');
}