Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('FabricCAServices: Test newCryptoSuite() function', (t) => {
const tlsOptions = {
trustedRoots: [],
verify: false
};
const CAClient = require('fabric-ca-client');
let crypto = CAClient.newCryptoSuite({ software: true, keysize: 384 });
const client = new CAClient('http://localhost:7054', tlsOptions, 'peerOrg1', crypto);
client.setCryptoSuite(crypto);
crypto = client.getCryptoSuite();
if (crypto) {
t.pass('Successfully called getCryptoSuite()');
}
else {
t.fail('getCryptoSuite() did not return an object');
}
t.end();
});
test('FabricCAServices: Test newCryptoKeyStore() function', (t) => {
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();